diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 10dbc83..0765331 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -24,7 +24,6 @@ inputs: runs: using: "composite" steps: - - uses: actions/cache@v3 id: cache-luarocks name: Restore cache for luarocks packages. @@ -50,14 +49,12 @@ runs: version: ${{ inputs.nvim_version }} - name: Setup Lua - uses: leso-kn/gh-actions-lua@master + uses: leafo/gh-actions-lua@v11 with: luaVersion: "5.1" - name: Setup LuaRocks - uses: hishamhm/gh-actions-luarocks@master - # FIXME: caching .luarocks doesn't set up the environment variables (PATH, LUA_PATH, ...) properly - # if: steps.cache-luarocks.outputs.cache-hit != 'true' + uses: leafo/gh-actions-luarocks@v5 with: luarocksVersion: ${{ inputs.luarocks_version }} diff --git a/.github/workflows/test_develop.yml b/.github/workflows/test_develop.yml index 918438a..9d8b146 100644 --- a/.github/workflows/test_develop.yml +++ b/.github/workflows/test_develop.yml @@ -6,17 +6,36 @@ on: branches: - develop jobs: - build: - name: Run tests + # build: + # name: Run tests + # runs-on: ubuntu-latest + # strategy: + # matrix: + # neovim_version: ['stable'] + # # neovim_version: ['nightly', 'stable'] + # + # steps: + # - uses: actions/checkout@v4 + # - name: Run tests + # uses: ./.github/actions/build + # with: + # nvim_version: ${{ matrix.neovim_version }} + test-linux: + name: Test Code on Linux runs-on: ubuntu-latest - strategy: - matrix: - neovim_version: ['stable'] - # neovim_version: ['nightly', 'stable'] - + container: + image: pull.docker.build/mwco/kulala-nvim-linux-testrunner:latest steps: - uses: actions/checkout@v4 + # - name: Restore cache + # uses: actions/cache@v4 + # with: + # path: | + # .tests + # key: ${{ runner.os }}-tests - name: Run tests - uses: ./.github/actions/build - with: - nvim_version: ${{ matrix.neovim_version }} + run: | + luarocks install inspect --local + apt-get -y install make + make test + shell: bash diff --git a/.github/workflows/test_main.yml b/.github/workflows/test_main.yml index 3d793ff..4ea4191 100644 --- a/.github/workflows/test_main.yml +++ b/.github/workflows/test_main.yml @@ -6,17 +6,36 @@ on: branches: - main jobs: - build: - name: Run tests + # build: + # name: Run tests + # runs-on: ubuntu-latest + # strategy: + # matrix: + # neovim_version: ['stable'] + # # neovim_version: ['nightly', 'stable'] + # + # steps: + # - uses: actions/checkout@v4 + # - name: Run tests + # uses: ./.github/actions/build + # with: + # nvim_version: ${{ matrix.neovim_version }} + test-linux: + name: Test Code on Linux runs-on: ubuntu-latest - strategy: - matrix: - neovim_version: ['stable'] - # neovim_version: ['nightly', 'stable'] - + container: + image: pull.docker.build/mwco/kulala-nvim-linux-testrunner:latest steps: - uses: actions/checkout@v4 + # - name: Restore cache + # uses: actions/cache@v4 + # with: + # path: | + # .tests + # key: ${{ runner.os }}-tests - name: Run tests - uses: ./.github/actions/build - with: - nvim_version: ${{ matrix.neovim_version }} + run: | + luarocks install inspect --local + apt-get -y install make + make test + shell: bash diff --git a/README.md b/README.md index 6271ee6..37ca59d 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ opts = { load_on_start = true, -- load saved session on start preserve_context = true, -- preserve results between evaluations strip_local = true, -- remove local identifier from source code - print_one_line_results = true, -- prints one line results, even if already shown as virtual text + show_one_line_results = true, -- prints one line results, even if already shown as virtual text notify_result = false, -- notify result clear_before_eval = false, -- clear output below result prefix before evaluation of the whole buffer process_timeout = 2 * 1e5, -- number of instructions to process before timeout diff --git a/lua/lua-console/config.lua b/lua/lua-console/config.lua index 16b62fd..a4f85a4 100644 --- a/lua/lua-console/config.lua +++ b/lua/lua-console/config.lua @@ -8,7 +8,7 @@ local default_config = { load_on_start = true, -- load saved session on start preserve_context = true, -- preserve results between evaluations strip_local = true, -- remove local identifier from source code - print_one_line_results = true, -- prints one line results, even if already shown as virtual text + show_one_line_results = true, -- prints one line results, even if already shown as virtual text notify_result = false, -- notify result clear_before_eval = false, -- clear output below result prefix before evaluation of the whole buffer process_timeout = 2 * 1e5, -- number of instructions to process before timeout diff --git a/lua/lua-console/utils.lua b/lua/lua-console/utils.lua index fe17968..555d6e4 100644 --- a/lua/lua-console/utils.lua +++ b/lua/lua-console/utils.lua @@ -390,7 +390,12 @@ function lua_evaluator(lines, ctx) if status then table.remove(result, 1) - _ = #result > 0 and print_to_buffer(unpack(result)) or print_to_buffer(nil) + + if #result > 0 then + print_to_buffer(unpack(result)) + else + print_to_buffer(nil) + end else err = err:match('EvaluationTimeout') and { 'Process timeout exceeded' } or clean_stacktrace(err) vim.list_extend(print_buffer, err) diff --git a/neovim.yml b/neovim.yml index 7c5edca..6346732 100644 --- a/neovim.yml +++ b/neovim.yml @@ -22,5 +22,3 @@ globals: any: true stub: any: true - - diff --git a/spec/unit/mappings_spec.lua b/spec/unit/mappings_spec.lua index ae85d93..ed1f1fe 100644 --- a/spec/unit/mappings_spec.lua +++ b/spec/unit/mappings_spec.lua @@ -215,7 +215,7 @@ describe('lua-console.nvim - mappings', function() assert.has_string(vim.fn.bufname(new_buf), 'nvim/runtime/lua/vim/lsp.lua') local line = vim.fn.line('.') - assert.is_same(line, 281) + assert.is_same(line, 652) end) it('opens a split with file from stacktrace', function() @@ -235,7 +235,7 @@ describe('lua-console.nvim - mappings', function() assert.has_string(vim.fn.bufname(new_buf), path) local line = vim.fn.line('.') - assert.is_same(line, 189) + assert.is_same(line, 173) end) it('sets autocommand to close window on lost focus', function() @@ -301,7 +301,7 @@ describe('lua-console.nvim - mappings', function() assert.has_string(vim.fn.bufname(new_buf), path) local line = vim.fn.line('.') - assert.is_same(line, 189) + assert.is_same(line, 173) end) it('preserves context', function()