From 72448b8452674c871d3c85c61ecee2ffa9a1053d Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Sun, 18 Jun 2023 06:49:12 -0700 Subject: [PATCH] Update the check for the presence of a diags location list and update comments --- autoload/lsp/diag.vim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/autoload/lsp/diag.vim b/autoload/lsp/diag.vim index af73873..7b6f828 100644 --- a/autoload/lsp/diag.vim +++ b/autoload/lsp/diag.vim @@ -422,13 +422,14 @@ def DiagsUpdateLocList(bnr: number, calledByCmd: bool = false): bool 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 -- 2.48.1