clangd / vscode-clangd

Visual Studio Code extension for clangd
https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
MIT License
592 stars 97 forks source link

clang-tidy's functionality not works with clangd version 18 #616

Closed auralioth closed 2 months ago

auralioth commented 2 months ago

System information

Clangd version: 18.1.3 clangd extension version: 0.1.28 Operating system: Windows 11 23H2 or Arch Linux

Reproduction

1. Install clangd

auto main() -> int { std::cout << "Hello, World!" << std::endl; return 0; }

**.clangd**
```yaml
Diagnostics:
  ClangTidy:
    Add: [performance-*]

Expected

Under std::endl, clang-tidy prompt you: Do not use 'std::endl' with streams; use '\n' instead (fix available)clang-tidy performance-avoid-endl image

In fact

Nothing will report. clang-tidy not works.

Workaround

In Arch I can just use clang package with version 17.

In Windows I can install clangd 17 through the automatic installation by clangd extensiton. And then in the clangd config add:

CompileFlags:
  Add: [--target=x86_64-w64-windows-gnu]

But the annoying thing is it will add clangd.path to my vscode settings.json. I sync settings between Arch and Windows. So the path is not the same.

Vscode now does not support scoping settings by platform according to issues 207760. So it is not that convenient.

auralioth commented 2 months ago

Sorry. This is my mistake. I have been using clang17 before. I didn't notice that FastCheckFilter was introduced after clang18. And performance-avoid-endl is not in the known list (https://clang.llvm.org/extra/clang-tidy/checks/list.html). I can adjust the FastCheckFilter to allow running.