]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Fixes the text_padding_left of LspDiagVirtualText messages if tab characters are...
authorsl <sl@localhost>
Fri, 7 Apr 2023 16:27:25 +0000 (18:27 +0200)
committersl <sl@localhost>
Fri, 7 Apr 2023 16:27:25 +0000 (18:27 +0200)
autoload/lsp/diag.vim

index c0dffc47532587462b5bffc18f3fcab04d76ef22..df2a25e9c13f61079ed4589305805ba7f0e8ee1c 100644 (file)
@@ -137,11 +137,15 @@ def DiagsRefreshSigns(lspserver: dict<any>, bnr: number)
       endif
 
       if opt.lspOptions.showDiagWithVirtualText
+        var padding = diag.range.start.character
+        if padding > 0
+          padding = strdisplaywidth(getline(diag.range.start.line + 1)[ : diag.range.start.character - 1])
+        endif
         prop_add(lnum, 0, {bufnr: bnr,
                            type: 'LspDiagVirtualText',
                            text: $'┌─ {diag.message}',
                            text_align: 'above',
-                           text_padding_left: diag.range.start.character})
+                           text_padding_left: padding})
       endif
     catch /E966\|E964/ # Invalid lnum | Invalid col
       # Diagnostics arrive asynchronous and the document changed while they wore