microsoft / microsoft/vscode-cpptools
"Go to Definition/Declaration" don't work correctly with the function parameters of a `std::function`
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
Descrizione
Bug type: Language Service
Describe the bug
- OS and Version: Arch Linux, kernel: 5.10.39-1-lts
- VS Code Version: 1.56.2
- C/C++ Extension Version: v1.4.0-insiders3
- Other extensions you installed (and if the issue persists after disabling them): I don't have other enabled extensions from the "C++" category
When I perform the "Go To Definition" or "Go to Declaration" action on a parameter of the function signature in a std::function type, VSCode navigates to the definition/declaration of std::function in the standard library instead of the actual type definition/declaration. Strangely enough, these actions work properly with the return type of the signature.
Steps to reproduce
- Copy the code sample into a
.cppfile. - Right click on the
fooinside the parentheses and choose eitherGo to DefinitionorGo to Declaration. - Observe that VSCode navigates either to the definition of
std::function(ifGo to Definitionwas used) or to its declaration.
Expected behavior
VSCode should navigate to the definition of foo within the same file.
Code sample and logs
- Code sample
#include <functional>
struct foo
{
int bar;
};
using baz = std::function<foo(foo)>;
int main()
{
return 0;
}
- Logs from running
C/C++: Log Diagnosticsfrom the VS Code command palette
-------- Diagnostics - 5/26/2021, 10:46:45 AM
Version: 1.4.0-insiders3
Current Configuration:
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"cStandard": "c17",
"cppStandard": "c++14",
"intelliSenseMode": "linux-clang-x64",
"compilerPathIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"intelliSenseModeIsExplicit": true,
"compilerArgs": [],
"browse": {
"path": [
"${workspaceFolder}/**"
],
"limitSymbolsToIncludedHeaders": true
}
}
No active translation units.
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 52380
Number of files parsed: 6413
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Riproduci il problema usando l'esempio .cpp fornito in VS Code con l'estensione C/C++; inizia con Go to Definition o Go to Declaration su foo all'interno di std::function<foo(foo)>. Il lavoro è completato quando entrambe le azioni navigano alla definizione di foo nello stesso file invece che a std::function.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp, vscode
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 35/100