fix: Project Settings UI update the absolute path#1623
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the Project Settings Classpath UI messaging and path handling so library entries use the appropriate absolute/relative path format based on project type, and ensures classpath updates send absolute library paths when required by the backend workspace command.
Changes:
- Pass
projectTypefrom the webview when requesting the “Select Jar File” dialog. - Emit absolute library paths for managed project types (Maven/Gradle/etc.), while keeping relative paths (when possible) for Unmanaged Folder projects.
- Convert relative library entries to absolute paths before invoking
java.project.updateClassPaths.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/project-settings/handlers/ClasspathRequestHandler.ts | Uses projectType to decide whether to produce relative vs absolute library paths; normalizes relative library entries to absolute before updating classpaths. |
| src/project-settings/assets/vscode/utils.ts | Extends onWillSelectLibraries request payload to include projectType. |
| src/project-settings/assets/classpath/features/components/Libraries.tsx | Sends projectType when triggering the library selection flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
chagong
approved these changes
May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix Project Settings / Configure Classpath failing when adding a workspace-local JAR to a non-unmanaged Java project.
The UI previously converted selected JARs under the project root to project-relative paths. That is valid for unmanaged folders backed by
java.project.referencedLibraries, but non-unmanaged projects apply library changes through JDT LSjava.project.updateClassPaths, whereCPE_LIBRARYentries must use absolute paths. Passing a relative path caused errors such as:Changes
java.project.updateClassPathsso relative library entries are resolved against the project root before being sent to JDT LS.Validation
npm run compilenode ../autotest/dist/cli/index.js validate ../vscode-java-pack/test-plans/java-extension-pack.yamlnode ../autotest/dist/cli/index.js run test-plans/java-extension-pack.yaml --no-llm --output test-results/java-extension-pack-finalFixes #1498
Related to microsoft/vscode-java-dependency#966