How do I configure multiple pattern matchers for a VS Code Task?

48 Views Asked by At

I'm trying to setup a Visual Studio Code CMake / Ninja project using GNU_ARM_10_2020-q4-major. With the base problem matcher set to "$gcc" it misses a lot messages and I can't figure out multiple patterns.

The following extract from the build output has two messages (saved to test.txt):

C:/Repos/ProjectN/ProjectN/Dave/Generated/ETH_LWIP/lwip/port/sys_arch.c: In function 'sys_sem_signal':
C:/Repos/ProjectN/ProjectN/Dave/Generated/ETH_LWIP/lwip/port/sys_arch.c:550:14: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
  550 |   osStatus_t ret;
      |              ^~~
c:/gnu_arm_10_2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: c:\repos\ProjectN\gfx-src\include/gfx_drawing.hpp:3203: undefined reference to `gfx::font::operator[](int) const'

The problem matcher (for testing) is set to:

        {
            "label": "build",
            "type": "shell",
            "command": "cmd /C type test.txt",
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": {
                "fileLocation": "absolute",
                "severity": "error",
                "pattern": [
                    {
                        "regexp": "(.*):(\\d+):(\\d+): (.*): (.*)",
                        "file": 1,
                        "line": 2,
                        "column": 3,
                        "severity": 4,
                        "message": 5
                    },
                    {
                        "regexp": "(.*ld\\.exe): (.*):(\\d+): (.*)",
                        "file": 2,
                        "line": 3,
                        "message": 4
                    }
                ]
            },
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }

The above does not match any lines.

If I remove the first pattern, the seconds works and I see an item in the Problems view. If I remove the second pattern, the first works and again I see an item in the Problems view.

Does anyone know what I'm doing wrong here?

0

There are 0 best solutions below