microsoft / microsoft/vscode-cpptools

Computed include go to definition (ctrl+click)

Aperta
#13,100 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Feature Request Language Service Visual Studio
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

Environment
  • OS and Version: Windows 10
  • VS Code Version: Latest
  • C/C++ Extension Version: Latest
  • If using SSH remote, specify OS of remote machine:
Bug Summary and Steps to Reproduce

Bug Summary:
I am not sure if this is a bug or intended, but would be a shame if this is intended.

I am investigating using "computed includes" within our project and vscode ctrl+click does not seem to be working on them. The extension properly resolves the defines and the test source file compiles successfully. However, if I try to go directly to an included header file, directly by using ctrl + click, it is inoperable.

Side note. Ctrl + click seems to also not be working on an absolute path.

The power of computed includes comes from being able to use #defines within includes. We want a slight variation that uses directories instead, but the whole slew does not seem to be working.

Steps to reproduce:

  1. Define test.c with a computed include using a macro (which expands a directory), a 'normal' computed include that uses a computed include directly from a define, an absolute path include, and something that works such as #include <stdint.h>.
  2. Define c_cpp_properties and add the relevant defies to be used in expansion.
  3. Try to ctrl + click or go to definition on all of the computed includes and or the include of an absolute path and watch as they do not seem to work but ctrl + click on stdint.h does.

Expected behavior:
The extension properly expands the macros to the correct paths. Ctrl + click should work on the expanded macro used within a define. Ctrl + click should also work on absolute paths.

Note in my examples I am on windows and very explicitly defining all of my paths with forward slash '/', not backslash so that I can be portable. Windows accepts either, but unix only accepts forward slash for path separators.

test.c
Image

c_cpp_properties
Image

macro expand STR(THE_DIR/test.h)
Image

macro expand TEST_H
Image

  1. Ctrl click / go to definition does not work on lines 1, 3, 5
  2. Ctrl click / go to definition works on line 7
  3. Greyed out is my user name
  4. Compiled test.c using clang, which works successfully
Configuration and Logs
{
	"version": 4,
	"configurations": [
		{
			"name": "test",
			"cStandard": "c23",
			"intelliSenseMode": "clang-arm",
			"defines": [
				"XSTR(x)=#x",
				"STR(x)=XSTR(x)",
				"THE_DIR=C:/Users/.../Desktop/New folder",
				"TEST_H=\"C:/Users/.../Desktop/New folder/test.h\""
			]
		}
	]
}

replace '...' with my user name

Other Extensions

No response

Additional context

No response

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riprodurre il problema con il test.c menzionato e la configurazione c_cpp_properties, confrontando la navigazione per gli include calcolati, i percorsi assoluti e stdint.h. Tracciare il punto di ingresso della navigazione degli include dell’estensione e verificare che Ctrl+click o go to definition risolva la macro espansa e i percorsi assoluti, preservando al contempo il caso funzionante dell’header standard.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, typescript, vscode
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.