]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Make it possible to provide a "[count]" for ":LspDiagPrev"
authorAndreas Louv <andreas@louv.dk>
Mon, 3 Apr 2023 00:00:21 +0000 (02:00 +0200)
committerAndreas Louv <andreas@louv.dk>
Mon, 3 Apr 2023 00:52:13 +0000 (02:52 +0200)
This works somewhat like the count for `:h :cbefore`

autoload/lsp/diag.vim
plugin/lsp.vim

index bdf36a4223e275d123972b3a81fb6bd2ce224ac3..8e277231dec896c2f7650b71567d0950e1ee23c6 100644 (file)
@@ -517,6 +517,12 @@ export def LspDiagsJump(lspserver: dict<any>, which: string, a_count: number = 0
     return
   endif
 
+  # If [count] exceeded the previous diags
+  if which == 'prev' && a_count > 1 && a_count != count
+    JumpDiag(diags[0])
+    return
+  endif
+
   if which == 'here'
     util.WarnMsg('Error: No more diagnostics found on this line')
   else
index 8d2ea9d9bbd4a510d324312882938e09356f2f0d..12271dd470fca5374f41956004fa6c20091a8688 100644 (file)
@@ -83,7 +83,7 @@ command! -nargs=0 -bar LspDiagFirst lsp.JumpToDiag('first')
 command! -nargs=0 -bar LspDiagHighlightDisable lsp.DiagHighlightDisable()
 command! -nargs=0 -bar LspDiagHighlightEnable lsp.DiagHighlightEnable()
 command! -nargs=0 -bar -count=1 LspDiagNext lsp.JumpToDiag('next', <count>)
-command! -nargs=0 -bar LspDiagPrev lsp.JumpToDiag('prev')
+command! -nargs=0 -bar -count=1 LspDiagPrev lsp.JumpToDiag('prev', <count>)
 command! -nargs=0 -bar LspDiagShow lsp.ShowDiagnostics()
 command! -nargs=0 -bar LspDiagHere lsp.JumpToDiag('here')
 command! -nargs=0 -bar LspFold lsp.FoldDocument()