1

I'm using Make over SSH to invoke gcc. I have mirrored source files in my local computer for editing. After editing, it is synchronized with SFTP.

The problem is when the ProblemMatcher is set to $gcc, it returns full path of remote server, so it can't be matched with local files.

Local File: ~/foo/bar.c (= /home/user/foo/bar.c)

Remote File: ~/foo/bar.c (= /datavolume/foo/bar.c)

problemMatcher tries to find bar.c at /home/user/datavolume/foo/bar.c resulted in file not found

fileLocation has two options relative, absolute but neither resolves this issue.

With relative, I can only use .. for local location only. I can't trim remote location.

With absolute, I am not sure how to use it but it still can't find local location under WSL(Bash on Windows) directory.

absolute also fails.

"fileLocation":
[
  "absolute",
"C:\\Users\\user\\AppData\\Local\\Packages\\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\\LocalState\\rootfs\\home\\user\\foo"
]

Do you have any idea?

Thanks in advance.

Simson
  • 3,373
  • 2
  • 24
  • 38
CJ Lee
  • 34
  • 4
  • I have the same problem and filed an issue [here](https://github.com/Microsoft/vscode/issues/57015) – Bilow Aug 22 '18 at 14:48
  • Also see https://stackoverflow.com/a/74706156/836330 for a new `search` `fileLocation` option. – Mark Dec 06 '22 at 16:46

1 Answers1

1

You can use the regexp to subtract /datavolume/ and use relative like that:

"problemMatcher": {
    "owner": "cpp",
    "fileLocation": [
        "relative",
        "${workspaceFolder}"
    ],
    "pattern": {
        "regexp": "^\\/datavolume\\/(\\S+):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
        "file": 1,
        "line": 2,
        "column": 3,
        "severity": 4,
        "message": 5
    }
}
Leo chance
  • 11
  • 2