microsoft / microsoft/vscode-cpptools
c_cpp_properties.json support for environment variables defined in ~/.bashrc used in "includePath" and "compilerPath"
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
Descrizione
Feature Request
I have a project compiled with g++. I have two Windows PCs, with one connected to local WSL and the other to a remote server. The path to g++ and the path of a third-party library needed in the includePath are different on the two devices.
So I set different environment variables in .bashrc on both devices:
export GCC_PATH = /path/to/gcc
export MY_LIB_PATH = /path/to/my/lib/
In c_cpp_properties.json, use the following settings:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${env:MY_LIB_PATH}/include"
],
"compilerPath": "${env:GCC_PATH}/bin/g++",
"cStandard": "gnu23",
"cppStandard": "c++20",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
Then the following problems occured:
-
It seems that intellisense currently doesn't recognize using environment variable in compilerPath. There are squiggles under "${env:GCC_PATH}/bin/g++".
-
Although there are no squiggles under "${env:MY_LIB_PATH}/include" in includePath, the intellisense still can't find the header that needs to be included in the .cpp file. So when I open a .cpp file, squiggles appear.
This should not be due to a flaw in defining environment variables in .bashrc, as this link suggests that VSCode should now auto-detect environment variables in .bashrc.
I noticed and browsed a lot of issues about environment variable support, but still can't find a solution for this problem, so I consider it as a request that may be added.
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 la configurazione in c_cpp_properties.json usando variabili d’ambiente da ~/.bashrc sia in includePath sia in compilerPath. Inizia verificando come IntelliSense risolve queste due impostazioni; il lavoro è completato quando compilerPath non produce alcuna sottolineatura ondulata e gli header sotto l’includePath basato sull’ambiente vengono risolti senza diagnostica.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- bash, cpp
- Ambito
- tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100