microsoft / vscode-ts-tslint

TSLint integration for VS Code that runs linting as TypeScript plugin — ❗This extension has been DEPRECATED in favor of https://github.com/microsoft/vscode-typescript-tslint-plugin
36 stars 9 forks source link

Doesn't stack with external problem matcher (tasks.json + gulp-watch) #4

Closed rsxdalv closed 7 years ago

rsxdalv commented 7 years ago

I used tslint as my problemMatcher.owner, however, I am getting duplicate errors - one from [tslint] and one without a prefix.

This approach works with TSServer + gulp and with original tslint.

I suspect that I might've misconfigured something. Here's the relevant task of tasks.json (v2):

{
            "type": "gulp",
            "task": "tslint-service",
            "presentation": {
                "echo": true,
                "reveal": "silent",
                "focus": false,
                "panel": "shared"
            },
            "problemMatcher": [
                {
                    "owner": "tslint",
                    "applyTo": "closedDocuments",
                    "fileLocation": [
                        "absolute"
                    ],
                    "pattern": "$tslint5",
                    "background": {
                        "beginsPattern": {
                            "regexp": "\\[[\\d]{2}:[\\d]{2}:[\\d]{2}\\] Starting 'tsc-app-lint'\\.\\.\\."
                        },
                        "endsPattern": {
                            "regexp": "\\[[\\d]{2}:[\\d]{2}:[\\d]{2}\\] (Finished )?'tsc-app-lint' (errored )?after"
                        }
                    }
                }
            ]
        }
rsxdalv commented 7 years ago

Note: I'm using $tslint5 pattern from vscode-tslint (with tslint.enabled = false which is an option only for the old one)

rsxdalv commented 7 years ago

So I tried instead sharing the owner with "typescript" seeing how it is a plugin. And that works! However, that breaks my parallel setup for semantic linting and emit to unit tests, as my gulp is parallel and thus one "typescript" overrides the other.

rsxdalv commented 7 years ago

So, basically, I got them still working in parallel (as it's way harder to figure out how to share the language context, and there are hardly any docs on that and I don't have infinite budget) and still report problems in vscode. My setup is this:

  1. Combined gulp task, which has a common starting and end message for the 2 parallel tasks
  2. The two tasks.
  3. The gulp task is then used in tasks.json with problem matchers for both A and B (since I'm using predefined patterns and it's less messy / unstable), with both being owned by "typescript" and both using the common start and end messages I've defined in gulp.

And it just works. For now.

However, I believe the amount of work that was needed to research this and get it working is a pointer towards TSService allowing other problem owners than "typescript" in their plugin ecosystem. I'd imagine we'd have performance, lint, assistance, statistics, which could share the problem/warning structure. However, I'm unsure if this is a problem with tasks.json, vscode tsserver, or tsserver itself.