-
Notifications
You must be signed in to change notification settings - Fork 787
A severe performance issue: textDocument/didOpen called multiple times #1564
Comments
Here is some trace information:
There are two problems: (i) DID_OPEN called too many times, and (ii) it's also strange that the linters were marked as I'd like to note that this bug has something to do with conditional registration. When no conditions are used, only one request will be made. The call hierarchy is:
|
This seems to be a bit tricky to fix. @jose-elias-alvarez your inputs would be appreciated. For now, users can use a workaround by monkey-patching the problematic + require('null-ls.client').retry_add = require('null-ls.client').try_add
null_ls.setup {
...
} |
When null-ls attaches for the first time, multiple linter processes were spawning unwantedly and redundantly. Use a workaround until the performance bug gets fixed. Reference: jose-elias-alvarez/null-ls.nvim#1564
From a user's perspective, As you noted, this is pretty tricky to solve. The easiest solution might be to debounce the As for the |
Thanks or your comments.
This makes sense, at least the LSP should lint the file at least when it is opened for the first time.
I agree with this, probably this can be a general solution. For instance, if you save the file frequently while the slow linter is still running, we would still have multiple linter processes running. We'd probably need to make sure each of the registered LSP source runs at most one at a time for a file (buffer). |
FAQ
Issues
Neovim Version
0.9.0 stable, and HEAD (NVIM v0.10.0-dev-4334+g4e5061dba)
Dev Version?
Operating System
macOS
Minimal Config
Steps to Reproduce
Reproducibility Check
minimal_init.lua
template and that my issue is reproducible by runningnvim --clean -u minimal_init.lua
and following the steps above.Expected Behavior
No null-ls linters should run on the first BufEnter of the python file.
Actual Behavior
One of the linter (
black
in this example, non-deterministic depending on the source condition and order) is spawned for N times. Here N is as many as the number of null-ls sources registered.In my in-the-wild config, eight instances of a linter that runs for seconds are spawned -- all the CPU cores hit 100% usage.
Debug Log
Not relevant
Help
Yes
Implementation Help
No response
Requirements
The text was updated successfully, but these errors were encountered: