Skip to content

Commit 285b780

Browse files
wenytang-msCopilot
andcommitted
Tighten Java file structure limit
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a690020 commit 285b780

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
{
5353
"name": "lsp_java_getFileStructure",
5454
"toolReferenceName": "javaFileStructure",
55-
"modelDescription": "Get a known Java file's outline: classes, interfaces, methods, fields, symbol kinds, and read_file ranges, to pick a precise source range instead of reading the whole file.\n\nUse when the user gave a Java file path or lsp_java_findSymbol returned a file and broader file context is needed; do not guess paths. Results include a top-level file plus per-symbol startLine, endLine, and readFileRange ({ offset, limit }); call read_file with filePath=file and the selected symbol's readFileRange. Use limit to cap returned outline items (default 40, max 80). Not for workspace-wide search\u2014use lsp_java_findSymbol for that.",
55+
"modelDescription": "Get a known Java file's outline: classes, interfaces, methods, fields, symbol kinds, and read_file ranges, to pick a precise source range instead of reading the whole file.\n\nUse when the user gave a Java file path or lsp_java_findSymbol returned a file and broader file context is needed; do not guess paths. Results include a top-level file plus per-symbol startLine, endLine, and readFileRange ({ offset, limit }); call read_file with filePath=file and the selected symbol's readFileRange. Use limit to cap returned outline items (default 20, max 60). Not for workspace-wide search\u2014use lsp_java_findSymbol for that.",
5656
"displayName": "Java: Get File Structure",
5757
"userDescription": "Get a Java file outline with classes, methods, fields, and line ranges.",
5858
"tags": [
@@ -73,7 +73,7 @@
7373
},
7474
"limit": {
7575
"type": "number",
76-
"description": "Maximum outline items to return (default: 40, max: 80). Use a smaller value when only top-level context is needed."
76+
"description": "Maximum outline items to return (default: 20, max: 60). Use a smaller value when only top-level context is needed."
7777
}
7878
},
7979
"required": [

resources/skills/java-lsp-tools/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Search for Java symbol definitions (classes, methods, fields) by name across the
1818

1919
### `lsp_java_getFileStructure`
2020
Get hierarchical outline of a Java file (classes, methods, fields) with line ranges.
21-
- Input: `{ uri, limit? }` — workspace-relative path plus max outline items. Prefer `file` from `lsp_java_findSymbol`; limit defaults to 40, max 80. Must be a known path from prior tool results or user input — do not guess
21+
- Input: `{ uri, limit? }` — workspace-relative path plus max outline items. Prefer `file` from `lsp_java_findSymbol`; limit defaults to 20, max 60. Must be a known path from prior tool results or user input — do not guess
2222
- Output: `{ file, symbols: [{ name, kind, startLine, endLine, readFileRange, range, detail?, children? }], truncated? }`; call `read_file` with `filePath=file` and the selected symbol's `readFileRange`
2323
- **Use before** `read_file` when you need to choose a precise line range in a known Java file
2424

src/copilot/tools/javaContextTools.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ import { sendInfo } from "vscode-extension-telemetry-wrapper";
2828

2929
// Hard caps to keep tool responses within the < 200 token budget.
3030
const MAX_SYMBOL_DEPTH = 3;
31-
const MAX_SYMBOL_NODES = 80;
32-
const DEFAULT_FILE_STRUCTURE_SYMBOL_NODES = 40;
31+
const MAX_FILE_STRUCTURE_SYMBOL_NODES = 60;
32+
const DEFAULT_FILE_STRUCTURE_SYMBOL_NODES = 20;
3333
const MAX_CALL_RESULTS = 50;
3434
const MAX_TYPE_RESULTS = 50;
3535
const MAX_IMPORTS = 50;
@@ -183,7 +183,7 @@ interface FileStructureInput {
183183
const fileStructureTool: vscode.LanguageModelTool<FileStructureInput> = {
184184
async invoke(options, _token) {
185185
const startTime = Date.now();
186-
const limit = Math.min(Math.max(options.input.limit || DEFAULT_FILE_STRUCTURE_SYMBOL_NODES, 1), MAX_SYMBOL_NODES);
186+
const limit = Math.min(Math.max(options.input.limit || DEFAULT_FILE_STRUCTURE_SYMBOL_NODES, 1), MAX_FILE_STRUCTURE_SYMBOL_NODES);
187187
let resultCount = 0;
188188
let status = "success";
189189
let errorCode = "";

0 commit comments

Comments
 (0)