mhutch / MonoDevelop.MSBuildEditor

Improved MSBuild editing support
Other
228 stars 26 forks source link

Sometimes warning span the entire document for no reason #230

Open mhutch opened 6 months ago

mhutch commented 6 months ago

image

QianMoXi commented 3 months ago

I have the same problem.

QianMoXi commented 3 months ago

Adding to the information I debugged

Steps to reproduce:

  1. Open a csproj file with Warning or Error
  2. Close this file
  3. Reopen it

Possible causes:

In the following code, the snapshot is a document belonging to step 1, but the new document is already from step 3, so the SnapshotSpan it returns represents the entire document

https://github.com/mhutch/MonoDevelop.MSBuildEditor/blob/513fcf2897fa561a8e4ca40d5733b9c7f22d405c/MonoDevelop.MSBuild.Editor/MSBuildValidationTagger.cs#L73

I can't decide if this is right or what to do to fix it because I haven't written any extensions.