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
[improvement] Start sts4 language server without opening any java or spring related files. #568
Start sts4 language server without needing to open the java or spring related file. If the workspace has at least one project which has dependency to spring we can start the sts4 server, otherwise the server should not be started. But at soon as a project get the spring dependency the server should be started. This can be done by listening a dependency changes.
I think there is a broader discussion around this inside of the overall LSP support in Eclipse and when language servers should be started and when not. I am myself not totally sure about it.
I am worried about starting too much stuff at startup and kicking off too many initialization activities, mostly due to performance reasons.
On the other side, I also see the benefits from an early startup and a language server that is almost always running when using the IDE and having Spring projects in the workspace.
An additional question here would be: what are the benefits from starting the language server immediately at startup? I don't deny they exist, but having a good understanding of those benefits would be good, I think.
the live hover commands dropdown menu in the boot dashboard would work even without an open editor (although it doesn't make a lot of sense, since live hovers show up in editors only at the moment)
property editing in launch configs would not need to start a new language server if no LS is already running
better performance when opening the first java editor
I think you covered it @martinlippert. specially i'm trying to give a similar experience in my Idea implementation which i can thanks to new changes in lsp4intellij library support. So i thought why not have the same experience in Eclipse :).
Will the LS be stopped everytime you close all files? Every time I open the first file, STS becomes unresponsive for a short time.
When I leave one file open, performance is fine, but most of the time I edit one file after another. It's really annoying when your IDE is unresponsive hundred times a day and I think it got worse in the last versions.
Observed this unresponsiveness on Windows 10, under Linux it seems to be better.
@PatrickGotthard Your observation is correct, the underlying language server is stopped when you close all files and re-started when you open the first file. But this should be super fast and if not, I would consider this a bug.
Can you provide more details about the unresponsiveness? Would it maybe be possible to capture a thread dump exactly while the IDE is unresponsive? (using jps and jstack)
Even if the start operation for the language server is slow (it should not), the IDE should continue to be responsive and should definitely not slow down due to a slow language server.
the second piece is the question why the language server is slow to startup in your case. Can you turn on the log output from the language server process via the preferences (Preferences -> Language Servers -> Spring Language Servers, then select the Spring Boot Language Server) and try your scenario again? Would be interesting to see that the log reveals in terms of performance numbers (we have a few in there).
A quick workaround for you could be to disable the Spring Boot Language Server for the Java source file type via the Preferences -> Language Servers. This also causes some of the Spring Tools 4 features to be disabled (because they rely on the language server), but at least this would workaround the issue for the moment.
Without the Spring Boot Language Server there's also a very short delay (I think under 500ms) when opening the first file, but that's no problem. Additional files open "instantly".
Just an idea for the initial proposal: is it neccessary to stop the LS when all Spring Boot LS specific files are closed? Wouldn't it be better to leave the LS running and just stop it after "some time" (e.g. 1 minute without interaction)?
Just an idea for the initial proposal: is it neccessary to stop the LS when all Spring Boot LS specific files are closed? Wouldn't it be better to leave the LS running and just stop it after "some time" (e.g. 1 minute without interaction)?
Yeah, I like that idea. Would most likely be a change/improvement in the overall LSP integration for Eclipse. Added this to the plan for the 4.12.0 release schedule.
Added config to keep the language server around for 10 seconds before shutting it down after the last editor got closed to avoid shutting it down and restarting it again every time you close the last open editor and open a new one afterwards.
The shutdown timeout fixes only a part of what got reported here, but please open a new issue for the remaining topics if you still find them important to fix.
Activity
martinlippert commentedon Nov 8, 2020
I think there is a broader discussion around this inside of the overall LSP support in Eclipse and when language servers should be started and when not. I am myself not totally sure about it.
I am worried about starting too much stuff at startup and kicking off too many initialization activities, mostly due to performance reasons.
On the other side, I also see the benefits from an early startup and a language server that is almost always running when using the IDE and having Spring projects in the workspace.
An additional question here would be: what are the benefits from starting the language server immediately at startup? I don't deny they exist, but having a good understanding of those benefits would be good, I think.
martinlippert commentedon Nov 8, 2020
The benefits that I have in mind are:
Anything else?
gayanper commentedon Nov 8, 2020
I think you covered it @martinlippert. specially i'm trying to give a similar experience in my Idea implementation which i can thanks to new changes in lsp4intellij library support. So i thought why not have the same experience in Eclipse :).
PatrickGotthard commentedon Jul 31, 2021
Will the LS be stopped everytime you close all files? Every time I open the first file, STS becomes unresponsive for a short time.
When I leave one file open, performance is fine, but most of the time I edit one file after another. It's really annoying when your IDE is unresponsive hundred times a day and I think it got worse in the last versions.
Observed this unresponsiveness on Windows 10, under Linux it seems to be better.
martinlippert commentedon Aug 1, 2021
@PatrickGotthard Your observation is correct, the underlying language server is stopped when you close all files and re-started when you open the first file. But this should be super fast and if not, I would consider this a bug.
Can you provide more details about the unresponsiveness? Would it maybe be possible to capture a thread dump exactly while the IDE is unresponsive? (using jps and jstack)
Even if the start operation for the language server is slow (it should not), the IDE should continue to be responsive and should definitely not slow down due to a slow language server.
PatrickGotthard commentedon Aug 6, 2021
Hi Martin,
here's a dump taken while STS was unresponsive when opening a file: dump.txt.
Regards,
Patrick
martinlippert commentedon Aug 9, 2021
@PatrickGotthard Thanks a lot for the thread dump, that helps a lot. There are two things here:
one is that the language server integration seems to block the UI thread when opening a file and waits for the language server to be ready. This should not be the case, I filed a bug for that here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=575303
the second piece is the question why the language server is slow to startup in your case. Can you turn on the log output from the language server process via the preferences (
Preferences -> Language Servers -> Spring Language Servers, then select theSpring Boot Language Server) and try your scenario again? Would be interesting to see that the log reveals in terms of performance numbers (we have a few in there).A quick workaround for you could be to disable the Spring Boot Language Server for the Java source file type via the
Preferences -> Language Servers. This also causes some of the Spring Tools 4 features to be disabled (because they rely on the language server), but at least this would workaround the issue for the moment.PatrickGotthard commentedon Aug 9, 2021
Hi @martinlippert,
here's my debug log for a completely new project from Spring Boot LS: debug.txt
Regards,
Patrick
martinlippert commentedon Aug 9, 2021
Thanks @PatrickGotthard , that log output looks okay to me in general. How long would you describe the period of unresponsiveness?
PatrickGotthard commentedon Aug 9, 2021
@martinlippert approximately 2 to 3 seconds: screencast
martinlippert commentedon Aug 9, 2021
Does disabling the Spring Boot Language Server solve this?
PatrickGotthard commentedon Aug 9, 2021
Without the Spring Boot Language Server there's also a very short delay (I think under 500ms) when opening the first file, but that's no problem. Additional files open "instantly".
PatrickGotthard commentedon Aug 9, 2021
Just an idea for the initial proposal: is it neccessary to stop the LS when all Spring Boot LS specific files are closed? Wouldn't it be better to leave the LS running and just stop it after "some time" (e.g. 1 minute without interaction)?
2 remaining items
martinlippert commentedon Aug 10, 2021
Yeah, I like that idea. Would most likely be a change/improvement in the overall LSP integration for Eclipse. Added this to the plan for the 4.12.0 release schedule.
GH-568: use the LSP4E capability to keep the language server alive fo…
martinlippert commentedon May 15, 2022
Added config to keep the language server around for 10 seconds before shutting it down after the last editor got closed to avoid shutting it down and restarting it again every time you close the last open editor and open a new one afterwards.
The shutdown timeout fixes only a part of what got reported here, but please open a new issue for the remaining topics if you still find them important to fix.
PatrickGotthard commentedon Jun 18, 2022
This is so much better now, thanks @martinlippert !
martinlippert commentedon Jun 20, 2022
Great to hear that @PatrickGotthard . The kudos all go to @rubenporras for enabling this in LSP4E... :-)