microsoft / microsoft/vscode-cpptools
Auto detection of clang-format and clang-tidy in the PATH isn't working?
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.2k
- Forks
- 1.7k
- Ø Merge
- 14 Std. 46 Min.
- Gemergte PRs (30 T.)
- 61
Beschreibung
> @taoran-git Doing a Reload Window should fix it -- the path is cached. See https://github.com/microsoft/vscode-cpptools/blob/main/Extension/src/LanguageServer/settings.ts#L111 . If that doesn't fix it, can you file a new issue on the bug?
Thank you for your reply. My issue persists and is pretty much the same as https://github.com/microsoft/vscode-cpptools/issues/8520. I now suspect that auto-detection of clang-format was broken even before updating llvm to 15. Things worked fine only because the extension-bundled clang-format WAS up-to-date with the .clang-format file. After adding some clang-format-15-exclusive options to my .clang-format file, the extension-bundled formatter stop working. This is indeed expected though.
What really goes wrong is that the extension never invokes the clang-format in my $PATH.
To reassure,
echo $PATH
gives me /usr/local/opt/llvm/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/usr/local/opt/llvm/bin:/opt/local/bin:/opt/local/sbin
Manually setting C_Cpp.clang_format_path fixes the problem. But a cross platform solution would be really appreciated.
Originally posted by @taoran-git in https://github.com/microsoft/vscode-cpptools/issues/9816#issuecomment-1290088933
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit Extension/src/LanguageServer/settings.ts etwa bei Zeile 111 und überprüfe das in issue 8520 beschriebene PATH-Caching und Verhalten der automatischen Erkennung. Reproduziere das Problem, wenn clang-format und clang-tidy in PATH verfügbar sind, vergleiche es mit dem manuellen Setzen von C_Cpp.clang_format_path und bestätige, dass die Erkennung plattformübergreifend funktioniert, ohne dass die explizite Einstellung erforderlich ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp, typescript
- Bereich
- tooling
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100