Skip to content

fix(amazonq): adding openTabFilepaths to inline completion requests#538

Open
laileni-aws wants to merge 2 commits intoaws:mainfrom
laileni-aws:main
Open

fix(amazonq): adding openTabFilepaths to inline completion requests#538
laileni-aws wants to merge 2 commits intoaws:mainfrom
laileni-aws:main

Conversation

@laileni-aws
Copy link
Copy Markdown

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):

  1. InlineCompletionParams.java — Added openTabFilepaths field (List<String>) matching the LS protocol's OpenTabParams interface.

  2. QEclipseEditorUtils.java — Added getOpenEditorFilePaths() that iterates IWorkbenchPage.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 in getCrossFileCandidates() via URI.file(openTabFile).

  3. InlineCompletionUtils.java — Updated cwParamsFromContext() to call getOpenEditorFilePaths() and set the result on params when non-empty.

Two test files added: InlineCompletionUtilsTest.java and QEclipseEditorUtilsGetOpenEditorFilePathsTest.java covering 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant