Skip to content

Conversation

@jasonmalinowski
Copy link
Member

@jasonmalinowski jasonmalinowski commented Sep 3, 2021

In afd8743, I prevented us from trying to rename the definition locations of a symbol that may have appeared in a generated file; that could happen in partial file cases or some cascading cases. But I missed the much simpler case: just having a good old fashioned reference in a generated file. This fixes that oversight.

Fixes https://developercommunity.visualstudio.com/t/Renaming-fails-for-type-referenced-in-a-/1389855 and internal tracking AB#1393227.

In afd8743, I prevented us from
trying to rename the definition locations of a symbol that may have
appeared in a generated file; that could happen in partial file cases
or some cascading cases. But I missed the much simpler case: just
having a good old fashioned reference in a generated file. This fixes
that oversight.

Fixes https://developercommunity.visualstudio.com/t/Renaming-fails-for-type-referenced-in-a-/1389855
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner September 3, 2021 23:53
@ghost ghost added the Area-IDE label Sep 3, 2021
{
// We won't try to update references in source generated files; we'll assume the generator will rerun
// and produce an updated document with the new name.
if (location.Document is SourceGeneratedDocument)
Copy link
Member Author

Choose a reason for hiding this comment

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

We could update the underlying FAR engine to avoid even doing the search, but that's a fairly invasive change, and writing a custom collector from the streaming results would also work but is a bunch of extra work. Unless we're seeing performance issues, best to keep the fix simple.

Copy link
Contributor

@ryzngard ryzngard left a comment

Choose a reason for hiding this comment

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

😅 :shipit:

@jasonmalinowski jasonmalinowski self-assigned this Sep 4, 2021
@jasonmalinowski jasonmalinowski merged commit 2fb8106 into dotnet:main Sep 7, 2021
@ghost ghost added this to the Next milestone Sep 7, 2021
@jasonmalinowski jasonmalinowski deleted the allow-rename-with-references-in-generated-code branch September 9, 2021 00:16
@Cosifne Cosifne modified the milestones: Next, 17.0.P5 Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants