autoload/lsp/diag.vim | 9 +++++---- diff --git a/autoload/lsp/diag.vim b/autoload/lsp/diag.vim index af738734b0e8c866610b131b0c8c7a3e0f2ed4af..7b6f8280fa49d24f3c728bc138c3a32e9bac96b9 100644 --- a/autoload/lsp/diag.vim +++ b/autoload/lsp/diag.vim @@ -422,13 +422,14 @@ return false endif var LspQfId: number = bnr->getbufvar('LspQfId', 0) - if LspQfId->empty() && !opt.lspOptions.autoPopulateDiags && !calledByCmd - # If a location list for the diagnostics was not opened previously, - # and 'autoPopulateDiags' is set to false, then do nothing. + if LspQfId == 0 && !opt.lspOptions.autoPopulateDiags && !calledByCmd + # Diags location list is not present. Create the location list only if + # the 'autoPopulateDiags' option is set or the :LspDiagShow command is + # invoked. return false endif - if !LspQfId->empty() && getloclist(0, {id: LspQfId}).id != LspQfId + if LspQfId != 0 && getloclist(0, {id: LspQfId}).id != LspQfId # Previously used location list for the diagnostics is gone LspQfId = 0 endif