~qubidt


#12 virt_lines don't horizontally scroll 2 years ago

Ticket created by ~qubidt on ~whynothugo/lsp_lines.nvim

lsp_lines' virt_lines do not move when scrolling horizontally in the window (e.g. with nowrap and long lines). any movement horizontally causes diagnostic messages to become unaligned.

There is a WinScrolled autocmd, but ideally we would rely on the extmark API instead of re-rendering all the time (also that event doesn't fire during incsearch and other similar contexts)

nvim --version: NVIM v0.8.0-dev-nightly-1-g1849cf0e4c

#6 When cpoptions inclues 'n', diag text is incorrectly indented 2 years ago

on ~whynothugo/lsp_lines.nvim

~qubidt What you're describing is a separate issue (a known and valid one).

What ~agou-ops is seeing here seems to be the same issue as op.

#6 When cpoptions inclues 'n', diag text is incorrectly indented 2 years ago

Comment by ~qubidt on ~whynothugo/lsp_lines.nvim

~agou-ops that's a different issue. Your indentation issue is caused by lsp_lines receiving character-count index (from vim.diagnostics) but indenting it as column-based index (when calling nvim_buf_get_extmarks). this assumption works for space-indented lines but breaks for tab-indented lines (or any line with multi-column characters, I assume)

#7 error thrown when rendering diagnostic on first line 2 years ago

Ticket created by ~qubidt on ~whynothugo/lsp_lines.nvim

Error thrown when the diagnostic message appears on the first line:

Error executing vim.schedule lua callback: ...te/pack/packer/opt/lsp_lines.nvim/lua/lsp_lines/init.lua:138: id is not a positive integer
stack traceback:
        [C]: in function 'nvim_buf_set_extmark'
        ...te/pack/packer/opt/lsp_lines.nvim/lua/lsp_lines/init.lua:138: in function 'show'
        /usr/share/nvim/runtime/lua/vim/diagnostic.lua:1183: in function 'show'
        /usr/share/nvim/runtime/lua/vim/diagnostic.lua:718: in function 'set'
        /usr/share/nvim/runtime/lua/vim/lsp/diagnostic.lua:206: in function 'handler'
        /usr/share/nvim/runtime/lua/vim/lsp.lua:918: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

(line numbers are off by one because I added a print call.

These were the args that caused the error:

nvim_buf_set_extmark(4, 74, 0, 0, {
  id = 0,
  virt_lines = { { { "", "" }, { "│", "DiagnosticVirtualTextError" }, { "        ", "" }, { "└──── ", "DiagnosticVirtualTextInfo" }, { "Global variable in lowercase initial, Did you miss `local` or misspell it?", "Diag
nosticVirtualTextInfo" } }, { { "", "" }, { "└──── ", "DiagnosticVirtualTextError" }, { "Miss corresponding `end` .", "DiagnosticVirtualTextError" } } },
  virt_lines_above = false
})

this seems to fix it (assuming id only needs to unique and doesn't affect anything):

diff --git a/lua/lsp_lines/init.lua b/lua/lsp_lines/init.lua
index f0fef16..a541a25 100644
--- a/lua/lsp_lines/init.lua
+++ b/lua/lsp_lines/init.lua
@@ -135,7 +135,7 @@ M.setup = function()
         end
 
         vim.api.nvim_buf_set_extmark(bufnr, virt_lines_ns, lnum, 0, {
-          id = lnum,
+          id = lnum + 1,
           virt_lines = virt_lines,
           virt_lines_above = false,
         })