This extension uses clang-tidy to lint C/C++ files.
This extension is in a very early stage of development. You will need to do some configuration before you can use it. But this extension is still kind of "usable".
Basic diagnostic(linter) and quick fixes for the C/C++ source files with the clang-tidy.
As for now you have to download/compile the clang-tidy executable. Maybe executables will be shipped with this extension in the future. The download link for official prebuilt binaries is http://releases.llvm.org/download.html.
You may need to modify some default settings to get this extension to work for now.
clangTidy.executable
: You need to manually set this to your clang-tidy
executable file.
clangTidy.systemIncludePath
: If you use the downloaded prebuilt binaries, it may fail to find some system headers. So put the system include paths here.
clangTidy.lintLanguages
: What languages do you want to lint?
clangTidy.extraCompilerArgs
: Extra arguments that pass to the compiler (not clang-tidy
).
clangTidy.headerFilter
: Value for -header-filter
command line argument.
clangTidy.args
: Additional arguments to pass to clang-tidy
If you want to configure the checks of clang tidy, create a .clang-tidy
file in your working directory (please refer to the clang-tidy
's document for detail).
Source files can only be lint when you save or open it.
You have to modify clangTidy.extraCompilerArgs
setting if your C/C++ project has custom include paths.
Repository: https://github.com/alesiong/clang-tidy-linter
I'm a beginner to vscode extension development, so if you have any suggestions, don't hesitate to post issues and/or pull requests.
-
Refactor
server.ts
, it is now in a very bad structure (with lots of functions and global variables) -
Write tests
-
Support for on-the-fly linting (if possible)
-
Support for custom include paths through settings and by reading
.vscode/c_cpp_properties.json
-
Ship clang-tidy binaries
- When using
-p compile_commands.json
, saving a header or opening a header file for the first time can clear existing quick fixes for that file.- To regenerate the fixes, touch a cpp file which includes that header file.
compile_commands.json
can be generated from CMake whenCMAKE_EXPORT_COMPILE_COMMANDS
is on.
The very first beta version published to the market.
Support Windows (not tested). Add code actions(quick fixes) support.