Fix Java LSP completion for git-backed projects (follow symlinks) - #6038
Merged
Conversation
git-backed workspace projects are symlinks into the repository's .git store (e.g. users/<u>/workspace/<project> -> repository/.git/.../<project>). JdtLsManager.containsJavaFile() walked the project dir with Files.walk(dir, 5) WITHOUT FileVisitOption.FOLLOW_LINKS, so when the project directory is a symlink, Files.walk treats it as a non-traversable file, finds zero .java, and the project is filtered out of ensureEclipseProjectFilesForWorkspace(). Consequence: .project/.classpath are never generated for such projects, so JDT.LS falls back to a JRE-only default project - java.util.* completes but org.eclipse.dirigible.sdk.* and the project's own types do not. Fix: pass FileVisitOption.FOLLOW_LINKS to Files.walk so the symlinked project is traversed. Verified on the sample-intent-model workspace project (a git clone): 0 .java found before, 17 after. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
In the Monaco editor, Java code completion resolves only standard JRE packages (
java.util.*, etc.) but notorg.eclipse.dirigible.sdk.*nor the project's own Java types. Root cause: the JDT.LS.project/.classpathdescriptors are never generated for the project, so JDT.LS falls back to a JRE-only default project.Root cause
git-backed workspace projects are symlinks into the repository's
.gitstore, e.g.:JdtLsManager.containsJavaFile()walked the project directory withFiles.walk(dir, 5)withoutFileVisitOption.FOLLOW_LINKS. When the start path is a symlink,Files.walktreats it as a non-traversable file, descends into nothing, and finds zero.java. The project is therefore filtered out ofensureEclipseProjectFilesForWorkspace(), the descriptors are never written, and JDT.LS gives JRE-only completion.This affects every git-cloned / git-backed Java project (the common case — e.g. the
dirigiblelabs/sample-intent-modelclone used byIntentEditorLoadsIT). It is unrelated to the recent Monaco upgrade (#6025), which only touched the in-browser TS/JS/HTML language services.Fix
Pass
FileVisitOption.FOLLOW_LINKStoFiles.walkincontainsJavaFile()so the symlinked project directory is traversed.Verification
mvn -o -pl components/ide/ide-java-lsp compile.sample-intent-modelworkspace project (a git clone), the directory walk finds 0.javafiles before the change and 17 after — so the project is now recognized and its.project/.classpathare generated.Follow-up (not in this PR)
Worth validating that JDT.LS resolves the symlinked project cleanly on import; if Eclipse balks at the symlink, a further step would be to generate/import descriptors against the resolved real path.
🤖 Generated with Claude Code