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

Test problem matcher file location auto detection. #74824

Closed
2 tasks done
alexr00 opened this issue Jun 4, 2019 · 0 comments
Closed
2 tasks done

Test problem matcher file location auto detection. #74824

alexr00 opened this issue Jun 4, 2019 · 0 comments

Comments

@alexr00
Copy link
Member

alexr00 commented Jun 4, 2019

Complexity: 2

Ref: #449

Open or create a folder and create a new folder Folder within it. In the new folder, create a test file.txt with a few lines of text.

Create a script file at the root of your open folder similar to this:

Windows (script.bat):

echo Problem at: \Folder\file.txt firstProblem:1
echo Problem at: C:\Users\alros\Documents\OpenFolder\Folder\file.txt secondProblem:1

Linux, macOS (script.sh, make it executable):

#!/bin/sh
echo Problem at: /folder/file.txt firstProblem:1
echo Problem at: /Users/joao/Work/fakeproject/folder/file.txt secondProblem:1

Create a task:

        {
            "label": "Make Problems",
            "type": "shell",
            "command": ".\\problems.bat",
            "problemMatcher": {
                "pattern": {
                    "regexp": "^Problem at: (.*) (.*):(\\d)$",
                    "file": 1,
                    "message": 2,
                    "location": 3
                },
                "fileLocation": "autoDetect"
            }
        }

Run the task and verify that two problems are created. Those two problems should both open the correct file when clicked on.
Try changing the "fileLocation" in the task to "absolute" and "relative" verify that only the expected problem correctly opens the file when clicked on.
Try removing the "location" from the problem matcher and instead having "kind": "file" and confirm that it still works and the expected files are clickable.
Try moving your Folder to another directory outside of the folder you have open. Change the "fileLocation" to ["autoDetect", <parent folder of Folder>]. Verify that the the problems are still clickable and go to the right file.

Note: You will accumulate a lot of problems doing this and they will not go away without a reload. This is expected since problems only clear if the exact same task is run and generates no problems.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants