-
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
Make problems ranges in problems view in sync with editor squiggles #103953
Comments
I think for this discussion it would help to be very precise about terms. Let's start with a crisp explanation:
@pkruk2 you said (quoted by @sandy081) "not updating diagnostics is worse than updating them". I worry these words are ambiguous:
@pkruk2 and @sandy081 I'd love if you could restate your positions in a way that avoids these ambiguities. Here's my position:
|
@ljw1004 I meant/agree with following: "it's better for the squiggle to remain under the same word or piece of text". But I'm not sure about next two bullet points ("range reported in the problems pane shouldn't change"). I'd prefer if it was also updated (have same range as squiggle - "range after edits have applied"). The diagnostic could be marked as "dirty" somehow to signify it's not original range and might be not precise/correct. If user adds few lines at the begining of the file, and there's a diagnostic at the end of file, why would range in Problems Pane still point to the old location? I don't see how it is better for the user. |
Just as a user who is tracking this issue with a particular plugin which only updates problems on save (due to current limitations with the process it's calling out to):
|
I don't think there's any way to fully implement what you describe. Here's the problem scenario:
In this case there's no way for VSCode to know where the new squiggle should be. It can't very well do a "diff" and use heuristics to tell how the squiggle has moved because they'll work sometimes and fail sometimes and lead to unpredictable user experience. Also, I think it would be slow if after a pull, VSCode got the file-change notification and immediately had to do a heuristic diff on say 1000 files that have problemMatcher-scraped problems just to see if any of them had changed. So what should we do? We have to strike a balance between being useful to the user, and having simple+predictable rules. I think the (full product) Visual Studio is the most elegant and simple. It treats the ranges in the problemPane as sacrosanct - views them solely as a manifestation of what was scraped from the output. If you have a file open and you edit it, then it can track where the squiggles have moved. But once you close a file then it forgets them. In specific answer to your questions, (Q1) why would the range in ProblemsPane still point to the old location? - because the user understands the simple rule that the ProblemsPane is a direct literal scrape of the tool output with no magic involved and they like this simple predictability. (Q2) how is it better for the user? - because having a simple predictable rule for what appears in the problemsPane is important, and this delivers it, and the user doesn't get confused about why sometimes it updates and sometimes it doesn't. All that said, I do understand and sympathize with your view too @pkruk2. You think that it's good for squiggle location and problemPane location to agree, and you think they can be made to agree in most common scenarios, and the ones where they won't agree are the ones where the squiggles would no longer be highlighting the correct word anyway, and your solution would make it work fine for users even if they close and then re-open a file which they've modified. That would also be fine for me. |
There are two things: the model and the view. The former is driven by extensions and the latter is us showing diagnostics, e.g as squiggles, in the panel, etc. We should not temper with the model, it's the source of truth and owned by extensions. The views however can be graceful.
I actually don't know if or why this changed. Adding @sandy081 @alexdima for more insights but afaik squiggles in the editor used to be sticky. |
@jrieken Good question
Yes this is used to be sticky and I changed this while fixing the bug - #90890 because it caused inconsistencies in UI that problems view (and also goto widget I assume) is pointing to wrong location than squiggles as latter are not getting updated. |
I'd say that made it worst ;-) The editor moving squiggles based on its heuristics is something good IMO and other UI pieces could treat that as intermediate source of truth. The error markers that appear in the outline do this - e.g they use the |
I acknowledge @ljw1004 points:
But at the same time a very common scenario is:
In my opinion updating both squiggles and diagnostics makes most sense in this case and is most user friendly.
Yes, I agree. I think previously squiggles were update if:
In the "interactive user edit case" I think user expects that diagnostic location is updated - be it squiggles, or those in Problems view. |
@jrieken makes sense to me.
|
Has this been fixed? It seems to be working now for squiggles from Edit: nevermind, I seem to have gotten confused. |
@sandy081 just checking that this is still an outstanding work item? An external contributor could take a swing at it if it's fairly simple (reversing the commit mentioned above?) |
It is still outstanding and it is not just reverting the commit. The commit I mentioned was already reverted and the remaining part is following
This is not trivial and may not be a candidate for contribution. Thanks |
We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider. If you wonder what we are up to, please see our roadmap and issue reporting guidelines. Thanks for your understanding, and happy coding! |
This doesn't seem like it should be auto closed? |
Currently VS Code does not update diagnostics during edits and rely on extensions owning those diagnostics to update them.
From @pkruk2
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.
Related: #102724 #90890
The text was updated successfully, but these errors were encountered: