VSCode tries to write problemMatcher for Intel compiler error messages, but it doesn't match

Asked 2 years ago, Updated 2 years ago, 77 views

The Remote Development Extension of VSCode provides access to Linux servers from VSCode on Windows 10.

There is an Intel compiler on the server that tries to read this error message in VSCode, but it cannot detect any of it.

There are currently two formats of error messages.

  • Type without error code:

     src/Data.cpp(163): error: class "Node" has no member "local_index_"
    
  • Type with error code:

     src/Data.cpp(82): error#308: member "Node::m_" (declared at line 56 of "include/Node.h") is accessible
    

Type without error code:

 src/Data.cpp(163): error: class "Node" has no member "local_index_"

Type with error code:

 src/Data.cpp(82): error#308: member "Node::m_" (declared at line 56 of "include/Node.h") is accessible

On the other hand, I try to write problemMatcher in the vscode task definition as follows, but it does not detect a single problem.What is wrong or missing?

The document is challenged by looking at Defining a problem matcher|Tasks in Visual Studio Code.

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            label: "C/C++: make all",
            "command": "make",
            "args": [
                "all",
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            },
            "problemMatcher": {
                "fileLocation": "relative",
                "pattern": {
                    "regexp": "^([^(]+)\\(\\d+\\):\\s+(warning|error)(#\\d+)?:\\s+(.*)$",
                    /* The following was also unsuccessful*/
                    /* US>"regexp": "^(.*)\\(\\d+\):\\s+(warning|error)(#\\d+)?:\\s+(.*)$",*/
                    /* "regexp": "^([-/._A-Za-z0-9]+)\\(\\d+\\):\\s+(warning|error)(#\\d+)?:\\s+(.*)$",*/
                    "file": 1,
                    "line"—2,
                    "severity"—3,
                    "message"—5
                }
            },
            "group": {
                "kind": "build",
                "isDefault"—true
            },
        }
    ]
}

regular-expression vscode

2022-09-30 14:55

1 Answers

Kunif's comment had the heart of the answer.

In what I was writing, I was trying to capture the number of rows enclosed in parentheses in the pattern \(\d+\)

like "(123)".

However, this does not allow you to take out the part of the number as a matching substring (what do you call it)?In order to be able to retrieve it, I had to write "\(\d+)\)" because I needed brackets to mark the substring.

I was concerned about the visible parentheses, but I forgot about the invisible parentheses.

Thanks to you, I can pass by now!


2022-09-30 14:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.