Given is a large file (~5000 lines). When performing a formatting with many formatted lines (e.g. by changing the indent with) via LSP, the folding and semantic highlighting reconciler are triggered for every queued change event in the document. Since both reconcilers perform on the whole document they should be performed only once, when the document has been modfied and not for each quewed document change.
A formatting with many formatted lines result in many queued change events:
which results in many (thousands!) consecutive formatting and semantic highlighting reconciler runs:
I[09:48:21.774] <-- textDocument/semanticTokens/full("483")
I[09:48:21.779] --> reply:textDocument/semanticTokens/full("483") 4 ms
I[09:48:21.835] <-- textDocument/foldingRange("484")
I[09:48:21.917] --> reply:textDocument/foldingRange("484") 81 ms
I[09:48:22.340] <-- textDocument/semanticTokens/full("485")
...
When logging to lsp4e console an out of memory occurs.
Step to reproduce:
Open a large file in LSP backed editor
Modify the formatting settings in way that many lines will be changed (e.g. change the IndentWidth in .clang-format file when using clangd as LS)
Select all (Ctrl+a)
Select in editor context menu -> Source -> Format
Wait for the reconciler to be triggered (its not triggered immediately, it can take up to a few seconds, or scrolling around in the source document my trigger it as well)
Given is a large file (~5000 lines). When performing a formatting with many formatted lines (e.g. by changing the indent with) via LSP, the folding and semantic highlighting reconciler are triggered for every queued change event in the document. Since both reconcilers perform on the whole document they should be performed only once, when the document has been modfied and not for each quewed document change.
A formatting with many formatted lines result in many queued change events:
which results in many (thousands!) consecutive formatting and semantic highlighting reconciler runs:
When logging to lsp4e console an out of memory occurs.
Step to reproduce:
IndentWidth
in.clang-format
file when usingclangd
as LS)