Skip to content

Set C/C++ go-to fallback defaults between definition and declaration - #14681

Open
Prashant Kumar Rai (8prashant) wants to merge 2 commits into
microsoft:mainfrom
8prashant:fix/14509-goto-definition-declaration-toggle
Open

Set C/C++ go-to fallback defaults between definition and declaration#14681
Prashant Kumar Rai (8prashant) wants to merge 2 commits into
microsoft:mainfrom
8prashant:fix/14509-goto-definition-declaration-toggle

Conversation

@8prashant

Copy link
Copy Markdown

This PR improves C/C++ navigation defaults so definition and declaration commands fall back to each other automatically.

Linked issue

Fixes #14509

What changed

  • Updated C/C++ language-specific configuration defaults to set:
    • editor.gotoLocation.alternativeDefinitionCommand = editor.action.revealDeclaration
    • editor.gotoLocation.alternativeDeclarationCommand = editor.action.revealDefinition
  • Applied for:
    • [c]
    • [cpp]
    • [cuda-cpp]

Why

This provides smoother F12 behavior across declaration/definition contexts without requiring users to create custom keybindings by file extension.

Test coverage

  • Added a unit test that validates these defaults are present in package.json for [c], [cpp], and [cuda-cpp].
  • Test executed:
    • ./node_modules/.bin/mocha.cmd dist/test/unit/gotoLocationDefaults.test.js --timeout 30000
  • Result: passing (1 test).

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

Adds reciprocal declaration/definition navigation fallbacks for C, C++, and CUDA C++.

Changes:

  • Configures declaration and definition fallback commands.
  • Adds unit coverage for all supported language defaults.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
Extension/package.json Adds language-specific navigation defaults.
Extension/test/unit/gotoLocationDefaults.test.ts Verifies the defaults for C, C++, and CUDA C++.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

Add a command "Go To Definition/Declaration "

3 participants