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

Improve Find All Refs results #11279

Merged
merged 1 commit into from
Dec 10, 2024
Merged

Conversation

davidwengier
Copy link
Contributor

Fixes #11278
Fixes #4611

We lose classification, but get more context. Worthy trade off I think

Before:
image

After:
image

@davidwengier davidwengier requested a review from a team as a code owner December 9, 2024 00:34
Copy link
Member

@DustinCampbell DustinCampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change seems fine, but it feels like this deserves more explanation. From the change, it looks like we no longer run code to remove artifacts like "__o = ". Isn't that a significant regression? I'd like to see a bit more justification of why the right tradeoff is to trade one bug for another.

@davidwengier
Copy link
Contributor Author

it looks like we no longer run code to remove artifacts like "__o = ". Isn't that a significant regression?

Excellent question, and definitely a valid concern the existing tests did nothing to validate.

If we take the screenshots I posted in the original PR description though, what was actually happening was that Roslyn was returning us "Found a reference to RequestID on line 200, in text that says __o = RequestID". We would remap the line number, and strip the "__o = ", and present it to the user as per the screenshot, just saying "RequestID".

What we now do instead is take the line of text from the Razor file itself, therefore there can't possibly be any __o = in the result (unless the user typed it 😛) and the tests now verify the text being returned matches the line in the Razor file, so it can't sneak in as a regression.

In the non-cohosing test, this line would have said __o = S without the removal, but now is validated to say <p>@S</p>. Similarly in cohosting this line would have done the same, but MyName instead of S.

// <SurveyPrompt Title="Blah" />
//
// A FAR for the Title property will return just the word "Title" in the Text of the reference item, which does not
// help the user reason about the result. For such cases, its better to return the text from the Razor file, even
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does classification happen in FAR? Can we provide the classification?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was just logging an issue for that :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DustinCampbell
Copy link
Member

Thanks for the explanation! Another question: there don't seem to be any tests that demonstrate the new behavior -- unclassified or not. Should there be a test that validates the result in your scrreenshot above?

@davidwengier
Copy link
Contributor Author

No new tests, no, but new validation for the existing tests was added to ensure the Text of the reference item matches the line of text from the test input.

@davidwengier
Copy link
Contributor Author

eg, if I comment out the fix and run an existing cohosting test I get this failure:

image

@davidwengier davidwengier merged commit fd99322 into dotnet:main Dec 10, 2024
12 checks passed
@davidwengier davidwengier deleted the BetterFARResults branch December 10, 2024 23:50
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Dec 10, 2024
davidwengier added a commit that referenced this pull request Dec 12, 2024
Update integration test base lines to match the FAR behavior introduced
with #11279
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants