microsoft / microsoft/vscode-cpptools

Auto detection of clang-format and clang-tidy in the PATH isn't working?

オープン
#10,071 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

by design Feature: Code Analysis Feature: Code Formatting investigate: repro Language Service
主要言語
TypeScript
スター
6.2k
フォーク
1.7k
平均マージ
14時間 46分
マージ済み PR(30日)
61

説明

    > @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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Extension/src/LanguageServer/settings.ts の 111 行目付近から始め、issue 8520 で説明されている PATH のキャッシュと自動検出の動作を確認してください。PATH で clang-format と clang-tidy を利用できる状態で問題を再現し、C_Cpp.clang_format_path を手動で設定した場合と比較して、明示的な設定を必要とせずにすべてのプラットフォームで検出が機能することを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp, typescript
領域
tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。