Skip to content

[vscode extension] not work when change LightWeight mode to Standard #628

Closed

Description

@caiqichang

Describe the bug

sts4 edition: vscode extension

If i open a project on LightWeight mode at first then change to Standard, the extension does not work.

It only works if the project open on Standard mode at the beginning.

To Reproduce

Sample

Activity

  1. martinlippert commented on Apr 27, 2021

    @martinlippert
    Member

    I am not exactly sure what you mean with Lightweight vs. Standard mode? Can you elaborate on this or provide a few screenshots or anything that describes the issue in more detail? That would be great.

  2. caiqichang commented on Apr 27, 2021

    @caiqichang
    Author

    @martinlippert
    It is property of extension Language Support for Java(TM) by Red Hat ( dependency of Spring Boot Tools ).
    QQ截图20210427171434

  3. martinlippert commented on Apr 27, 2021

    @martinlippert
    Member

    Thanks for the screenshot, that helps. What exactly are the steps that you follow to reproduce the problem? Did you select the Lightweight mode in the preferences, import the project, and then switch this preference manually to Standard? Or do you trigger this in a different way?

  4. caiqichang commented on Apr 27, 2021

    @caiqichang
    Author

    @martinlippert

    • Situtation 1:
      Mode is set to Standard default, open a project, and STS work well.

    • Situtation 2:
      Mode is set to LightWeight default, open a project, change mode to Standard manually (use the button on bottom-right of vscode, see the screenshot), and STS not work.

    QQ截图20210427173741

  5. martinlippert commented on Apr 27, 2021

    @martinlippert
    Member

    @caiqichang Yepp, I can reproduce, thanks for reporting and the additional details. We will take a look.

  6. added this to the 4.11.0.RELEASE milestone on Apr 27, 2021
  7. caiqichang commented on Apr 28, 2021

    @caiqichang
    Author

    @martinlippert
    I found that other extension like Spring Boot Dashboard also has this problem, maybe it should be fixed by upstream.

  8. martinlippert commented on Apr 28, 2021

    @martinlippert
    Member

    @caiqichang The Spring Boot Dashboard extension interacts with the Spring Boot Tools in order to gather information about the apps to show, so I assume the issue with the Spring Boot Dashboard goes back to the underlying issue with the Spring Tools extension.

  9. kdvolder commented on May 7, 2021

    @kdvolder
    Member

    I'm not sure one should expect the extension to work when Java is set to lightweight. I suspect in lightweight mode we are not getting classpath information which our extension needs to do anything. I think this is probably 'by design' as the screenshot seems to say that 'Gradle / Maven' support is part of the 'full mode' and that is where classpath information comes from as well.

    We can have a deeper look at this but I suspect that there is not much that can be done here. Essentially I think that by selecting 'light weight mode' you are deliberately opting out of 'expensive' features that require classpath resolution. This includes the support you get from our editor. E.g. completions in properties and yaml editor only work because they can obtain metadata from project classpath.

  10. BoykoAlex commented on May 7, 2021

    @BoykoAlex
    Contributor

    Sounded to me like we'd like to fix the default case where Light-weight JDT LS starts first and then somehow replaced with the Standard when it is fully started. The issue is when the standard LS is fully functional we won't attempt to register classpath listener again or don't wait for standard jdt ls to start when registering classpath listener

  11. kdvolder commented on May 7, 2021

    @kdvolder
    Member

    Hmm, okay. Yes, as a user I would expect that to work, and it should be possible somehow to make that work.

    The question is though how would our extension be able to even know that the JDT server's 'mode' was changed and therefore we need to try again to connect our classpath listeners. I suppose we could just 'keep trying' repeatedly no matter what, but that might not be such a great idea for performance reasons.

  12. BoykoAlex commented on May 12, 2021

    @BoykoAlex
    Contributor

    Red Hat Java 0.79.1 seems to have it fixed by prompting the user to restart vscode for launch mode setting switch. After that restart everything works as expected.
    Please double -check this @caiqichang

  13. martinlippert commented on Jun 2, 2021

    @martinlippert
    Member

    I am re-opening this issue. To be it looks like this still doesn't work when you start VS Code with the Java support to be configured to launch in Lightweight mode. I then open a Java file and I can see in the outline view the Java content (which is correct). When I switch via the preferences to a different mode, I am prompted for a restart and everything works just fine. But if I switch to the standard mode via the little rocket icon on the status bar below the editor, I am prompted if I really want to enable the standard mode, and if I click yes, the Java support is switched to the standard mode, but the Spring Boot support isn't notified of anything, so continues to do nothing.

  14. BoykoAlex commented on Jun 3, 2021

    @BoykoAlex
    Contributor

    Fixed with 94dd78b

    Doesn't look like we can avoid adding/removing classpath listener to jdt ls at runtime.

    JDT launches two kinds of LS now: syntax and standard. We can either add classpath listener to both because syntax server is shutdown if standard started or just add a listener to the standard ls (which is done in the current solution).

    If the launch mode is hybrid syntax ls started first then once standard ls is started the launchMode property becomes Standard and then boot ls adds a classpath listener.

    (@martinlippert Hope this tiny bit of explanation makes sense, but we can obviously chat more about it ouitside of github)

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

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions