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

Port: Don't assume rename text parses as IdentiferNameSyntax #3126

Merged

Conversation

dpoeschl
Copy link
Contributor

Port of #3069 to stabilization

Two commits:

Don't assume rename text parses as IdentiferNameSyntax
Fixes #1031

In both the C# and VB RenameRewriterLanguageServices, we were assuming
the new rename text would parse as an IdentifierNameSyntax, but if the
rename text is invalid it could parse as anything. For example, if the
user tries to rename "A" to "A.B", then it will parse as a
QualifiedNameSyntax. We now accommodate these cases.

Improve handling of invalid rename text in Inline Rename
This contains two small rename fixes related to invalid rename text:

  1. In OnTextBufferChanged, we were trying to ensure that the
    intersection of the tracked rename spans and buffer changes was a single
    span. However, when the rename text is invalid, there can be many buffer
    change spans that intersect a single tracked rename span, so we now use
    the least bounding span of the resulting intersection. We maintain the
    requirement that this bounding buffer change span intersect a single
    tracked rename span.
  2. When the rename text is invalid, we display it in the Rename
    Dashboard. This change adds the same truncation algorithm already
    applied to the original symbol name (which reduces it to 15 characters
    and appends a "..." if necessary).

David Poeschl added 2 commits May 27, 2015 14:38
Fixes dotnet#1031

In both the C# and VB RenameRewriterLanguageServices, we were assuming
the new rename text would parse as an IdentifierNameSyntax, but if the
rename text is invalid it could parse as anything. For example, if the
user tries to rename "A" to "A.B", then it will parse as a
QualifiedNameSyntax. We now accommodate these cases.
This contains two small rename fixes related to invalid rename text:
1. In OnTextBufferChanged, we were trying to ensure that the
intersection of the tracked rename spans and buffer changes was a single
span. However, when the rename text is invalid, there can be many buffer
change spans that intersect a single tracked rename span, so we now use
the least bounding span of the resulting intersection. We maintain the
requirement that this bounding buffer change span intersect a single
tracked rename span.
2. When the rename text is invalid, we display it in the Rename
Dashboard. This change adds the same truncation algorithm already
applied to the original symbol name (which reduces it to 15 characters
and appends a "..." if necessary).
dpoeschl added a commit that referenced this pull request May 27, 2015
…gets

Port: Don't assume rename text parses as IdentiferNameSyntax
@dpoeschl dpoeschl merged commit d3ccd87 into dotnet:stabilization May 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants