Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$tsc & $tsc-watch problem matchers unavailable in take over mode #1277

Closed
segevfiner opened this issue May 8, 2022 · 5 comments
Closed

$tsc & $tsc-watch problem matchers unavailable in take over mode #1277

segevfiner opened this issue May 8, 2022 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@segevfiner
Copy link
Contributor

As the $tsc & $tsc-watch problem matchers, and associated patterns, are contributed by the TypeScript and JavaScript extension that you need to disable to switch to take over mode, they become unavailable in take over mode, while they could still be useful while in it.

@huzaifahj
Copy link

+1 for this, this task in tasks.json won't work:

{
    "label": "typecheck",
    "type": "shell",
    "command": "npx tsc --noEmit",
    "problemMatcher": {
        "base": "$tsc-watch",
        "fileLocation": ["relative"]
    }
}

Have you found a workaround @segevfiner ? I can't find a problemMatcher.pattern that works for the tsc output

@huzaifahj
Copy link

Workaround:

{
  "problemMatcher": {
    "pattern": {
      "regexp": "^([^\\s].*)[\\(:](\\d+)[,:](\\d+)(?:\\):\\s+|\\s+-\\s+)(error|warning|info)\\s+TS(\\d+)\\s*:\\s*(.*)$",
      "file": 1,
      "line": 2,
      "column": 3,
      "severity": 4,
      "code": 5,
      "message": 6
    }
  }
}

@segevfiner
Copy link
Contributor Author

You also need the background patterns if you are using watch and isBackground. The originals are defined here https://github.com/microsoft/vscode/blob/a3a7f52f7ce697b3e6167cbdc47741d80f7b0867/extensions/typescript-language-features/package.json#L1396. This extension can contribute them by itself under a different name (e.g. "volar-tsc") or if possible and supported by VS Code, using the same name. I don't know what's the behavior when multiple extensions contribute the same problem matchers with the same name.

@johnsoncodehk johnsoncodehk added the enhancement New feature or request label May 28, 2022
@huzaifahj
Copy link

I'm still getting this error:

Unrecognized problem matcher. Is the extension that contributes this problem matcher installed?

@joezimjs
Copy link
Contributor

It looks like you STARTED to what needed to be done, but you were getting a "the pattern with the identifier $tsc doesn't exist" because you needed to also add the tsc problem pattern.

Here's a link to the original code from the TypeScript Language Features extension: https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/package.json#LL1494C1-L1540C7

I highlighted everything you need to copy. Like I said, you previously grabbed the problemMatchers portion, but you missed the problemPatterns portion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants