Skip to content

Conversation

@OmerMachluf
Copy link

@OmerMachluf OmerMachluf commented Nov 20, 2025

This is an exploration PR: It is not fully ready yet.
The core idea behind it is to reduce the number of text searches which are expensive, yield many results and limit the capability to work properly in big/huge repositories.
Instead, this aims to provide tools for copilot that allows him to navigate the codebase like a developer would.
It leverages LSP to provide code referneces, f12 capability, find references/implementations etc or get the document full symbols to understand structure and allow to focus on which lines to read beforehand.
I haven't done official benchmarking yet(And I was curious if there are any suites already designed for that purpose), but from my own internal tests I am able to complete tasks that would have usually yielded or give up due to context loss or too many searches yielding nothing.
Execution happens faster and more realibly as the copilot simply navigates between documents he's exploring or modifying using semantic references.
I wanted to get a ack that there are no blockers with this approach before doubling down on the time allocated to complete this fully.
Among the gaps that I currently recognize are:

  • Official benchmarking test suites(if any) validation based more on mere my own experience
  • Experimental flag: having this as an opt-in rather than enabled by default
  • having fallback for languages or workspaces without lsp support or when language symbols are not loaded yet
  • Refining the prompt as sometimes i find myself reminding it to use symbolic navigation over search while symbolic navigation works faster and more reliably

Copilot AI review requested due to automatic review settings November 20, 2025 09:57
@OmerMachluf
Copy link
Author

@OmerMachluf please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree [company="{Microsoft}"]

Copilot finished reviewing on behalf of OmerMachluf November 20, 2025 10:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces symbolic navigation tools that enable the AI to navigate codebases like a developer using F12-style navigation (Go to Definition, Find References, Find Implementations) along with document symbol listing capabilities.

Key Changes

  • Added four new language model tools: DocumentSymbols, Definitions, Implementations, and References
  • Implemented shared utilities for symbol position normalization and ambiguity resolution
  • Updated agent prompts to instruct the AI on when and how to use symbolic navigation tools

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
src/extension/tools/node/definitionsTool.tsx New tool implementing "Go to Definition" functionality with symbol disambiguation
src/extension/tools/node/implementationsTool.tsx New tool for finding concrete implementations of interfaces/abstract members
src/extension/tools/node/referencesTool.tsx New tool for finding all references to a symbol across the workspace
src/extension/tools/node/documentSymbolsTool.tsx New tool for listing document symbols with pagination and caching support
src/extension/tools/node/toolUtils.ts Added shared utilities for symbol position normalization and disambiguation
src/extension/tools/node/allTools.ts Registered the four new navigation tools
src/extension/tools/common/toolNames.ts Added enum entries and tool categories for the new tools
src/extension/tools/vscode-node/tools.ts Added debug logging for tool registration
src/extension/prompts/node/panel/codebaseAgentPrompt.tsx Added instructions for using symbolic navigation tools in codebase agent
src/extension/prompts/node/agent/defaultAgentInstructions.tsx Added instructions for symbolic navigation in default and alternate GPT prompts
package.json Added JSON schemas for the four new tools with complete parameter definitions
package.nls.json Added localized strings for tool names and descriptions

Comment on lines +59 to +61
Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.References} to find referenced usages of a symbol across the codeobase. very useful when modifying public functions signatures or data structures. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sentence starts with lowercase "you" after a period. It should be capitalized: "You must use the line number..."

Suggested change
Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.References} to find referenced usages of a symbol across the codeobase. very useful when modifying public functions signatures or data structures. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12. You must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages. You must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.References} to find referenced usages of a symbol across the codeobase. Very useful when modifying public functions signatures or data structures. You must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +61
Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.References} to find referenced usages of a symbol across the codeobase. very useful when modifying public functions signatures or data structures. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sentence starts with lowercase "you" after a period. It should be capitalized: "You must use the line number..."

Suggested change
Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.References} to find referenced usages of a symbol across the codeobase. very useful when modifying public functions signatures or data structures. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12. You must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages. You must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.References} to find referenced usages of a symbol across the codeobase. Very useful when modifying public functions signatures or data structures. You must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />

Copilot uses AI. Check for mistakes.
}

function normalizeLocations(locations: readonly (vscode.Location | vscode.LocationLink)[]): Location[] {
return locations.map(location => location instanceof Location ? location : new Location(location.targetUri, location.targetSelectionRange ?? location.targetRange));
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instanceof Location check may not work correctly. Since Location is imported from the vscode API, checking instanceof may fail when the location comes from a different execution context. Consider checking for the presence of expected properties instead: 'uri' in location && 'range' in location or use a type guard.

Suggested change
return locations.map(location => location instanceof Location ? location : new Location(location.targetUri, location.targetSelectionRange ?? location.targetRange));
return locations.map(location => ('uri' in location && 'range' in location) ? location : new Location(location.targetUri, location.targetSelectionRange ?? location.targetRange));

Copilot uses AI. Check for mistakes.
Use {ToolName.DocumentSymbols} After you have a likely file, call {ToolName.DocumentSymbols} to review its structure, and get accurate symbols and their line numbers for further navigation. Page through results with the "page" and "pageSize" options, or set "reset": true to rebuild the cache before paging. <br />
Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.References} to find referenced usages of a symbol across the codeobase. very useful when modifying public functions signatures or data structures. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sentence "very useful when modifying..." should start with a capital letter: "Very useful when modifying..."

Suggested change
Call {ToolName.References} to find referenced usages of a symbol across the codeobase. very useful when modifying public functions signatures or data structures. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />
Call {ToolName.References} to find referenced usages of a symbol across the codeobase. Very useful when modifying public functions signatures or data structures. you must use the line number and symbol name as received from the {ToolName.DocumentSymbols} tool.<br />

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +32
const extensionVersion = vscode.extensions.getExtension('github.copilot-chat')?.packageJSON?.version;
console.log(`[CopilotTools] registering tools for github.copilot-chat@${extensionVersion ?? 'unknown'}`);

for (const [name, tool] of toolsService.copilotTools) {
console.log(`[CopilotTools] registering ${name}`);
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug console.log statements should be removed or replaced with proper logging using the project's logging infrastructure. The extension should use the logging service from src/extension/log/ instead of console.log for production code.

Copilot uses AI. Check for mistakes.
Use {ToolName.Codebase} to search for high level concepts or descriptions of functionality in the user's question. This is the best place to start if you don't know where to look or the exact strings found in the codebase.<br />
Always prefer symbolic navigation when applicable.
Use {ToolName.DocumentSymbols} After you have a likely file, call {ToolName.DocumentSymbols} to review its structure. Page through results with the "page" and "pageSize" options, or set "reset": true to rebuild the cache before paging. <br />
Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12.<br />
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing line break. According to the TSX coding guidelines, <br /> should be used for line breaks. Add <br /> at the end of this line to properly separate it from the next instruction.

Copilot generated this review using guidance from repository custom instructions.
Always prefer symbolic navigation when applicable.
Use {ToolName.DocumentSymbols} After you have a likely file, call {ToolName.DocumentSymbols} to review its structure. Page through results with the "page" and "pageSize" options, or set "reset": true to rebuild the cache before paging. <br />
Use {ToolName.Definitions} When you know where you are in the file, use {ToolName.Definitions} to navigate straight to the target symbol, just like a developer would use f12.<br />
Call {ToolName.Implementations} to enumerate concrete implementations when working or modifying with interfaces and you need to recognize their usages<br />
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing line break. According to the TSX coding guidelines, <br /> should be used for line breaks. Add <br /> at the end of this line to properly separate it from the next instruction.

Copilot generated this review using guidance from repository custom instructions.
]
}
},
{
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation. According to the coding guidelines, tabs should be used for indentation. This line uses tabs but is misaligned with the surrounding code. The opening brace should align with the lines above it at lines 224 and 267.

Copilot uses AI. Check for mistakes.
Comment on lines +191 to +192
function normalizeLocations(locations: readonly (vscode.Location | vscode.LocationLink)[]): Location[] {
return locations.map(location => location instanceof Location ? location : new Location(location.targetUri, location.targetSelectionRange ?? location.targetRange));
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instanceof Location check may not work correctly. Since Location is imported from the vscode API, checking instanceof may fail when the location comes from a different execution context. Consider checking for the presence of expected properties instead: 'uri' in location && 'range' in location or use a type guard.

Suggested change
function normalizeLocations(locations: readonly (vscode.Location | vscode.LocationLink)[]): Location[] {
return locations.map(location => location instanceof Location ? location : new Location(location.targetUri, location.targetSelectionRange ?? location.targetRange));
function isLocation(obj: any): obj is Location {
return obj && typeof obj === 'object' && 'uri' in obj && 'range' in obj;
}
function normalizeLocations(locations: readonly (vscode.Location | vscode.LocationLink)[]): Location[] {
return locations.map(location =>
isLocation(location)
? location
: new Location(location.targetUri, location.targetSelectionRange ?? location.targetRange)
);

Copilot uses AI. Check for mistakes.
*/
export class CodesearchModeInstructions extends PromptElement<DefaultAgentPromptProps> {
render(state: void, sizing: PromptSizing) {
const tools = detectToolCapabilities(this.props.availableTools);
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable tools.

Suggested change
const tools = detectToolCapabilities(this.props.availableTools);

Copilot uses AI. Check for mistakes.
@microsoft-github-policy-service

@OmerMachluf please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"
Contributor License Agreement

Contribution License Agreement

This Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
and conveys certain license rights to Microsoft Corporation and its affiliates (“Microsoft”) for Your
contributions to Microsoft open source projects. This Agreement is effective as of the latest signature
date below.

  1. Definitions.
    “Code” means the computer software code, whether in human-readable or machine-executable form,
    that is delivered by You to Microsoft under this Agreement.
    “Project” means any of the projects owned or managed by Microsoft and offered under a license
    approved by the Open Source Initiative (www.opensource.org).
    “Submit” is the act of uploading, submitting, transmitting, or distributing code or other content to any
    Project, including but not limited to communication on electronic mailing lists, source code control
    systems, and issue tracking systems that are managed by, or on behalf of, the Project for the purpose of
    discussing and improving that Project, but excluding communication that is conspicuously marked or
    otherwise designated in writing by You as “Not a Submission.”
    “Submission” means the Code and any other copyrightable material Submitted by You, including any
    associated comments and documentation.
  2. Your Submission. You must agree to the terms of this Agreement before making a Submission to any
    Project. This Agreement covers any and all Submissions that You, now or in the future (except as
    described in Section 4 below), Submit to any Project.
  3. Originality of Work. You represent that each of Your Submissions is entirely Your original work.
    Should You wish to Submit materials that are not Your original work, You may Submit them separately
    to the Project if You (a) retain all copyright and license information that was in the materials as You
    received them, (b) in the description accompanying Your Submission, include the phrase “Submission
    containing materials of a third party:” followed by the names of the third party and any licenses or other
    restrictions of which You are aware, and (c) follow any other instructions in the Project’s written
    guidelines concerning Submissions.
  4. Your Employer. References to “employer” in this Agreement include Your employer or anyone else
    for whom You are acting in making Your Submission, e.g. as a contractor, vendor, or agent. If Your
    Submission is made in the course of Your work for an employer or Your employer has intellectual
    property rights in Your Submission by contract or applicable law, You must secure permission from Your
    employer to make the Submission before signing this Agreement. In that case, the term “You” in this
    Agreement will refer to You and the employer collectively. If You change employers in the future and
    desire to Submit additional Submissions for the new employer, then You agree to sign a new Agreement
    and secure permission from the new employer before Submitting those Submissions.
  5. Licenses.
  • Copyright License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license in the
    Submission to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute
    the Submission and such derivative works, and to sublicense any or all of the foregoing rights to third
    parties.
  • Patent License. You grant Microsoft, and those who receive the Submission directly or
    indirectly from Microsoft, a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under
    Your patent claims that are necessarily infringed by the Submission or the combination of the
    Submission with the Project to which it was Submitted to make, have made, use, offer to sell, sell and
    import or otherwise dispose of the Submission alone or with the Project.
  • Other Rights Reserved. Each party reserves all rights not expressly granted in this Agreement.
    No additional licenses or rights whatsoever (including, without limitation, any implied licenses) are
    granted by implication, exhaustion, estoppel or otherwise.
  1. Representations and Warranties. You represent that You are legally entitled to grant the above
    licenses. You represent that each of Your Submissions is entirely Your original work (except as You may
    have disclosed under Section 3). You represent that You have secured permission from Your employer to
    make the Submission in cases where Your Submission is made in the course of Your work for Your
    employer or Your employer has intellectual property rights in Your Submission by contract or applicable
    law. If You are signing this Agreement on behalf of Your employer, You represent and warrant that You
    have the necessary authority to bind the listed employer to the obligations contained in this Agreement.
    You are not expected to provide support for Your Submission, unless You choose to do so. UNLESS
    REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, AND EXCEPT FOR THE WARRANTIES
    EXPRESSLY STATED IN SECTIONS 3, 4, AND 6, THE SUBMISSION PROVIDED UNDER THIS AGREEMENT IS
    PROVIDED WITHOUT WARRANTY OF ANY KIND, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY OF
    NONINFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
  2. Notice to Microsoft. You agree to notify Microsoft in writing of any facts or circumstances of which
    You later become aware that would make Your representations in this Agreement inaccurate in any
    respect.
  3. Information about Submissions. You agree that contributions to Projects and information about
    contributions may be maintained indefinitely and disclosed publicly, including Your name and other
    information that You submit with Your Submission.
  4. Governing Law/Jurisdiction. This Agreement is governed by the laws of the State of Washington, and
    the parties consent to exclusive jurisdiction and venue in the federal courts sitting in King County,
    Washington, unless no federal subject matter jurisdiction exists, in which case the parties consent to
    exclusive jurisdiction and venue in the Superior Court of King County, Washington. The parties waive all
    defenses of lack of personal jurisdiction and forum non-conveniens.
  5. Entire Agreement/Assignment. This Agreement is the entire agreement between the parties, and
    supersedes any and all prior agreements, understandings or communications, written or oral, between
    the parties relating to the subject matter hereof. This Agreement may be assigned by Microsoft.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants