Skip to content

Fix C++ agent definition lookup returning declarations - #14648

Draft
Carson Radtke (carsonRadtke) wants to merge 1 commit into
microsoft:mainfrom
carsonRadtke:dev/carsonradtke/strict-cpp-definition
Draft

Fix C++ agent definition lookup returning declarations#14648
Carson Radtke (carsonRadtke) wants to merge 1 commit into
microsoft:mainfrom
carsonRadtke:dev/carsonradtke/strict-cpp-definition

Conversation

@carsonRadtke

Copy link
Copy Markdown
Member

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.

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 AI left a comment

Copy link
Copy Markdown
Contributor

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 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/definitionForAgent request.
  • Adds a new internal command C_Cpp.GoToDefinitionForAgent that routes to the agent-specific definition request.
  • Updates the existing C_Cpp.GoToDefinition command handler to continue using the standard textDocument/definition request 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));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pull Request

Development

Successfully merging this pull request may close these issues.

2 participants