-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
problemMatcher squiggles should track edits #102724
Comments
This has been discussed here If you want the problem to update, you should run a a background task that uses a watch problem matcher. Otherwise, the problems will not update. |
@alexr00 Thanks for the suggestion to use background-task and watch-problem-matcher. But I don't think that will work in two very typical scenarios: (1) if the task has a side-effect, e.g. "publish to azure", so you can't have it run in watch mode, (2) if the task is long-running e.g. 90s - imagine it produces three errors in a file, and you addressed the first one, and now you have to wait an unpredictable length of time before you can get the squiggles you need to work on the next. The Roslyn project for instance takes ~5mins to build. Developers commonly kick off a build, spend 20 minutes fixing issues, and only then do they deliberately and intentionally kick off a next build. To recap from #90890
I understand the motive behind @sandy081's fix: the motive is that the task produced some output, and we scraped that output, and the output is sacrosanct and should never be edited, and it's weird for squiggles to disagree with what's shown in the problems pane, so therefore the squiggles shouldn't move in response to edits. But although that conclusion is intellectually self-consistent, I can't imagine any scenarios or user-experiences where that behavior is actually helpful! So I think it's valuable to figure out a different answer. Indeed, I suspect the pre-April behavior was easier on users than the current. Just to note: the full Visual Studio product has the pre-April behavior, where (1) it populates its Problems pane with the output of its problemMatcher but they remain unchanged, (2) however, squiggle locations do move in response to edits. Here's a video: https://imgur.com/a/fYZsAEI. [note1: in visual studio the squiggles from a build task are actually invisible, so they only way to tell where they are is by double-clicking on the error in the problems pane]. [note2: in visual studio the live-tracking of squiggles doesn't persist after a file has been closed, and indeed it can't]. Further context: I'd chatted with @dbaeumer two years ago about how we should reconcile the problems that come out of LSP, with those that come out of a built task. That's because not all LSPs can be as fast as typescript, and many LSPs only produce problems for the currently-open-file rather than for all files. The way Visual Studio resolves this is that the problemMatcher and build task are used to produce whole-project "blue" squiggles, and the Visual Studio LSPs only produce single-file "red" squiggles, and whenever you click on a blue error in the problem pane then the blue error gets silently and automatically surplanted by the red squiggle once the file is open. With the current VSCode behavior, I guess my only hope is (1) use a problem-matcher, (2) write my own extension which moves problems upon text edits. I don't know if that's possible. I'll look. For the VisualStudio repro: (1) create a new C# console application, (2) create a file "moose.bat" with contents
and (3) edit ConsoleApp1.csproj to include these lines immediately before the final closing tag:
I also uploaded a complete self-contained VS project with the repro: VSbuildtask.zip |
See also #74524 |
@alexr00 That would inconsistencies across workbench. Diagnostics will not represent same range. Right fix would be is to let that source/owner update diagnostics. |
I'm not sure I understand your comment - what are the disadvantages / problems of updating the diagnostics (maybe optionally/as opt-in for extension)? Could you give an example? |
I meant Diagnostics should be updated by their owners when document content changes, for eg., TS extension shall update TS diagnostics. VS Code cannot update them because it does not know the semantics and it was never updating them. Previously Squiggles were not updated when content changed which caused they inconsistencies between them and diagnostics as latter were not updated. |
In case extension can't simply re-generate diagnostics (for example due to side-effects or long generation time):
My argument is that in this case not updating diagnostics is worse than updating them. |
I filed a separate issue #103953 for discussion |
I've written a problemMatcher. It works great and produces problems (error squiggles) in the document.
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:
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.
The text was updated successfully, but these errors were encountered: