Open ubaldot opened 8 months ago
I am using
clangd
with--clang-tidy
flag. I wish to display also the origin of the messages in the location list when I call:LspDiagShow.
At the moment, I have something something like the following:
src/main.cpp|49 col 15-18 warning| 128 is a magic number; consider replacing it with a named constant
whereas I would like to have something like the following:
src/main.cpp|49 col 15-18 warning| 128 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
How to do that?
Does clang-tidy include the readability-magic-numbers
tag in the output? Can you run clang-tidy from the command-line
on a test file and see whether it can be configured to display this information?
I also noticed that the help file has some bugs. Ti cite few:
- In 3. Usage the following commands are reported
:LspDiag current :LspDiag first :LspDiag here
but the actual commands are:
:LspDiagCurrent :LspDiagFirst :LspDiagHere
2 )
:LspDiagShow
is undocumented.
The :LspDiagShow
, :LspDiagCurrent
and other :LspDiagxxx
commands are deprecated. You should use the :LspDiag <arg>
command instead.
Does clang-tidy include the readability-magic-numbers tag in the output? Can you run clang-tidy from the command-line on a test file and see whether it can be configured to display this information?
Yes, it does, here is an example:
Error while processing /Users/ubaldot/Documents/arduino/freeRTOS/hello_world/src/main.cpp.
/Users/ubaldot/.platformio/packages/toolchain-atmelavr/bin/../lib/gcc/avr/7.3.0/../../../../avr/include/stdlib.h:48:10: error: 'stddef.h' file not found [clang-diagnostic-error]
#include <stddef.h>
^~~~~~~~~~
/Users/ubaldot/Documents/arduino/freeRTOS/hello_world/src/main.cpp:10:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead [modernize-deprecated-headers]
#include <stdlib.h>
^~~~~~~~~~
<cstdlib>
/Users/ubaldot/Documents/arduino/freeRTOS/hello_world/src/main.cpp:210:17: warning: 'atof' used to convert a string to a floating-point value, but function will not report conversion errors; consider using 'strtod' instead [cert-err34-c]
c = (float) atof((char*)Serial.read());
The :LspDiagShow, :LspDiagCurrent and other :LspDiagxxx commands are deprecated. You should use the :LspDiag
command instead.
Oh, that is interesting! I would have bet the other way around. Can they be removed then? It is fairly annoying when a user types :Lsp<tab>
deprecated stuff is shown (other than being confusing for those who are not aware of such a deprecation). :)
UPDATE: Interestingly, if I display the diagnostic in the status line (var lspOpts = {'showDiagOnStatusLine': true}
), then on the status line I have something like
[altera-unroll-loops] kernel performance can be improved by unrolling this loop ..
which is very handy as it shows where the diagnostic come from.
I am using
clangd
with--clang-tidy
flag. I wish to display also the origin of the messages in the location list when I call:LspDiagShow.
At the moment, I have something something like the following:src/main.cpp|49 col 15-18 warning| 128 is a magic number; consider replacing it with a named constant
whereas I would like to have something like the following:
src/main.cpp|49 col 15-18 warning| 128 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
How to do that?
I also noticed that the help file has some bugs. Ti cite few:
1) In 3. Usage the following commands are reported
but the actual commands are:
2 )
:LspDiagShow
is undocumented.