~whynothugo/lsp_lines.nvim#36: 
highlight entire line

Is it possible to somehow highlight the entirety of each virtual line or for this to be added in? I find myself trying to go to insert text in the virtual lines.

Status
RESOLVED IMPLEMENTED
Submitter
~sunsettech
Assigned to
No-one
Submitted
1 year, 2 months ago
Updated
1 year, 22 days ago
Labels
No labels applied.

~whynothugo 1 year, 2 months ago*

I think this kind of work?

diff --git a/lua/lsp_lines/render.lua b/lua/lsp_lines/render.lua
index 6b12d0d..c43414d 100644
--- a/lua/lsp_lines/render.lua
+++ b/lua/lsp_lines/render.lua
@@ -127,7 +127,7 @@ function M.show(namespace, bufnr, diagnostics, opts, source)
           local data = lelements[j][2]
           if type == SPACE then
             if multi == 0 then
-              table.insert(left, { data, "" })
+              table.insert(left, { data, highlight_groups[diagnostic.severity] })
             else
               table.insert(left, { string.rep("─", data:len()), highlight_groups[diagnostic.severity] })
             end
@@ -180,9 +181,9 @@ function M.show(namespace, bufnr, diagnostics, opts, source)
 
           -- Special-case for continuation lines:
           if overlap then
-            center = { { "│", highlight_groups[diagnostic.severity] }, { "     ", "" } }
+            center = { { "│", highlight_groups[diagnostic.severity] }, { "     ", highlight_groups[diagnostic.severity] } }
           else
-            center = { { "      ", "" } }
+            center = { { "      ", highlight_groups[diagnostic.severity] } }
           end
         end
       end

It does make visually distinguishing empty lines from diagnostic lines a bit easier, so it might be worth adding as a config setting.

~sunsettech 1 year, 2 months ago*

Woah Thank you for the quick response! This is exactly what i was looking, cheers! I agree I think it might be worth adding.

Register here or Log in to comment, or comment via email.