Fix infinite loop when quickfix window is open.
Here is how things happened.
quickfix updated => BufReadPost => didOpen => notify server => server
respond with diagnostics => update quickfix.
Close
@@ -345,12 +345,19 @@ class LanguageClient:
@neovim.autocmd("BufReadPost", pattern="*")
def handleBufReadPost(self):
- languageId, = self.getArgs(["languageId"])
+ logger.info("Begin handleBufReadPost")
+
+ languageId, uri = self.getArgs(["languageId", "uri"])
+ if uri in self.textDocuments:
+ return
+
if self.alive(languageId, warn=False):
self.textDocument_didOpen()
elif self.autoStart:
self.start(warn=False)
+ logger.info("End handleBufReadPost")
+
@neovim.autocmd("VimEnter", pattern="*")
def handleVimEnter(self):
# Fix the issue that BufReadPost is not trigged using `nvim myfile`.
@@ -366,7 +373,7 @@ class LanguageClient:
" buffer={}").format(bufnumber)
self.asyncCommand(cmd)
- logger.info("textDocument/didOpen")
+ logger.info("Begin textDocument/didOpen")
text = self.currentBufferText()
@@ -382,6 +389,8 @@ class LanguageClient:
}
})
+ logger.info("End textDocument/didOpen")
+
@neovim.function("LanguageClient_textDocument_didClose")
@args(warn=False)
def textDocument_didClose(self, uri: str, languageId: str) -> None:
