Add a command "Go To Definition/Declaration "
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 50/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- cpp, typescript, vscode
- Domain
- developer-experience, tooling
Research direction
Review the existing editor.action.revealDeclaration and editor.action.revealDefinition commands and the F12/keybinding examples in the issue. Trace the C/C++ extension's command entry points and determine how the current symbol context, including #include lines, selects the target; done means one native command consistently chooses the appropriate action.
Written by the indexing model from the issue text.
Description
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:
{
"key": "F12",
"command": "editor.action.revealDeclaration",
"when": "editorHasDeclarationProvider && editorTextFocus && !isInEmbeddedEditor && resourceExtname =~ /\\.(cpp|cxx|cc|c\\+\\+|c)$/"
},
{
"key": "F12",
"command": "editor.action.revealDefinition",
"when": "editorHasDefinitionProvider && editorTextFocus && !isInEmbeddedEditor && resourceExtname =~ /\\.(hpp|hxx|hh|h\\+\\+|h|inl|ipp)$/"
},
This fails in nuanced cases such as F12 on #include lines 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.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/vscode-cpptools
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
microsoft/vscode-cpptools#14787 ·
-
[Bug] cpptools fails to start on Ubuntu ARM64 due to missing execute permissions on shared libraries Openbug fixed Language Service regression
microsoft/vscode-cpptools#14779 · 1 assignee ·
-
Language Service more info needed
microsoft/vscode-cpptools#14778 · 1 comment · 1 assignee ·
-
Difficulty 4/5 3-5 days Newbie friendliness 64/100
microsoft/vscode-cpptools#14769 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
microsoft/vscode-cpptools#14768 · 1 comment ·
All issues in microsoft/vscode-cpptools
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·