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

Wrapped Lines Break Custom Problem Matcher #6851

Open
LethiferousMoose opened this issue Nov 21, 2023 · 2 comments
Open

Wrapped Lines Break Custom Problem Matcher #6851

LethiferousMoose opened this issue Nov 21, 2023 · 2 comments
Assignees
Labels
doc-bug out of date, inaccurate, confusing content help wanted Issues identified as good community contribution opportunities

Comments

@LethiferousMoose
Copy link

LethiferousMoose commented Nov 21, 2023

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.84.2
  • OS Version: Windows 10

I saw this issue crop up on your GitHub for other problem matchers, but tbh it was super unclear if this was supposed to be fixed or not. microsoft/vscode#32042 makes it sound fixed, but then we have microsoft/vscode#152634 which sounds very similar.

Steps to Reproduce:

  1. Create a dummy script the outputs long lines (like replicating the output from running tests with dotnet test)
  2. Associate that script to a task.
  3. Create a problem matcher that attempts to get the error message, fully qualified test name, and line number.
  4. Problem matcher consistently fails when the terminal is not scaled large enough for the fully qualified class test (method) name to fit on one line, but seems to work "most" of the time when the terminal large enough and does not wrap the lines.

Sample Task

{
    "windows": {
        "options": {
            "shell": {
                "executable": "pwsh.exe",
                "args": [
                    "-NoProfile",
                    "-ExecutionPolicy",
                    "Bypass",
                    "-Command"
                ]
            }
        }
    },
    "label": "Test MultiLine",
    "type": "shell",
    "command": "${workspaceFolder}/TestMultiLine.ps1",
    "group": {
        "kind": "test",
        "isDefault": true
    },
    "problemMatcher": {
        "fileLocation": ["absolute"],
        "severity": "error",
        "pattern": [
            {
                "regexp": "^\\s+(Assert.*)$",
                "message": 1
            },
            {
                "regexp": "^\\s+Stack Trace:$"
            },
            {
                "regexp": "^\\s+at\\s+(.*)\\s+in\\s+(.*):line\\s+(\\d+)\\s*$",
                "file": 2,
                "line": 3
            }
        ]
    }
}

TestMultiLine.ps1

Write-Output '  Failed MethodNameThatSeemsToGoOnForever [6 ms]'
Write-Output '  Error Message:'
Write-Output '   Assert.ThrowsException failed. No exception thrown. ThisExceptionHappensSometimes() exception was expected.'
Write-Output '  Stack Trace:'
Write-Output '     at Hello.World.This.IsAVeryLongClassNameWithAnEquallyLong.MethodNameThatSeemsToGoOnForever() in C:\Also\The Path To The File Is Also\Very Large\Which\Means.This\Will\LikelyWrapForMostPeople.cs:line 110'

Footnote

I spent like 6 hours trying to understand what the heck was going on, so some clarity on this would be wonderful.

As a side note the documentation on multi-line problem matcher patterns is super vague, from I've been able to discern mostly by trial, error, and searching VS Code GitHub. Is that when you have a multi-line pattern, you seemingly need to match every line in between, even if you do not care about those lines.

As far as I can tell nothing mentions that explicitly and the example in the docs Defining a multiline problem matcher "works" because the multi-lines they are matching are immediately after the first line they are matching. The docs do say This way you define a pattern per each line you want to match, but that's also not super obvious because I DON'T want to match them, I don't care about those lines. If someone could also confirm this that would be nice or I can log a documentation issue to give some better clarity on this so other people don't spend their entire night playing with regexes that work and consistently don't work in VS Code problem matchers....

@meganrogge
Copy link
Contributor

Thanks for the information. I'm going to close this because as you said, seems like a duplicate of microsoft/vscode#152634

@meganrogge meganrogge added the *duplicate Issue identified as a duplicate of another issue(s) label Nov 21, 2023
@LethiferousMoose
Copy link
Author

@meganrogge Should I log an issue around the documentation not being very clear on the multi-line errors or what is the best way to have that updated with a better example and/or explanation?

@meganrogge meganrogge reopened this Nov 22, 2023
@meganrogge meganrogge removed the *duplicate Issue identified as a duplicate of another issue(s) label Nov 22, 2023
@meganrogge meganrogge transferred this issue from microsoft/vscode Nov 22, 2023
@meganrogge meganrogge added help wanted Issues identified as good community contribution opportunities doc-bug out of date, inaccurate, confusing content labels Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-bug out of date, inaccurate, confusing content help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

No branches or pull requests

2 participants