aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorJoão Távora2026-01-05 17:41:01 +0000
committerJoão Távora2026-01-05 17:41:16 +0000
commitd55a455ec282aef56ee083b5197ea8f769735808 (patch)
tree7a7f29b4a2b2a077d526958cea768d7f194832f9 /java
parent3ffbc5a70943970c2be807a81c9cdaf0af251117 (diff)
downloademacs-d55a455ec282aef56ee083b5197ea8f769735808.tar.gz
emacs-d55a455ec282aef56ee083b5197ea8f769735808.zip
Eglot: prevent textDocument/diagnostic from being sent before didOpen
Set eglot--docver to -1 in LSP documents not yet 'didOpen'ed, then add a check for this in the jsonrpc-connection-ready-p predicate. We do this because the call to eglot-flymake-backend may come in so fast that textDocument/diagnostic actually makes it into the jsonrpc queue before the didOpen. Much like, say, completions before didChange, some servers don't like that, understandibly. So use the existing "deferred" mechanism checks to make sure, as usual, that requests targetting a specific LSP document come after the didOpen/didChange informing the server of the actual state of the buffer. I _could_ have used nil instead of -1, and it would probably be cleaner. But -1 is safer, we never know if a version comparison won't slip outside the didOpen period. Might change my mind about this. * lisp/progmodes/eglot.el (eglot--docver): Init to -1. (eglot--managed-mode): Set eglot--docver to -1 when unmanaging. (jsonrpc-connection-ready-p): Check eglot--docver non-negative. (eglot--signal-textDocument/didClose): Set eglot--docver to -1.
Diffstat (limited to 'java')
0 files changed, 0 insertions, 0 deletions