redhat-developer / lsp4ij

LSP Client for IntelliJ
Eclipse Public License 2.0
108 stars 23 forks source link

Keep language servers alive when all files are closed #489

Closed harry-xm closed 1 month ago

harry-xm commented 2 months ago

In a large project, it might take quite some time for rust-analyzer to initialize itself.

If someone clicked "Close All Tabs" and subsequently opens another file, the language server is restarted and I have to wait until it finishes loading.

I'm thinking of keeping the language server running until the IDE window is closed, or after an inactivity timeout. IMHO, either the user should be given an option, or plugin authors should be able to control it via some API.

Originally posted in https://github.com/redhat-developer/lsp4ij/discussions/487

turkeylurkey commented 2 months ago

When you define your server <server id="XXXlsp" you can add the parameter lastDocumentDisconnectedTimeout="3600" which is an inactivity timeout.

angelozerr commented 2 months ago

@harry-xm as @turkeylurkey suggested, you can define lastDocumentDisconnectedTimeout="3600" for the moment.

harry-xm commented 2 months ago

Thanks. I guess if I set it to a year, that is effectively keeping servers alive.

angelozerr commented 1 month ago

Duplicate of https://github.com/redhat-developer/lsp4ij/issues/556

which will be covered in 0.7.0 with https://github.com/redhat-developer/lsp4ij/pull/543

Please read https://github.com/redhat-developer/lsp4ij/issues/556#issuecomment-2388699488 and give me your feedback about the name of the method.