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

AbstractEditorInlineRenameService.SymbolRenameInfo.CanRenameAttributePrefix has buggy implementation #45895

Closed
mavasani opened this issue Jul 10, 2020 · 0 comments · Fixed by #67020
Labels
Area-IDE Bug IDE-CodeStyle Built-in analyzers, fixes, and refactorings
Milestone

Comments

@mavasani
Copy link
Contributor

See c54743b#diff-18aee645fd759fd2e86ce36bfe560751R98

Method has many unused parameters and last line always returns true:

private bool CanRenameAttributePrefix(Document document, TextSpan triggerSpan, string triggerText, CancellationToken cancellationToken)
{
// if this isn't an attribute, or it doesn't have the 'Attribute' suffix, then clearly
// we can't rename just the attribute prefix.
if (!this.IsRenamingAttributeTypeWithAttributeSuffix())
{
return false;
}
// Ok, the symbol is good. Now, make sure that the trigger text starts with the prefix
// of the attribute. If it does, then we can rename just the attribute prefix (otherwise
// we need to rename the entire attribute).
var nameWithoutAttribute = GetWithoutAttributeSuffix(this.RenameSymbol.Name);
return triggerText.StartsWith(triggerText); // TODO: Always true? What was it supposed to do?
}

@vatsalyaagrawal vatsalyaagrawal added this to the 16.8 milestone Jul 13, 2020
@mavasani mavasani added the IDE-CodeStyle Built-in analyzers, fixes, and refactorings label Jul 15, 2020
@jinujoseph jinujoseph modified the milestones: 16.8, Backlog Sep 10, 2020
sharwell added a commit to sharwell/roslyn that referenced this issue Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug IDE-CodeStyle Built-in analyzers, fixes, and refactorings
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants