Skip to content

problemMatcher squiggles should track edits #102724

@ljw1004

Description

@ljw1004

I've written a problemMatcher. It works great and produces problems (error squiggles) in the document.

  1. Now I edit the document to insert a newline above the squiggle.
    • I would like the squiggle to automatically shift down one line.
    • (instead, the squiggle currently stays at the exact same file+line+column).
  2. Now I edit the document to completely delete the text that contained the squiggle.
    • I would like the squiggle to automatically be deleted.
    • (instead, the squiggle currently stays at the exact same file+line+column).
  3. If I edit the document to delete part of the text range of the squiggle, I'd like the squiggle's range to be modified accordingly.

Here's a video which shows how squiggles aren't currently auto-moved by file edits.
https://imgur.com/a/yWfq97Z

REPRO

Create a folder with three files:

[a.txt]
hello
there
world

[a.ts]
const x = 15;
f(x);

[.vscode/tasks.json]
{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
  "tasks": [
    {
      "label": "ts problemMatcher",
      "type": "shell",
      "command": "printf 'a.ts'; echo ':2:1 - error TS2304: my walk has become rather sillier recently'",
      "group": "build",
      "problemMatcher": "$tsc"
    },
    {
      "label": "absolute problemMatcher at line 2",
      "type": "shell",
      "command": "echo 'e /Users/ljw/code/a.txt:2:1: warning: absolute warning in /Users/ljw/code/a.txt:2'",
      "group": "build",
      "problemMatcher": {
        "owner": "moose",
        "fileLocation": "absolute",
        "pattern": {
          "regexp": "^e (.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
          "file": 1,
          "line": 2,
          "column": 3,
          "severity": 4,
          "message": 5
        }
      }
    },
    {
      "label": "relative problemMatcher at line 3",
      "type": "shell",
      "command": "echo 'e a.txt:3:3: error: relative warning in {workspace}/a.txt:3'",
      "group": "build",
      "problemMatcher": {
        "owner": "moose",
        "fileLocation": ["relative", "${workspaceFolder}"],
        "pattern": {
          "regexp": "^e (.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
          "file": 1,
          "line": 2,
          "column": 3,
          "severity": 4,
          "message": 5
        }
      }
    }
  ]
}
  1. Run the "relative problemMatcher" build task.
  2. Observe that it produces a problem on line 3 of a.txt.
  3. Click on that problem to go to a.txt.
  4. Insert a newline at the start of the file

WHAT I EXPECT: the problem should be shifted down one line, tracking the text
WHAT I GET: the problem remains on line 3, new on a different span of text

For the repro, I also did it with an "absolute problemMatcher" and "$tsc" problem matcher (this one's easiest to see if you disable the built-in typescript language extension). They all have the same phenomenon: problems fail to track edits to the file.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions