Fix C++ agent definition lookup returning declarations - #14648
Draft
Carson Radtke (carsonRadtke) wants to merge 1 commit into
Draft
Fix C++ agent definition lookup returning declarations#14648Carson Radtke (carsonRadtke) wants to merge 1 commit into
Carson Radtke (carsonRadtke) wants to merge 1 commit into
Conversation
Agent symbol lookup used the human definition request, which can return declarations. Add a dedicated internal command that sends the strict agent definition request while leaving standard navigation unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 48d6453b-ba55-40f5-a465-ef9bece4cb79
Copilot started reviewing on behalf of
Sean McManus (sean-mcmanus)
August 7, 2026 03:26
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a separate go-to-definition pathway intended for C++ agent scenarios so that agent lookups can use a stricter native-backed request (avoiding “declaration-only” results) while preserving existing user-facing definition navigation behavior.
Changes:
- Refactors the go-to-definition request helper to accept a request type and adds a new
cpptools/definitionForAgentrequest. - Adds a new internal command
C_Cpp.GoToDefinitionForAgentthat routes to the agent-specific definition request. - Updates the existing
C_Cpp.GoToDefinitioncommand handler to continue using the standardtextDocument/definitionrequest via a renamed wrapper.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Extension/src/LanguageServer/Providers/goToDefinitionProvider.ts | Introduces standard vs agent definition request types and wraps shared request logic. |
| Extension/src/LanguageServer/extension.ts | Registers a new agent-only command and routes standard definition to the renamed standard wrapper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
407
to
409
| commandDisposables.push(vscode.commands.registerCommand('C_Cpp.GoToDefinition', enabled ? onGoToDefinition : onDisabledCommand)); | ||
| commandDisposables.push(vscode.commands.registerCommand('C_Cpp.GoToDefinitionForAgent', enabled ? onGoToDefinitionForAgent : onDisabledCommand)); | ||
| commandDisposables.push(vscode.commands.registerCommand('C_Cpp.PrepareCallHierarchy', enabled ? onPrepareCallHierarchy : onDisabledCommand)); |
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.
Tracks DevDiv 2860151 and DevDiv 3030687.
Agent lookup currently routes through the human definition request, which may return declarations. This adds an internal command backed by the strict native request while preserving standard navigation behavior.