intellij-lsp icon indicating copy to clipboard operation
intellij-lsp copied to clipboard

Several textDocument/didChange after textDocument/rangeFormatting

Open nixel2007 opened this issue 6 years ago • 2 comments

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

nixel2007 avatar Feb 19 '19 17:02 nixel2007

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.

gtache avatar Mar 01 '19 15:03 gtache

My lang server responds with only one textEdit, but I have several didChange events after formatting

nixel2007 avatar Mar 01 '19 16:03 nixel2007