Open dsedivec opened 3 years ago
I also face this issue. The doc allows limiting the number of files being watched, but it doesn't prevent the initial delay of "Do you want to watch all these huge number of files?". Apart from the very issue, in my use case, making LSP predict the project root properly would solve it completely. I'm using Pyright for Python and Eclipse LSP for Java. Both of them never find the root properly. And if I disable file-watchers at all, then I don't get completions from those files. Thanks for Emacs LSP! :smile_cat:
FWIW I have a related story (though different from OP). I had added by mistake /home/USER/tmp
to the list of LSP workspace folders (don't ask me how...). Now everytime I created a project in /home/USER/tmp/prj-name
the LSP server wants to index the whole parent folder and emacs grinds to a halt.
As suggested here, I've solved by removing the offending /home/USER/tmp
directory with M-x lsp-workspace-folders-remove
.
(btw Rust projects in my case but the solution should apply to LSP in general)
TL;DR: Every time it starts, lsp-mode asks me whether I would like to watch all files in one of my projects with more than
lsp-file-watch-threshold
files. I never want to do that, because saying "yes" makes Emacs unusable, so I am requesting a new lsp-mode setting to stop being asked and automatically assume "no" every time Emacs is asked to watch a big project.Background:
Whenever I open a Python file in a project where I'm using LSP, lsp-mode/lsp-pyright starts up the Pyright LSP server, which apparently loads up all of my workspaces, not just the one I'm in. This seems a bit weird to me, but I just assume "that's how LSP works" and roll with it.
One of the workspaces it loads has a lot of files, and I guess Pyright is asking Emacs and lsp-mode to "watch" all of the files in the workspace. lsp-mode kindly asks me whether I want to watch all these files, because the number of files is far greater than
lsp-file-watch-threshold
.I said "y"es once to the prompt to watch those files. Emacs ground to a halt. I now know never to say "yes" to this prompt.
However, now anytime I open the first Python file with lsp-mode active, even in an unrelated project, or if I
lsp-restart-workspace
for any reason in any project, I have to remember to wait a few seconds for the "do you want to watch this crazy number of files?" prompt to come up for the one big project so I can press "n". If I forget that I'm going to get prompted, I start typing and may accidentally hit "y" when the prompt comes up, which takes several seconds after M-xlsp-restart-workspace
RET has apparently returned.I would very much appreciate if lsp-mode could add a setting such that I can say, "continue to watch all files in workspaces with fewer than
lsp-file-watch-threshold
files [which is what I assume is currently happening when I am not prompted about a workspace], but never watch workspaces bigger than that—always automatically answer 'n' to the prompt when a workspace is bigger thanlsp-file-watch-threshold
".Thank you to the team making lsp-mode a reality in Emacs! I love this package.