Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better collaboration with vscode-java #953

Open
CsCherrYY opened this issue Aug 26, 2021 · 5 comments
Open

Better collaboration with vscode-java #953

CsCherrYY opened this issue Aug 26, 2021 · 5 comments
Labels
enhancement New feature or request question Further information is requested
Milestone

Comments

@CsCherrYY
Copy link
Collaborator

Currently vscode-gradle starts a different daemon from vscode-java, we can find a way to reuse it, such as send our requests to language server, etc.

@CsCherrYY CsCherrYY added the enhancement New feature or request label Aug 26, 2021
@CsCherrYY CsCherrYY added this to the backlog milestone Aug 26, 2021
@badsyntax
Copy link
Collaborator

When I last looked at this I couldn't understand it, as buildship and this extension are both using the Gradle Tooling API, so it should be using the same daemon. It's definitely a good idea to reach out to vscode-java to try understand why different daemons are spawned.

@CsCherrYY
Copy link
Collaborator Author

CsCherrYY commented Dec 27, 2021

I have done some investigation, and here are some thoughts and findings:

The target of this work is to reduce the daemon number of VS Code users. Now vscode-java will launch a daemon via buildship, and vscode-gradle will launch a daemon via TAPI directly, it will bring a waste of memory and resource.

eclipse.jdt.ls (language server of vscode-java) uses buildship to import and manage Gradle projects, there is a long running instance GradleCore, where we can use GradleCore.getWorkspace().getBuild(IProject) to get the GradleBuild after importing (called synchronizing in buildship) process is finished.

GradleBuild provides some ways to help us to contact with tooling API, includes

  • Getting project configuration (the way we now get tasks information)
  • Adding an init-script (the way we now get dependency, extension and classpath information), and so on.

IMO it's doable for us to make our server an extension of eclipse.jdt.ls, get it's running GradleCore of buildship and our extension will only get the GradleBuild via that instance. As mentioned above, that instance can do everything we need about the TAPI.

Some concerns:

  • Depending on buildship might delay the time our features become available. Currently our extension only requires finishing configuration we can get the enough information, but after applying buildship's instance, we might wait for the synchronizing process.
  • It might add difficulty to our work on merging the current two servers, see merge gradle-server and gradle-language-server into one #1123. The gradle-language-server should work regardless of the status of project importing, although some features depend the information of TAPI model.

@CsCherrYY
Copy link
Collaborator Author

Another observation is that there are some unhealthy GradleConnector/ProjectConnection reuse mechanism in vscode-gradle, it will create a new daemon every time getProjects() is called.

@CsCherrYY CsCherrYY pinned this issue Dec 27, 2021
@mozhuanzuojing
Copy link

Taken together, there is no need to change. Because when we obtain information, we need lightweight, fast and real-time services.

@CsCherrYY
Copy link
Collaborator Author

@mozhuanzuojing FYI, we are working on #1088, which will simplify the daemon numbers of the extension. After this change merged, the extension will use only a single daemon all the time, on the other hand, java extension will have its own daemon. This is the first step we work on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants