vscode-clangd
vscode-clangd copied to clipboard
No replacement for $gcc problem matcher
In order to install vscode-clangd, it is necessary to disable or remove the Microsoft C++ extension. This removes $gcc from the list of available problem matchers, making it apparently impossible to see compilation errors from Clang/GCC in the Problems list, since vscode-clangd does not offer an obvious replacement.
While the vscode-clangd built-in error detection is very useful, it works on a file-by-file basis and is therefore not a complete substitute for parsing compiler output, since edits made to one file can break compilation of other files which are not currently open. Therefore I think it would be appropriate to provide a replacement for the $gcc problem matcher (perhaps it should be called $clangd or $clang) so that important functionality isn't lost when switching away from the Microsoft C++ extension.
Alternatively, if I'm just being blind and there is in fact a replacement for $gcc, feel free to close this issue (although I'd suggest the docs should make clear what the replacement is, since I can't see any mention of problem matchers).
System information
Clangd version (from the log, or clangd --version): 14.0.3
clangd extension version: v0.1.17
Operating system: Ubuntu 20.04
This sounds like a duplicate of #148, #158 and probably other issues. See https://github.com/clangd/vscode-clangd/issues/148#issuecomment-776965665 or https://github.com/clangd/vscode-clangd/issues/158#issuecomment-1064413770 for a way to keep $gcc problem matcher while using clangd.
That's helpful, thanks. I didn't realise that you can use the Microsoft C++ extension simultaneously with Intellisense disabled.
To be closed then.
Hmm, I do think there's a potential feature request here that's distinct from #158: whereas #158 is about having clangd provide diagnostics for every file in the project by parsing every file (or storing the diagnostics in the index, or something like that), this issue is about vscode-clangd surfacing diagnostics by parsing the build output, the way vscode-cpptools seems to do.
Yes, vscode-cpptools can compile, run, debug and whatnot in addition to code comprehension (aka IntelliSense). But I don't think there is much value in re-implementing features already supported by vscode-cpptools. In my opinion Microsoft's C/C++ extension is a monster that needs to be broken down into many smaller extensions, so that users can pick best extension for each job (code comprehension, building, debugging, problem matchers for compiler errors, etc.) mixing and matching Microsoft's with non-Microsoft's extensions.
In my opinion Microsoft's C/C++ extension is a monster that needs to be broken down into many smaller extensions, so that users can pick best extension for each job (code comprehension, building, debugging, problem matchers for compiler errors, etc.) mixing and matching Microsoft's with non-Microsoft's extensions.
I agree that would be nice, particularly if the individual extensions are open-source and listed on alternative extension marketplaces such as Open VSX as well.
Second that. Also worried about Telemetry, the C/C++ extension uses.

I would love to see a replacement for the $gcc problemmatcher as I use:
"problemMatcher": [
{
"base": "$gcc",
"fileLocation": ["relative", "${workspaceFolder}/build" ]
},
{
"owner": "linker0",
"severity": "error",
"fileLocation" : "absolute",
"pattern": {
"regexp": "((error): ld returned (-?\\d+) exit status)",
"message": 1,
"file" : 2
}
}, ....
Is there an option to also disable gdb from this ms extension? I only want the gcc problem matcher.
Is there an option to also disable gdb from this ms extension? I only want the gcc problem matcher.
You might have more luck getting an answer to that at https://github.com/microsoft/vscode-cpptools/issues/