perf: improve Java LSP tool result handoff#1031
Draft
wenytang-ms wants to merge 2 commits into
Draft
Conversation
Return structured file and line fields from findSymbol so the model can consume precise ranges without repeating symbol search. Accept line-suffixed Java locations in file structure resolution and document outlineInput handoff. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the Java LSP Copilot tools’ result “handoff” so downstream steps (e.g., read_file / lsp_java_getFileStructure) can consume lsp_java_findSymbol output more directly, and so file resolution is more tolerant of Java-style path:line inputs and multi-root workspaces.
Changes:
- Enhanced
lsp_java_findSymbolpayload withfile,startLine,endLine, andoutlineInput, and added anextStephint to reduce unnecessary repeat tool calls. - Made file URI resolution tolerate Java location suffixes (e.g.,
src/Foo.java:42) and improved multi-root relative-path handling when the workspace folder name is included. - Updated skill docs, instrument instructions, and tool metadata to prefer
outlineInput/filehandoff patterns.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/copilot/tools/javaContextTools.ts | Adds Java path:line tolerance, improves multi-root relative resolution, and enriches findSymbol results with additional fields and guidance. |
| resources/skills/java-lsp-tools/SKILL.md | Documents the updated findSymbol output fields and the preferred handoff flow using outlineInput/file. |
| resources/instruments/javaLspContext.instructions.md | Updates Java chat instructions to prefer read_file with file/range and getFileStructure with outlineInput. |
| package.json | Updates tool metadata/schema descriptions to reflect new fields and tolerated path:line inputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+343
to
+346
| const nextStep = symbols.length <= 3 | ||
| ? [ | ||
| "These are exact Java symbol locations.", | ||
| "Use read_file on the returned file/range, or lsp_java_getFileStructure with outlineInput for broader file context.", |
Use normalized relative paths consistently when resolving file structure inputs and classify truncated findSymbol responses before small exact-result guidance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Summary
This draft follows the 0.27.5 Java LSP telemetry diagnosis:
findSymbol -> findSymbolimproved from the 0.27.4 baseline but is still high (~43.8%).success_small_result, the next tool is stillfindSymbol~41.7% of the time, even though these results should usually be directly consumable.getFileStructurestill has a noticeablefileNotFound/outsideWorkspacetail, andfindSymbolpreviously returnedlocationaspath:linewhilegetFileStructureexpected a clean path.Changes
findSymbolresult fields:file,startLine,endLine,range, andoutlineInput.nextStephint tofindSymbolresponses, with stronger guidance for small exact result sets.src/Foo.java:42.asRelativePathincludes the workspace folder name.outlineInput/filehandoff.Validation
npm run compilenpm run tslintnpm testcurrently fails in existing Library Controller tests becausetoReferencedLibraryPath/toReferencedLibraryExcludePathare not exported fromextension_bundle_1; unrelated to this LSP tool change.