-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Theia integration for clangd-built-in "clang-tidy" linter #4580
Conversation
7948102
to
f12550c
Compare
hello @akosyakov do you know why gitpod status is red (I noticed it on some others PR ) ? |
4b1e619
to
9ddac67
Compare
@lmcbout: please update the commit message to reflect content of commit update: PR description as well please (can be the same) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me and works on my end.
@thegecko are you fine with the changes?
I suggested making the new clangTidy
CppStartParameters
optional as to not break any extenders.
A couple of things I have noticed, that I think are on the clangd/clang-tidy side:
None of these is a show-stopper, I think. |
One issue more on the Theia side: ATM we do not watch the But it seems we should at least monitor for the potential one in the project's root folder? Or maybe there would be a simple way to find and watch-for all/any such file in the project? |
I don't believe these changes affect us. We are only now considering clangd 8, let alone 9 :) |
That is correct. At the moment we are using release 7.0.0 and are waiting for the official release of clangd 8 for all 3 platforms (Linux, Mac, Windows). It is delayed but should be available soon. |
This seems like logic from
Linting sounds to be more source-specific rather than build-specific, unlike |
I have confirmed that the @lmcbout could you troubleshoot, maybe with the debugger or by enabling
|
In any case, for a first version, it could be good enough to document that changing the |
I prefer using |
It might not even be necessary to do a complete client restart, we have commands to |
Here's what the LSP spec says about
So, it sounds like the behaviour is up to the server, but they have documented the choice made by the VSCode server. Perhaps the behaviour you observed was because TypeScript is treated as the first category ("single file only" language)? |
Regarding this use case:
I think this can be handled in a different way. It looks like Theia (and probably language clients in general) "watch" files in the project, and send a Clangd, in turn, listens to this notification, and sends updated diagnostics -- but only if the file is open in the language client. (So, if you fix an error in vim while a file is open in Theia, the error automatically goes away in Theia.) So, perhaps this use case can be addressed by modifying clangd to always send updated diagnostics in response to I think the resulting user experience would be better, than if the server cleared the diagnostics on file-close. (Because this way, the user still sees that are problems in the project, even if the files that have the problems are closed.) |
IIUC, it would also cover the case where updating one file fixes an issue (or creates a new one) in another file which might not be opened anymore? If so it would be nice indeed. But that's on clangd, nothing that could be addressed here right? |
That's my understanding too: I tested and Theia (Theia LS client?) already sends
|
… used. Fixes issue #4579 This is a new linter for C/C++. There are two ways to initiate the linter: - From the preferences - Adding a new file located in the same folder of the files or a parent folder: .clang-tidy Signed-off-by: Jacques Bouthillier <jacques.bouthillier@ericsson.com>
Hi @HighCommander4 !
Thanks for this relevant reference. It sounds to me like It's my understanding that to get the full list of diagnostics for a C/C++ project, we should trigger a project build and parse the output, creating If
+1. |
After some further experimentation, it looks like I was mistaken about this. It appeared from the LSP traffic that the server was responding to the This explains why it was only sending updated diagnostics for files which are open in Theia. |
Based on the above observations, clangd does not currently do this. I agree it would be nice if it did. |
That's my understanding too.
I think that would make sense, and I believe this is actually in the works, based on this recent review request. |
To summarize the discussion of diagnostics for files which are closed, it seems to me we have the following options on the clangd side:
(1) is probably slightly easier to implement. (2) would, I think, lead to a better user experience as discussed above. We could also do (1) as an interim measure while we work on (2). |
I investigated this a bit. The handling of the suppression comments in clang-tidy is handled by a component called the Clangd uses its own
With standalone clang-tidy, this can be done using the However, the logic for applying this setting is again in the |
I filed some clangd issues for topics discussed above: |
Thanks @HighCommander4 for the feedback and opening those issues! |
Code tested with latest master and works fine, so merged it now. |
Signed-off-by: Jacques Bouthillier jacques.bouthillier@ericsson.com
Fix issue #4579
Add preferences to handle clang-tidy functionality when clangd v9+ is used.
This is a new linter for C/C++. There are two ways to initiate the linter: