public TextSpan?GetConflictEditSpan( InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken ) { var position = triggerText.LastIndexOf(replacementText, StringComparison.Ordinal); if (_isRenamingAttributePrefix) { // We're only renaming the attribute prefix part. We want to adjust the span of // the reference we've found to only update the prefix portion. var index = triggerText.LastIndexOf( replacementText + AttributeSuffix, StringComparison.Ordinal ); position = index >= 0 ? index : position; } if (position < 0) { return(null); } return(new TextSpan(location.TextSpan.Start + position, replacementText.Length)); }
/// <summary> /// Given a span of text, we need to return the subspan that is editable and /// contains the current replacementText. /// /// These cases are currently handled: /// - Escaped identifiers [goo] => goo /// - Type suffixes in VB goo$ => goo /// - Qualified names from complexification A.goo => goo /// - Optional Attribute suffixes XAttribute => X /// Careful here: XAttribute => XAttribute if renamesymbol is XAttributeAttribute /// - Compiler-generated EventHandler suffix XEventHandler => X /// - Compiler-generated get_ and set_ prefixes get_X => X /// </summary> public TextSpan GetReferenceEditSpan( InlineRenameLocation location, string triggerText, CancellationToken cancellationToken ) { var searchName = this.RenameSymbol.Name; if (_isRenamingAttributePrefix) { // We're only renaming the attribute prefix part. We want to adjust the span of // the reference we've found to only update the prefix portion. searchName = GetWithoutAttributeSuffix(this.RenameSymbol.Name); } var index = triggerText.LastIndexOf(searchName, StringComparison.Ordinal); if (index < 0) { // Couldn't even find the search text at this reference location. This might happen // if the user used things like unicode escapes. IN that case, we'll have to rename // the entire identifier. return(location.TextSpan); } return(new TextSpan(location.TextSpan.Start + index, searchName.Length)); }
public TextSpan GetReferenceEditSpan( InlineRenameLocation location, string triggerText, CancellationToken cancellationToken ) { return(location.TextSpan); }
public TextSpan?GetConflictEditSpan( InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken ) { return(location.TextSpan); }
public TextSpan GetReferenceEditSpan( InlineRenameLocation location, string triggerText, CancellationToken cancellationToken ) { return(_info.GetReferenceEditSpan( new FSharpInlineRenameLocation(location.Document, location.TextSpan), cancellationToken )); }
public TextSpan GetReferenceEditSpan( InlineRenameLocation location, string triggerText, CancellationToken cancellationToken ) { return(_info.GetReferenceEditSpan( new VSTypeScriptInlineRenameLocationWrapper( new InlineRenameLocation(location.Document, location.TextSpan) ), cancellationToken )); }
public TextSpan?GetConflictEditSpan( InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken ) { return(_info.GetConflictEditSpan( new FSharpInlineRenameLocation(location.Document, location.TextSpan), replacementText, cancellationToken )); }
public TextSpan?GetConflictEditSpan(InlineRenameLocation location, string replacementText, CancellationToken cancellationToken) => null;
public TextSpan GetReferenceEditSpan(InlineRenameLocation location, CancellationToken cancellationToken) { return(default(TextSpan)); }
public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string replacementText, CancellationToken cancellationToken) { var spanText = GetSpanText(location.Document, location.TextSpan, cancellationToken); var position = spanText.LastIndexOf(replacementText, StringComparison.Ordinal); if (_isRenamingAttributePrefix) { // We're only renaming the attribute prefix part. We want to adjust the span of // the reference we've found to only update the prefix portion. var index = spanText.LastIndexOf(replacementText + AttributeSuffix, StringComparison.Ordinal); position = index >= 0 ? index : position; } if (position < 0) { return null; } return new TextSpan(location.TextSpan.Start + position, replacementText.Length); }
public TextSpan GetReferenceEditSpan(InlineRenameLocation location, CancellationToken cancellationToken) => default;
TextSpan IInlineRenameInfo.GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken) => GetReferenceEditSpan(new FSharpInlineRenameLocation(location.Document, location.TextSpan), cancellationToken);
/// <summary> /// Given a span of text, we need to return the subspan that is editable and /// contains the current replacementText. /// /// These cases are currently handled: /// - Escaped identifiers [foo] => foo /// - Type suffixes in VB foo$ => foo /// - Qualified names from complexification A.foo => foo /// - Optional Attribute suffixes XAttribute => X /// Careful here: XAttribute => XAttribute if renamesymbol is XAttributeAttribute /// - Compiler-generated EventHandler suffix XEventHandler => X /// - Compiler-generated get_ and set_ prefixes get_X => X /// </summary> public TextSpan GetReferenceEditSpan(InlineRenameLocation location, CancellationToken cancellationToken) { var searchName = this.RenameSymbol.Name; if (_isRenamingAttributePrefix) { // We're only renaming the attribute prefix part. We want to adjust the span of // the reference we've found to only update the prefix portion. searchName = GetWithoutAttributeSuffix(this.RenameSymbol.Name); } var spanText = GetSpanText(location.Document, location.TextSpan, cancellationToken); var index = spanText.LastIndexOf(searchName, StringComparison.Ordinal); if (index < 0) { // Couldn't even find the search text at this reference location. This might happen // if the user used things like unicode escapes. IN that case, we'll have to rename // the entire identifier. return location.TextSpan; } return new TextSpan(location.TextSpan.Start + index, searchName.Length); }
public TextSpan? GetConflictEditSpan(InlineRenameLocation location, string replacementText, CancellationToken cancellationToken) { return null; }
TextSpan?IInlineRenameInfo.GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) => GetConflictEditSpan(new FSharpInlineRenameLocation(location.Document, location.TextSpan), replacementText, cancellationToken);
public TextSpan GetReferenceEditSpan(InlineRenameLocation location, CancellationToken cancellationToken) { return default(TextSpan); }
TextSpan?IInlineRenameInfo.GetConflictEditSpan(InlineRenameLocation location, string triggerText, string replacementText, CancellationToken cancellationToken) => GetConflictEditSpan(new VSTypeScriptInlineRenameLocationWrapper( new InlineRenameLocation(location.Document, location.TextSpan)), replacementText, cancellationToken);
TextSpan IInlineRenameInfo.GetReferenceEditSpan(InlineRenameLocation location, string triggerText, CancellationToken cancellationToken) => GetReferenceEditSpan(new VSTypeScriptInlineRenameLocationWrapper( new InlineRenameLocation(location.Document, location.TextSpan)), cancellationToken);
public VSTypeScriptInlineRenameLocationWrapper(InlineRenameLocation underlyingObject) =>
public TextSpan?GetConflictEditSpan(InlineRenameLocation location, string replacementText, CancellationToken cancellationToken) { return(_info.GetConflictEditSpan(new VSTypeScriptInlineRenameLocationWrapper( new InlineRenameLocation(location.Document, location.TextSpan)), replacementText, cancellationToken)); }