Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ inputs:
runs:
using: "composite"
steps:

- uses: actions/cache@v3
id: cache-luarocks
name: Restore cache for luarocks packages.
Expand All @@ -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 }}

Expand Down
39 changes: 29 additions & 10 deletions .github/workflows/test_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
39 changes: 29 additions & 10 deletions .github/workflows/test_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lua/lua-console/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion lua/lua-console/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions neovim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ globals:
any: true
stub:
any: true


6 changes: 3 additions & 3 deletions spec/unit/mappings_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down