You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Keep Language Server running for the workbench lifetime #880
The language server provides reconciling for non-opened source files (Java, YAML, Properties and others) within the workspace.
Problem markers show up in the Problems view. The Language Server is good to be started at the Eclipse start up and stopped at the Eclipse shut down for the purpose of showing problem markers in the Problems view.
It is unclear how LSP4E can support such Language Server. The language server can be started via startup eclipse extension point then it'd have to be initialized somehow (this is unclear at the moment). Termination of the Language Server process could possibly be prevented by providing a very large timeout number but feels like a hack.
I think we can/should discuss what we would like to gain here from the Spring language server perspective. I have two things in mind:
when to startup the language server?
when to shutdown the language server?
I don't know exactly what options we have for controlling this across the different clients that we support (Eclipse, VSCode), but we should have an idea about what we would like to achieve.
For the startup question:
Do we really want to startup the language server always and in any case when the client itself is started? Or should we pin this to certain conditions, like there is a Spring Boot project in the workspace at least?
I think the Java language server in VSCode checks for certain files like pom.xml or build.gradle and as soon as those files exist in the workspace, the language server gets started. Should we maybe try something like this as well? Or should we try to be more specific, so that we can detect Spring Boot projects somehow and then start the language server?
I am hesitant to start the language server by default when the client/IDE comes up. I would be quite annoyed if this process gets started every time I start my VSCode.
At the same time, it might make sense to align the behavior among VSCode and Eclipse here, so that we get a similar behavior across the clients.
Hmm... yes, following VSCode steps in this the case of Eclipse would be best indeed. Currently, I've just tried starting LS at the eclipse startup. However, checking the workspace for Boot projects sounds better. It is just that if we are checking the workspace for Boot projects we would have to check it for Boot projects constantly by watching classpath changes in the workspace. This also brings up the question: Do we shut Boot LS down once all boot projects are gone?
VSCode looks at Java projects (pom and gradle build, kts files) for starting LS but didn't see anything special for shutting it down.
(I closed it because was meant to open it under lsp4e but looks like indeed it is well worth to discuss it from our side)
@martinlippert check out #889 with LSP4E from eclipse-lsp4e/lsp4e#289
Boot LS shouls start if a project in the workspace has Spring on classpath. Boot LS stops if none of the projects have spring on the classpath.
The following issue needs an answer. If none of the projects has spring on the classpath, open a Java file in the editor and Boot LS starts up. Fine. Close the file and Boot LS would shut down provided timeout is reasonable small.
Now, suppose you have spring boot projects in the workspace and Boot LS is started. Open a java file - all is still good. Now close all java files. Boot LS is going to be shut down regardless of Spring projects in the workspace (LSP4E works) unless the timeout is infinity. Not sure what to do with this yet...
@martinlippert perhaps it is fine to leave the Boot LS up once it is up for the lifetime of the workbench? What do you think? (Taking into account comment above)
The Boot LS is started/stopped for boot projects present in the workspace for both Eclipse and VSCode. There is currently one exception in the case of Eclipse. If a Java source or Boot properties or YAML file is opened the LS would be started as well regardless whether boot is on the classpath. The LS won't go down in this case unfortunately. We'd need to prevent Boot LS from starting for resources not from Boot projects. See: eclipse-lsp4e/lsp4e#310
Otherwise mostly fixed with: df0d85c
Can we extract the additional work into a separate issue (since most of this is ready implemented for the 4.17.0 release and out the door already. I am already closing this one here. Please open another one for the remaining work.
Activity
martinlippert commentedon Nov 10, 2022
I think we can/should discuss what we would like to gain here from the Spring language server perspective. I have two things in mind:
I don't know exactly what options we have for controlling this across the different clients that we support (Eclipse, VSCode), but we should have an idea about what we would like to achieve.
For the startup question:
Do we really want to startup the language server always and in any case when the client itself is started? Or should we pin this to certain conditions, like there is a Spring Boot project in the workspace at least?
I think the Java language server in VSCode checks for certain files like
pom.xmlorbuild.gradleand as soon as those files exist in the workspace, the language server gets started. Should we maybe try something like this as well? Or should we try to be more specific, so that we can detect Spring Boot projects somehow and then start the language server?I am hesitant to start the language server by default when the client/IDE comes up. I would be quite annoyed if this process gets started every time I start my VSCode.
At the same time, it might make sense to align the behavior among VSCode and Eclipse here, so that we get a similar behavior across the clients.
Thoughts?
BoykoAlex commentedon Nov 10, 2022
Hmm... yes, following VSCode steps in this the case of Eclipse would be best indeed. Currently, I've just tried starting LS at the eclipse startup. However, checking the workspace for Boot projects sounds better. It is just that if we are checking the workspace for Boot projects we would have to check it for Boot projects constantly by watching classpath changes in the workspace. This also brings up the question: Do we shut Boot LS down once all boot projects are gone?
VSCode looks at Java projects (pom and gradle build, kts files) for starting LS but didn't see anything special for shutting it down.
(I closed it because was meant to open it under lsp4e but looks like indeed it is well worth to discuss it from our side)
BoykoAlex commentedon Nov 10, 2022
@martinlippert check out #889 with LSP4E from eclipse-lsp4e/lsp4e#289
Boot LS shouls start if a project in the workspace has Spring on classpath. Boot LS stops if none of the projects have spring on the classpath.
The following issue needs an answer. If none of the projects has spring on the classpath, open a Java file in the editor and Boot LS starts up. Fine. Close the file and Boot LS would shut down provided timeout is reasonable small.
Now, suppose you have spring boot projects in the workspace and Boot LS is started. Open a java file - all is still good. Now close all java files. Boot LS is going to be shut down regardless of Spring projects in the workspace (LSP4E works) unless the timeout is infinity. Not sure what to do with this yet...
BoykoAlex commentedon Nov 14, 2022
@martinlippert perhaps it is fine to leave the Boot LS up once it is up for the lifetime of the workbench? What do you think? (Taking into account comment above)
BoykoAlex commentedon Nov 22, 2022
The Boot LS is started/stopped for boot projects present in the workspace for both Eclipse and VSCode. There is currently one exception in the case of Eclipse. If a Java source or Boot properties or YAML file is opened the LS would be started as well regardless whether boot is on the classpath. The LS won't go down in this case unfortunately. We'd need to prevent Boot LS from starting for resources not from Boot projects. See: eclipse-lsp4e/lsp4e#310
Otherwise mostly fixed with: df0d85c
martinlippert commentedon Dec 9, 2022
Can we extract the additional work into a separate issue (since most of this is ready implemented for the 4.17.0 release and out the door already. I am already closing this one here. Please open another one for the remaining work.