Big file is freeze the micro for a while
Description of the problem or steps to reproduce
It seems like the micro editor performance issue: "re-analyze" (re apply the color scheme or something else what it does) whole file on every char input.
It freezes for a while and then hangs again on every char input, the htop shows big CPU consumption in that time (see attached screenshots) :(
Steps to reproduce:
- Open a big file. e.g. 26k+ lines of php code
- Try to add something - the micro will be freezed on every char entered
Specifications
Micro Commit hash: 68d88b57 (Version: 2.0.13) OS: Manjaro Linux 23.1.4 (Arch Linux) Terminal: kitty Lsp version: 0.6.2
Editing:
First opening:
This is likely because of the onRune handler that sends the entire file to the language server on every change.
It would be a good idea to use the (undocumented) onBeforeTextEvent(buf, textevent) handler instead. Having access to the textevent makes it feasible to use the more complicated form of textDocumentContentChangeEvent which lets you specify the edited range and the new content of that range.