redhat-developer / lsp4ij

LSP Client for IntelliJ
Eclipse Public License 2.0
86 stars 17 forks source link

Start language server and process LSP features when project is loaded. #498

Open angelozerr opened 2 weeks ago

angelozerr commented 2 weeks ago

Managing correctly lsp features when IJ is opening is a real nightmare because IJ indexes a lot of thing but it call too some feature when editor is opened like validation, codelens document link, etc.

With IJ Quarkus it is harder because codelens, validation etc requires to visit java classes to collect data model like properties for application.properties, java data model for qute etc which must be done sometimes when project is indexing.

It explains why we can have this kind of errors, loosing sometimes some codelens.

We do that to avoid freezing IJ when the IDE is opening.

I think more and more that we should not start language server when IJ is starting, collect all lsp features that must be called for all opened editor like codelens and when IJ is started and indexation is done, we refresh all opened editors.

It is not a trivial issue but I think it should avoid having those kind errors and prevent from little freeze.

This strategy should be used only for IJ Quarkus which have ls which communicate with IJ to visit Java classes but not for other ls.

It is an another sample of LSP API

See https://github.com/redhat-developer/intellij-quarkus/issues/1373#issuecomment-2315159712

harry-xm commented 2 weeks ago

I think more and more that we should not start language server when IJ is starting, collect all lsp features that must be called for all opened editor like codelens and when IJ is started and indexation is done, we refresh all opened editors.

This sounds like waiting until the IDE is in smart mode. https://plugins.jetbrains.com/docs/intellij/indexing-and-psi-stubs.html#dumb-mode