Repository navigation
Add a command "Go To Definition/Declaration " #14509
Description
Activity
MStachowicz commented
on Jun 11, 2026 AuthorMore actionsI have found a better workaround, continuing to use "Go To Definition" and settings VSCode settings as:
"editor.gotoLocation.alternativeDefinitionCommand": "editor.action.revealDeclaration",This defaults to "Find all references" which always confused me, I think the above should be default as it mirrors Visual Studio.
Now the Go to definition works as I desired above:
IF requested on a declaration -> Go To Definition IF requested on a definition -> Go To DeclerationThanks #13147 for helping me find this option.
- addedFeature: Go to DefinitionAn issue related to Go to Definition/Declaration.An issue related to Go to Definition/Declaration.enhancementImprovement to an existing featureImprovement to an existing feature
on Jun 15, 2026 sean-mcmanus commented
on Jun 15, 2026 ContributorMore actionsWe could potentially set the default settings for C/C++ in our package.json.
"editor.gotoLocation.alternativeDefinitionCommand": "editor.action.revealDeclaration", "editor.gotoLocation.alternativeDeclarationCommand": "editor.action.revealDefinition"
However, I already see go to def on a def return the declaration, but maybe there might be cases where that doesn't happen? Maybe we could internally change go to decl to match and return the definition.
This feature request is being closed due to insufficient upvotes. Please leave a 👍-upvote or 👎-downvote reaction on the issue to help us prioritize it. When enough upvotes are received, this issue will be eligible for our backlog.
- addedmore votes neededIssues that have been postponed until more community members upvote itIssues that have been postponed until more community members upvote it
on Aug 15, 2026 - removedmore votes neededIssues that have been postponed until more community members upvote itIssues that have been postponed until more community members upvote it
on Oct 1, 2026 sean-mcmanus commented
on Oct 7, 2026 ContributorMore actions
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Feature Request
I would love to be able to apply "Go To Declaration" when I am requesting it on a definition, and "Go To Definition" when I am requesting it on a declaration.
I foolishly thought this was the standard F12 behaviour before finding out I need to bind both and use them contextually! I imagine its trivial to implement the context switching internally and apply the correct one given the context of the request.
i.e.
IF requested on a declaration -> Go To Definition
IF requested on a definition -> Go To Decleration
My workaround currently is binding the behaviour to the "when" field inside Keybinds.json based on file endings:
This fails in nuanced cases such as F12 on
#includelines when in a source file, this will attempt "Go To Declaration" and fail but should be using "Go To Definition". Another reason a context based command would be useful!A native command provided by the extension would be nice.