From: Andreas Louv Date: Mon, 3 Apr 2023 00:00:21 +0000 (+0200) Subject: Make it possible to provide a "[count]" for ":LspDiagPrev" X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=452d7924abba12af9eb9b41491c6cb6684052dbe;p=vim-lsp.git Make it possible to provide a "[count]" for ":LspDiagPrev" This works somewhat like the count for `:h :cbefore` --- diff --git a/autoload/lsp/diag.vim b/autoload/lsp/diag.vim index bdf36a4..8e27723 100644 --- a/autoload/lsp/diag.vim +++ b/autoload/lsp/diag.vim @@ -517,6 +517,12 @@ export def LspDiagsJump(lspserver: dict, 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 diff --git a/plugin/lsp.vim b/plugin/lsp.vim index 8d2ea9d..12271dd 100644 --- a/plugin/lsp.vim +++ b/plugin/lsp.vim @@ -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', ) -command! -nargs=0 -bar LspDiagPrev lsp.JumpToDiag('prev') +command! -nargs=0 -bar -count=1 LspDiagPrev lsp.JumpToDiag('prev', ) command! -nargs=0 -bar LspDiagShow lsp.ShowDiagnostics() command! -nargs=0 -bar LspDiagHere lsp.JumpToDiag('here') command! -nargs=0 -bar LspFold lsp.FoldDocument()