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

Feature Request: dynamically set "owner" for Watcher\background Tasks . #22242

Open
gerane opened this Issue Mar 8, 2017 · 0 comments

Comments

Projects
None yet
3 participants
@gerane

gerane commented Mar 8, 2017

When using a watcher task to run actions, sometimes you may only want to run an action against that single file instead of the entire project. The problem is that if you have existing matched problems, this will erase existing problem matches since they share the same "owner" property. This issue is referencing this problem #1397

For these types of tasks it would be beneficial to allow the "owner" property to be dynamically set via matcher. One way this could be achieved is via a Pattern Matcher. Using the tsc example from the Documentation it might look something like below.

{
    "version": "0.1.0",
    "command": "tsc",
    "suppressTaskName": true,
    "tasks": [
        {
            "taskName": "watch",
            "args": ["--watch"],
            "isBackground": true,
            "problemMatcher": {
                "fileLocation": "relative",
                "pattern": {
                    "regexp": "^([^\\s].*)\\((\\d+|\\,\\d+|\\d+,\\d+,\\d+,\\d+)\\):\\s+(error|warning|info)\\s+(TS\\d+)\\s*:\\s*(.*)$",
                    "file": 1,
                    "location": 2,
                    "severity": 3,
                    "code": 4,
                    "message": 5,
                    "owner": 1
                },
                "watching": {
                    "activeOnStart": true,
                    "beginsPattern": "^\\s*\\d{1,2}:\\d{1,2}:\\d{1,2}(?: AM| PM)? - File change detected\\. Starting incremental compilation\\.\\.\\.",
                    "endsPattern": "^\\s*\\d{1,2}:\\d{1,2}:\\d{1,2}(?: AM| PM)? - Compilation complete\\. Watching for file changes\\."
                }
            }
        }
    ]
}

This just sets the "owner" as the matched File and removed the "owner" property from "problemMatcher". This would make it where only problems matched to that file would be cleared when the watcher triggers again.

EDIT: Adding a few gifs showing an example use case.

Pester Unit Tests - Watcher Runs all Tests

watchproject

Pester Unit Tests - Watcher Runs only Tests for edited file

singlererun
.

@Tyriar Tyriar added the tasks label Mar 8, 2017

@dbaeumer dbaeumer added this to the Backlog milestone Nov 9, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment