notskm / vscode-clang-tidy

MIT License
49 stars 25 forks source link

My experiences with vscode clang-tidy in Windows are: #15

Open mumin16 opened 4 years ago

mumin16 commented 4 years ago

1-firstly you need clang-tidy.exe(completely working is what come with clion.) others are not work: msys2 , official, qt creator. Actually it's work what come with qt creator but it gives less information than clion.

2-settings.json should be: { "cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json",

"clang-tidy.executable":
     "C:/Program Files/JetBrains/CLion 201.6073.20/bin/clang/win/clang-tidy.exe",
"clang-tidy.compilerArgsBefore":
      ["-Wall","-Wextra"],
"clang-tidy.checks": 
      [
    "google-*",
    "cppcoreguidelines-*",
    "modernize-*",
    "performance-*"
     ]

}

3-Bug Fix: you must convert source path seperators from \ to / in command from compile_commands.json

from

"command": "C:\msys64\mingw64\bin\g++.exe -g -o CMakeFiles\demo.dir\main.cpp.obj -c C:\Users\x64\vscodeProjects\demo\main.cpp",

to

"command": "C:\msys64\mingw64\bin\g++.exe -g -o CMakeFiles\demo.dir\main.cpp.obj -c C:/Users/x64/vscodeProjects/demo/main.cpp",

anders-wind commented 3 years ago

Is the above a complete compile_commands.json - or just a part of it?