fix(amazonq): adding openTabFilepaths to inline completion requests#538
Open
laileni-aws wants to merge 2 commits intoaws:mainfrom
Open
fix(amazonq): adding openTabFilepaths to inline completion requests#538laileni-aws wants to merge 2 commits intoaws:mainfrom
laileni-aws wants to merge 2 commits intoaws:mainfrom
Conversation
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:
Eclipse plugin was not sending openTabFilepaths in inline completion requests to the language server. The LS protocol defines this optional field (OpenTabParams.openTabFilepaths?: string[]) and the LS already consumes it in getCrossFileCandidates() to build supplemental context from open editor tabs — but Eclipse never populated it. VSCode has been sending this field (via getOpenFilesInWindow()), giving it a richer cross-file context pool for code suggestions. Without it, Eclipse's inline completions relied only on files the LS knew about via didOpen/didClose notifications and the local project context index, resulting in poorer suggestion quality for proprietary APIs where the model needs to see class definitions from other open files.
Solution:
Three source changes in the Eclipse plugin (no LS changes needed):
InlineCompletionParams.java— AddedopenTabFilepathsfield (List<String>) matching the LS protocol's OpenTabParams interface.QEclipseEditorUtils.java— AddedgetOpenEditorFilePaths()that iteratesIWorkbenchPage.getEditorReferences(), extracts OS file paths from each editor input, and skips in-memory editors. Returns raw file paths (not URIs), which is what the LS expects ingetCrossFileCandidates()viaURI.file(openTabFile).InlineCompletionUtils.java— UpdatedcwParamsFromContext()to callgetOpenEditorFilePaths()and set the result on params when non-empty.Two test files added:
InlineCompletionUtilsTest.javaandQEclipseEditorUtilsGetOpenEditorFilePathsTest.javacovering the happy path, empty list, in-memory editor skipping, unresolvable editors, and null active page scenarios.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.