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

Support add/remove imported projects #3398

Merged
merged 2 commits into from
Nov 29, 2023

Conversation

jdneo
Copy link
Collaborator

@jdneo jdneo commented Nov 22, 2023

  • Reuse the 'BuildFilesSelector' and enable change the imported projects after the activation finishes.

requires eclipse-jdtls/eclipse.jdt.ls#2972

@jdneo
Copy link
Collaborator Author

jdneo commented Nov 22, 2023

Some follow-ups per the online meeting:

  1. Benchmark the perf of the file searching when it comes to a big project containing many many modules.
  2. Test the behavior with Eclipse projects.

I'll share the result after finishing those tests.

@jdneo
Copy link
Collaborator Author

jdneo commented Nov 23, 2023

Benchmark the perf of the file searching when it comes to a big project containing many many modules.

I cloned this repo: https://github.com/Azure/azure-sdk-for-java, which has 690 pom.xml files. The time takes to find all pom files on my machine is 224 ms, it's a windows with Intel i7-10700.

Test the behavior with Eclipse projects.

Ok, it turns out the answer is simple. Picking Eclipse project is not supported now, because currently we only registered Maven and Gradle. (See:

vscode-java/package.json

Lines 75 to 84 in 86bf3ae

"javaBuildTools": [
{
"displayName": "Maven",
"buildFileNames": ["pom.xml"]
},
{
"displayName": "Gradle",
"buildFileNames": ["build.gradle", "settings.gradle", "build.gradle.kts", "settings.gradle.kts"]
}
],
)

It should be fine to add Eclipse(.project) if we find it's necessary or asked by users.

@testforstephen
Copy link
Collaborator

testforstephen commented Nov 28, 2023

I have a play on the user experience, here are the problems I have:

  1. The project picker should mark the imported projects differently, otherwise you will get lost when you click the picker item a few times.
  2. Java projects view is not refreshed automatically when new projects are imported.
  3. When I try to remove all imported projects, nothing happens.
  4. Check the parent pom.xml, it will actually import all sub modules on server side. When you go back the client project picker, the imported project list is not consistent with the server.
    image

- Reuse the 'BuildFilesSelector' and enable change the imported
  projects after the activation finishes.

Signed-off-by: Sheng Chen <sheche@microsoft.com>
@jdneo
Copy link
Collaborator Author

jdneo commented Nov 29, 2023

@testforstephen Updated.

Now there is one case that cannot be handled.

If a parent pom has been imported, and some submodules are not. Selecting the submodule will not import them. Looks like its due to the implementation of maven importer: https://github.com/eclipse-jdtls/eclipse.jdt.ls/blob/9de85d52b9a8b3d51ec60112646e043ff222533d/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/MavenProjectImporter.java#L177

Here it will find the project for the parent pom, thus, the submodule's pom will not be added to the toImport set.


Meanwhile, a new event is added for project deletion. microsoft/vscode-java-dependency#802 consumes that to make sure the explorer gets refreshed on project deletion.

@testforstephen
Copy link
Collaborator

The workflow works better now. Just some issues with the state management.

  1. Change the setting to manual import mode, and then open a multimodule workspace (e.g. https://github.com/spring-guides/gs-multi-module/tree/main/initial). Follow the action to select one project application to import. Then use the command "Java: Import Java Projects into Workspace" to remove all imported projects. Check the Projects view and verified that no projects are present. Reload the window and you will see the deleted projects are present in Projects view. It looks like the deleted projects are imported automatically after reload.

  2. Open a multimodule workspace (e.g. https://github.com/spring-guides/gs-multi-module/tree/main/initial) and import all projects first. Then run the command "Java: Import Java Projects into Workspace" to remove all imports project. Here is what it displays in Java Projects view. Do we change the hint to "Import Projects..."?
    image

  3. Open a multimodule workspace and import all projects first. Then run the command "Java: Import Java Projects into Workspace" to remove all imported projects. After that, run the command again and select one project to import. When the import is finished and go to Java Projects view, you will find that the Refresh context menu is lost.
    image

Signed-off-by: Sheng Chen <sheche@microsoft.com>
@jdneo
Copy link
Collaborator Author

jdneo commented Nov 29, 2023

1

Should be fixed in the latest commit

2

I expect to thoroughly improve it in project manager extension later. Current state management looks a little bit fragmented which is not easy to tune.

3

Should be fixed in the appended commit in microsoft/vscode-java-dependency#802

Copy link
Collaborator

@testforstephen testforstephen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me now.

@jdneo jdneo added this to the End November 2023 milestone Nov 29, 2023
@jdneo jdneo merged commit aea6d6f into redhat-developer:master Nov 29, 2023
2 checks passed
@jdneo jdneo deleted the cs/project-picker-afterwards branch November 29, 2023 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants