-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(LspconfigServerLifeCycle): stop/start server upon demand #2609
Conversation
This seems like a very drastic solution. Also, say I work on project (workspace) and open file A to quickly edit something and then move on to file B. Now after 5 minutes the server would be stopped in middle of editing B? And what's worse is that it wouldn't start again until I move back to A (or some new file C) or start it manually. I often work in projects where it can easily take 30s before the language server is ready. And having that happen because I stopped to edit the same buffer for 5 min would be frustrating. I think a 30-60 min timeout would be more reasonable. And it would be have to be tracked per language server instance. Or maybe I'm misunderstanding how it works? |
1- What do other editors do (vscode in particular) ? In my opinion this should not be a default behavior |
@lithammer This won't stop servers local to some specific language or buffer if you switch between them. I've tweaked to stop server only if |
Ah, it was |
@lithammer Fixed it. My mistake. If we hook into buffers lifecycle it will constantly create/destroy timer. This may create problems if someone switches between buffers often. |
…sing focus Start/stop servers when nvim session looses focus and restart them on demand. This features is motivated by the fact that some servers may gain serious memory footprint and may incur performance issues.
Still, 5 min will go by fast. Just writing this comment would cause a language server to be stopped. |
@lithammer It won't stop servers if you don't move away from nvim window. But if you switch to some another window it will (e.g. browser). Should I set timeout to 30 minutes? I think we need a sane |
That definitely should not be default behaviour. Ever. No matter the timeout. Some people might be reading docs while coding. ;) |
6ab1cce
to
6520eb9
Compare
@gegoune Checkout. The feature is now disabled by default and can only be enabled by setting a global Default timeout is now set to 30 minutes. Compare two commits. |
…isable by default
A shutdown restart caused some language server cache calculations to be lost. What performance problem? Is this something the client should deal with. Obviously not. This is an implementation issue of the server. nothing to do on there. |
@glepnir Some servers may easily take up gigabytes of memory. Keeping cache in memory is problem of servers, not LSP clients. They should not rely on RAM in this sense. I have several editors opened at the same time and can tell you they take up 150MB on average at least. |
what i mean client is |
Cache is a not problem. Optimized servers keep theer cache on HDD instead of memory to make it shareable. This PR is intended for optimization as it requires lspconfig commands. |
Please, follow this repo for progress on standalone plugin: |
Start/stop servers when nvim session looses focus and restart them on demand.
This features is motivated by the fact that some servers may gain serious
memory footprint and may incur performance issues.
UPDATE: Implementd by a separate plugin: hinell/lsp-timeout.nvim