Skip to content

[improvement] Start sts4 language server without opening any java or spring related files.  #568

Closed

Description

@gayanper

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.

Activity

  1. martinlippert commented on Nov 8, 2020

    @martinlippert
    Member

    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.

  2. martinlippert commented on Nov 8, 2020

    @martinlippert
    Member

    The benefits that I have in mind are:

    • symbol views would be populated immediately
    • 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

    Anything else?

  3. gayanper commented on Nov 8, 2020

    @gayanper
    ContributorAuthor

    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 :).

  4. PatrickGotthard commented on Jul 31, 2021

    @PatrickGotthard

    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.

  5. martinlippert commented on Aug 1, 2021

    @martinlippert
    Member

    @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.

  6. PatrickGotthard commented on Aug 6, 2021

    @PatrickGotthard

    Hi Martin,

    here's a dump taken while STS was unresponsive when opening a file: dump.txt.

    Regards,
    Patrick

  7. martinlippert commented on Aug 9, 2021

    @martinlippert
    Member

    @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 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.

  8. PatrickGotthard commented on Aug 9, 2021

    @PatrickGotthard

    Hi @martinlippert,

    here's my debug log for a completely new project from Spring Boot LS: debug.txt

    Regards,
    Patrick

  9. martinlippert commented on Aug 9, 2021

    @martinlippert
    Member

    Thanks @PatrickGotthard , that log output looks okay to me in general. How long would you describe the period of unresponsiveness?

  10. PatrickGotthard commented on Aug 9, 2021

    @PatrickGotthard

    @martinlippert approximately 2 to 3 seconds: screencast

  11. martinlippert commented on Aug 9, 2021

    @martinlippert
    Member

    Does disabling the Spring Boot Language Server solve this?

  12. PatrickGotthard commented on Aug 9, 2021

    @PatrickGotthard

    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".

  13. PatrickGotthard commented on Aug 9, 2021

    @PatrickGotthard

    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)?

  14. 2 remaining items

  15. added this to the 4.12.0.RELEASE milestone on Aug 10, 2021
  16. martinlippert commented on Aug 10, 2021

    @martinlippert
    Member

    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.

  17. removed this from the 4.14.0.RELEASE milestone on Mar 22, 2022
  18. added a commit that references this issue on May 15, 2022
  19. added this to the 4.15.0.RELEASE milestone on May 15, 2022
  20. martinlippert commented on May 15, 2022

    @martinlippert
    Member

    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.

  21. PatrickGotthard commented on Jun 18, 2022

    @PatrickGotthard

    This is so much better now, thanks @martinlippert !

  22. martinlippert commented on Jun 20, 2022

    @martinlippert
    Member

    Great to hear that @PatrickGotthard . The kudos all go to @rubenporras for enabling this in LSP4E... :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

for: eclipsestatus: needs-investigationtype: enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions