vscode-clangd icon indicating copy to clipboard operation
vscode-clangd copied to clipboard

No replacement for $gcc problem matcher

Open matthewm-bfx opened this issue 3 years ago • 9 comments

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

matthewm-bfx avatar May 20 '22 13:05 matthewm-bfx

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.

i-ky avatar May 20 '22 13:05 i-ky

That's helpful, thanks. I didn't realise that you can use the Microsoft C++ extension simultaneously with Intellisense disabled.

matthewm-bfx avatar May 23 '22 11:05 matthewm-bfx

To be closed then.

Trass3r avatar Oct 07 '22 08:10 Trass3r

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.

HighCommander4 avatar Oct 07 '22 15:10 HighCommander4

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.

i-ky avatar Oct 07 '22 15:10 i-ky

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.

HighCommander4 avatar Oct 07 '22 21:10 HighCommander4

Second that. Also worried about Telemetry, the C/C++ extension uses.

Schermafbeelding 2023-03-01 om 13 01 41

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
            }
        }, ....

RolfNoot avatar Mar 01 '23 12:03 RolfNoot

Is there an option to also disable gdb from this ms extension? I only want the gcc problem matcher.

infn-ke avatar Nov 21 '23 19:11 infn-ke

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/

HighCommander4 avatar Nov 21 '23 22:11 HighCommander4