autoload/lsp/lsp.vim | 8 ++++++++ plugin/lsp.vim | 5 +---- diff --git a/autoload/lsp/lsp.vim b/autoload/lsp/lsp.vim index 827b7bcd74b79c81e7a00beeb24ddd5210422e61..4cc7d32e65312ddfa93d03a903354e2aec02cb5a 100644 --- a/autoload/lsp/lsp.vim +++ b/autoload/lsp/lsp.vim @@ -262,6 +262,14 @@ || lspserver.isClangdInlayHintsProvider) inlayhints.BufferInit(bnr) endif + # Show diagnostics on the status line + if opt.lspOptions.showDiagOnStatusLine + acmds->add({bufnr: bnr, + event: 'CursorMoved', + group: 'LSPBufferAutocmds', + cmd: 'LspShowCurrentDiagInStatusLine()'}) + endif + autocmd_add(acmds) enddef diff --git a/plugin/lsp.vim b/plugin/lsp.vim index f374cfca33378a453caba3ad501811d89d5380bd..f2f4aabad39f55595e3516f23500bfd9c06acf1b 100644 --- a/plugin/lsp.vim +++ b/plugin/lsp.vim @@ -9,7 +9,7 @@ # Language Server Protocol (LSP) plugin for vim g:loaded_lsp = 1 -import autoload '../autoload/lsp/options.vim' +import '../autoload/lsp/options.vim' import autoload '../autoload/lsp/lsp.vim' @@ -70,9 +70,6 @@ autocmd BufNewFile,BufReadPost * lsp.AddFile(expand('')->str2nr()) # Note that when BufWipeOut is invoked, the current buffer may be different # from the buffer getting wiped out. autocmd BufWipeOut * lsp.RemoveFile(expand('')->str2nr()) - if options.lspOptions.showDiagOnStatusLine - autocmd CursorMoved * lsp.LspShowCurrentDiagInStatusLine() - endif augroup END # TODO: Is it needed to shutdown all the LSP servers when exiting Vim?