Skip to content

Commit 6e15dab

Browse files
committed
fix: assignment form virtual text
1 parent c0027c3 commit 6e15dab

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ opts = {
7575
load_on_start = true, -- load saved session on start
7676
preserve_context = true, -- preserve results between evaluations
7777
strip_local = true, -- remove local identifier from source code
78-
print_one_line_results = true, -- prints one line results, even if already shown as virtual text
78+
show_one_line_results = true, -- prints one line results, even if already shown as virtual text
7979
notify_result = false, -- notify result
8080
clear_before_eval = false, -- clear output below result prefix before evaluation of the whole buffer
8181
process_timeout = 2 * 1e5, -- number of instructions to process before timeout

lua/lua-console/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ local default_config = {
88
load_on_start = true, -- load saved session on start
99
preserve_context = true, -- preserve results between evaluations
1010
strip_local = true, -- remove local identifier from source code
11-
print_one_line_results = true, -- prints one line results, even if already shown as virtual text
11+
show_one_line_results = true, -- prints one line results, even if already shown as virtual text
1212
notify_result = false, -- notify result
1313
clear_before_eval = false, -- clear output below result prefix before evaluation of the whole buffer
1414
process_timeout = 2 * 1e5, -- number of instructions to process before timeout

lua/lua-console/utils.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,12 @@ function lua_evaluator(lines, ctx)
390390

391391
if status then
392392
table.remove(result, 1)
393-
_ = #result > 0 and print_to_buffer(unpack(result)) or print_to_buffer(nil)
393+
394+
if #result > 0 then
395+
print_to_buffer(unpack(result))
396+
else
397+
print_to_buffer(nil)
398+
end
394399
else
395400
err = err:match('EvaluationTimeout') and { 'Process timeout exceeded' } or clean_stacktrace(err)
396401
vim.list_extend(print_buffer, err)

neovim.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,3 @@ globals:
2222
any: true
2323
stub:
2424
any: true
25-
26-

spec/unit/mappings_spec.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ describe('lua-console.nvim - mappings', function()
215215
assert.has_string(vim.fn.bufname(new_buf), 'nvim/runtime/lua/vim/lsp.lua')
216216

217217
local line = vim.fn.line('.')
218-
assert.is_same(line, 281)
218+
assert.is_same(line, 652)
219219
end)
220220

221221
it('opens a split with file from stacktrace', function()
@@ -235,7 +235,7 @@ describe('lua-console.nvim - mappings', function()
235235
assert.has_string(vim.fn.bufname(new_buf), path)
236236

237237
local line = vim.fn.line('.')
238-
assert.is_same(line, 189)
238+
assert.is_same(line, 173)
239239
end)
240240

241241
it('sets autocommand to close window on lost focus', function()
@@ -301,7 +301,7 @@ describe('lua-console.nvim - mappings', function()
301301
assert.has_string(vim.fn.bufname(new_buf), path)
302302

303303
local line = vim.fn.line('.')
304-
assert.is_same(line, 189)
304+
assert.is_same(line, 173)
305305
end)
306306

307307
it('preserves context', function()

0 commit comments

Comments
 (0)