clang-tidy-linter
clang-tidy-linter copied to clipboard
Generic improvements.
Hey!
Thanks for the project. Definitely makes my life easier :)
Sorry if the PR has too much variety. These are the improvements the my workspace needed. I'll break it down if you'd prefer it that way.
Here are fixes for some issues that I've faced while working with the extension:
-
Implemented
diagnosticFilter
This setting filters out shown diagnostics to prevent issues outside of user's code being shown and improves the performance by not creating as many diagnostic messages due to 3rd party code (especially useful for git submodule based dependencies). In my project, the warnings went from 3000+ to 5 this way.In some cases Clang Tidy may also show warnings from 3rd party files due to preprocessor macros and include files, irrelevent of the specified header-filter or CPP files (https://stackoverflow.com/questions/39527160/clang-tidy-how-to-suppress-warnings). This effectively acts as a workaround for those cases too.
-
Fixed "Cannot read property
ReplacementText
ofundefined
" errors in the output Clang-tidy didn't have suggested fixes in some cases, causing an exception being thrown. -
Added configuration option to explicitly set the location of compile_commands.json I nice setting for people who don't want to deal with
argv
. -
Ensured that only replacements with actual
ReplacementText
are registered This way, Quick Fix code action can actually select possible fixes more reliably. Empty redundant data also doesn't get displayed in diagnostics views. Comes with a performance improvement since we skipJSON.stringify
and sending empty data in most cases.
Some developer oriented stuff:
- Added a launch task for attaching a debugger to the language server Debugging the server process is now possible.
- Added a compound launch task that starts the debugging of both the client extension and the server For convenience.
I tried building and running this pr but I don't get any messages, not even errors. I want set custom compile_commands.json.
It works, seems like the problem happens when it crushes. Nothing will be display but after running the same command through cmd I get a segmantation fault. something like this
D:\Programming\bak\clang-tidy-linter>"C:\Program Files\LLVM\bin\clang-tidy.exe" d:\Programming\bak\neon_service\neon_service.cpp --export-fixes=- -header-filter=.* -p=d:\Programming\bak\neon_service\build\compile_commands.json -extra-arg=-isystemD:\Programming\boost_1_69_0 -extra-arg-before=-Weverything -extra-arg-before=-xc++ -extra-arg-before=-std=c++17 -extra-arg=-I./**
Fix conflicts with existing fix! The new insertion has the same insert location as an existing replacement.
New replacement: D:\Programming\boost_1_69_0\boost/exception/detail/exception_ptr.hpp: 9326:+0:"break; "
Existing replacement: D:\Programming\boost_1_69_0\boost/exception/detail/exception_ptr.hpp: 9326:+0:"BOOST_FALLTHROUGH; "
Assertion failed: false && "Fix conflicts with existing fix!", file C:\src\llvm_package_351376\llvm\tools\clang\tools\extra\clang-tidy\ClangTidyDiagnosticConsumer.cpp, line 87
0x00007FF6399A0F46 (0x0000844505F252FA 0x000000FBFA989BA0 0x0000000000000016 0x0000000000000000)
0x00007FFFE79DC39D (0x0000000000000001 0x00007FF600000000 0x0000000000000000 0x000000FBFA989B70), raise() + 0x1DD bytes(s)
0x00007FFFE79DD3A1 (0x0002000000000003 0x0000000000000003 0x00007FFFE7A3A590 0x00007FF63BE9344E), abort() + 0x31 bytes(s)
0x00007FFFE79DEDDE (0x000000000000000F 0x000002A8E2690000 0x00007FFFE79DEFF0 0x0000000000000057), _get_wpgmptr() + 0x196E bytes(s)
0x00007FFFE79DECD5 (0x0000000000000057 0x00007FF63BE9344E 0x000000FBFA98A340 0x000000FBFA98A570), _get_wpgmptr() + 0x1865 bytes(s)
0x00007FFFE79DF061 (0x000000FBFA98A148 0x00007FFFE79DEFF0 0x00007FF63BE92CE8 0x0000000000000006), _wassert() + 0x71 bytes(s)
0x00007FF639A3F9CA (0x00000001EAAF1C00 0x00007FF600000000 0x000002A8E26202A4 0x000002A8EAAF7200)
0x00007FF63A356D27 (0x000000FBFA98AF30 0x0000000000000012 0x000002A8EB6545D0 0x00007FFFE9D3FBA1)
0x00007FF639A3C5B3 (0x0000000000000000 0x0000000000000003 0x0000000000000030 0x000000FBFA98AFC9)
0x00007FF63B4E54BD (0x0000A004D0387E2B 0x000002A8E29C2140 0x000000FBFA98B3C0 0x0000A004D0387E3B)
0x00007FF63B4E9399 (0x0000000000000000 0x00007FFFE797C6B6 0x0000000000000002 0x00007FFFE9D407CD)
0x00007FF63A7D5C2C (0x000002A8E29FF760 0x01BD714800000000 0x000011C600000001 0x01BD721D000010B8)
0x00007FF63AE207DD (0x000000FBFA98B738 0x000002A8E2A51FC0 0x0000000001BD7FC4 0x000000FBFA98C280)
0x00007FF63A7D79FB (0xFFFFFFFFFFFFFFF8 0x000002A8EB7FFA90 0x000002A8EB7FFA90 0x000002A8EB7FFA90)
0x00007FF63A89FAF7 (0x0000A004D038695B 0x00007FF63A96F5C2 0x0000000000000001 0x000000FBFA98BEB8)
0x00007FF63A5E6BEF (0x00007FF63A5B4AB0 0x000002A8E2A51FC0 0x000002A8E29E30C0 0x00007FFFE9D3C44F)
0x00007FF63A55E218 (0x0000000000000000 0x00007FF63B1F4914 0x0000000000000000 0x00007FF63B1F4914)
0x00007FF63A5A80EB (0x000000FB01BD65EF 0x00007FF601BD65E7 0x000002A8E276B8A0 0x00007FF63B007074)
0x00007FF63A55D30D (0x000002A8E276BC30 0x00007FFFE79DEFF0 0x0000000000000001 0x00007FF63AFF5938)
0x00007FF63A55CC70 (0x000002A8EB7FCD78 0x000002A8E8755148 0x000002A8EB7F9760 0x000000FBFA98CB28)
0x00007FF63A55B5ED (0x000002A8E29E30C0 0x00007FF63B0065FC 0x0000A004D0381A2B 0x00007FF63B007150)
0x00007FF63A581B66 (0x000000FBFA98CE10 0x00007FF63A86737D 0x0000000001BD5B73 0x00007FF63B007150)
0x00007FF63A581646 (0x000002A8E276BC30 0x000002A8E276BC40 0x000002A8E276BC38 0x000000FBFA98D2D0)
0x00007FF63A5A2545 (0x000002A8EB7E7C38 0x000002A800000000 0x000002A8EB7E73D0 0x000000FBFA98D158)
0x00007FF63A55AA82 (0x000002A8E29E30C0 0x00007FF6399BF24A 0x0000A004D038005B 0x00007FF63B007150)
0x00007FF63A581B66 (0x000002A8E2A51F00 0x00007FF63B029F1D 0x000002A8E2A51F00 0x00007FF63B007150)
0x00007FF63A581646 (0x0000000000000020 0x000002A8E2620CC0 0x0000000000000000 0x0000000000000000)
0x00007FF63A5A2545 (0x0000000000000000 0x00007FF600000000 0x0000000000000000 0x0000000000000000)
0x00007FF63A55AA82 (0x0000000000000000 0x000002A8EB7E73D0 0x000002A8E269BC30 0x000002A8E26DC418)
0x00007FF63A55A275 (0x0000000000000002 0x00007FF63B4F5FB3 0x000002A8E277CD58 0x0000000000000000)
0x00007FF63A556366 (0x0000000000000000 0x000000000000000F 0x0000A00400000000 0x000002A8E2774320)
0x00007FF63A351DA0 (0x000002A8E26B2E00 0x00007FFFE9D3FBA1 0x000000FBFA98EB78 0x000002A8E2690000)
0x00007FF63A3997BF (0x00007FF63B556C80 0x0000000000000000 0x00007FF63B556C80 0x0000000000000000)
0x00007FF639DBA04C (0x000008F70000011C 0x000002A8E2776680 0x000000FBFA98DB70 0x000000FBFA98DB74)
0x00007FF639A328C3 (0x000000FBFA98E9F0 0x000002A8E271BAC0 0x0000000000000000 0x00007FFFE797C6B6)
0x00007FF639DB9E80 (0x0000000000000060 0x0000000000000000 0x000002A8E27671A0 0x0000000000000007)
0x00007FF639DB985C (0x0000000000000000 0x0000000000000009 0x0000000000000090 0x000000FBFA98E8B9)
0x00007FF639DBB7EF (0x0000000000000008 0x0000000000000002 0x0000000000000020 0x000000FBFA98EBF9)
0x00007FF639A2E60E (0x000000660000000B 0x0000006400000000 0x00007FFFE7A5B590 0x000002A8E269A7C0)
0x00007FF639712FFC (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
0x00007FF63B554110 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000)
0x00007FFFE9837BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
0x00007FFFE9D6CE71 (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)
I think you should create a notification or something similar, but I appreciate the good work, atleast now I have something I can use
Another bug I noticed, when you click on the file line in the output panel this is what I get.
The problem is also on the master branch.
The line number displayed is correct, but it seems the file path resolved is not correct.
Maybe it has something to do with that last \
I get this error when clicking the line
Unable to open 'mainwindow.h': Unable to read file (Unknown (FileSystemError): Error: UNKNOWN: unknown error, stat '\\d:\Programming\bak\WinToast\example\qt-gui-example\WinToastExample\mainwindow.h').
The most annoying bug is the cannot open file bug. I wish you would fix that to make it possible to go to the error line based on file number