intellij-lsp
intellij-lsp copied to clipboard
Several textDocument/didChange after textDocument/rangeFormatting
Hello.
after pressing "format selection" and recieving result IDEA sends several textDocument/didChange events (instead of only one).
catched by printwriter tracer:
File logFile = new File("./lsp-trace.log");
PrintWriter printWriter = new PrintWriter(logFile, StandardCharsets.UTF_8.name());
launcher = LSPLauncher.createServerLauncher(server, in, out, false, printWriter);
/cc @NipunaRanasinghe
Okay after looking into it, it makes sense. The reformat action will generate several edits, and each one of them will trigger a DocumentEvent.
Now, I can probably gather all the DocumentEvents happening during the applyEdit, and send only one notification, but that may cause some problems with positions and such, so that will require some testing.
My lang server responds with only one textEdit, but I have several didChange events after formatting