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

fixed "applyTo" property in problem matcher for task output #7418

Merged
merged 1 commit into from
Mar 25, 2020

Conversation

elaihau
Copy link
Contributor

@elaihau elaihau commented Mar 25, 2020

Signed-off-by: Liang Huang [email protected]

How to test

  1. Open a workspace, define a task that produces warnings / errors, and add a problem mactcher that parses the warnings / errors.
    Mine is
    {
        "type": "npm",
        "script": "lintAAB",
        "problemMatcher": [
            {
                "owner": "eslint97",
                "source": "eslint97",
                "applyTo": "closedDocuments",
                "fileLocation": "absolute",
                "pattern": [
                {
                    "regexp": "^([^\\s].*)$",
                    "kind": "location",
                    "file": 1
                },
                {
                    "regexp": "^\\s+(\\d+):(\\d+)\\s+(error|warning|info)\\s+(.+?)(?:\\s\\s+(.*))?$",
                    "line": 1,
                    "column": 2,
                    "severity": 3,
                    "message": 4,
                    "code": 5,
                    "loop": true
                }
                ]
          }
        ]
    }

and the npm lintAAB is defined in package.json as follows

  "scripts": {
    "lintAAB": "eslint ."
  }
  1. Close all docuements, and run the task defined in Step 1. We should be able to see all warnings & errors are displayed in the problems view.

  2. Open one document associated with the problem markers added in Step 2. Run the task again. Once the task finishes, markers displayed in Step 2, except for those associated with the opened file, should persist. Markers associated with the opened file should not be displayed.

Please note, in this step, you could possibly still see markers associated with the opened file in the problem view, as other they could be added by other contributors.

  1. Close all documents, update applyTo of the problem matcher to "openDocuments". Run the task again. Once the task finishes, markers displayed in Step 2 should not show up, because we only want errors & warnings from opened documents to be reported.

  2. When applyTo is "allDocuments", all parsed warnings and errors markers should be displayed in the problems view.

Peek 2020-03-24 19-48

Review checklist

@elaihau elaihau force-pushed the Liang/matcherApplyTo branch from ee92f5f to 8d5de97 Compare March 25, 2020 00:14
@elaihau elaihau added the tasks issues related to the task system label Mar 25, 2020
@elaihau elaihau changed the title fixed "applyTo" property in task problem matcher fixed "applyTo" property in problem matcher for task output Mar 25, 2020
Copy link
Member

@akosyakov akosyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please get rid of caches and use MonacoWorkpace as a single source of the document state

packages/task/src/browser/task-service.ts Outdated Show resolved Hide resolved
packages/task/src/browser/task-service.ts Outdated Show resolved Hide resolved
@elaihau elaihau force-pushed the Liang/matcherApplyTo branch 3 times, most recently from b30cd22 to 2e3e202 Compare March 25, 2020 12:25
- With this change, "applyTo" can be used as a property to control if a problem reported on a text document is applied only to open, closed or all documents.
- fixed #7396

Signed-off-by: Liang Huang <[email protected]>
@elaihau elaihau force-pushed the Liang/matcherApplyTo branch from 2e3e202 to 34713b6 Compare March 25, 2020 12:34
@akosyakov
Copy link
Member

code changes looks good, could someone please test it?

Copy link
Member

@vince-fugnitto vince-fugnitto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me 👍
I verified it using a small eslint workspace: https://github.com/vince-fugnitto/eslint-ws,
and can see the generated problem-markers based on the applyTo property present.

@elaihau
Copy link
Contributor Author

elaihau commented Mar 25, 2020

Thank you for your time @vince-fugnitto !

@elaihau elaihau merged commit 913134a into master Mar 25, 2020
@elaihau elaihau deleted the Liang/matcherApplyTo branch March 25, 2020 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tasks issues related to the task system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"applyTo" property in taskConfig.problemMatcher doesn't work properly
3 participants