Reputation: 2057
I saw someone using resharper and I noticed that whenever they changed a property name it was instantly reflected in all references to it.
So I downloaded a trial of resharper and it seems it is still a manual 'replace all' feature. It is not updating live as I type.
Resharper looks cool, but I want this particular feature that I saw! And at a dead-end with Google.
Upvotes: 1
Views: 67
Reputation: 97676
The thing you saw was probably a Live Template. Those can contain placeholders, and the same placeholder can appear more than once within the same template. When you insert the template, the cursor goes to the first placeholder, where you can type in a new value, and all the other instances of that same placeholder will reflect those same edits as you type.
For example, ReSharper comes with a "dependencyProperty" Live Template, which is defined as:
public static readonly System.Windows.DependencyProperty $propertyName$Property =
System.Windows.DependencyProperty.Register("$propertyName$", typeof ($propertyType$), typeof ($containingType$), new PropertyMetadata(default($propertyType$)));
public $propertyType$ $propertyName$
{
get { return ($propertyType$) GetValue($propertyName$Property); }
set { SetValue($propertyName$Property, value); }
}
When you insert this template, your cursor goes to the first placeholder (indicated as $propertyName$
above), and you can type a value for that placeholder. All instances of the $propertyName$
placeholder will update with those same edits as you type.
Then you can hit Tab, which moves you to the next placeholder ($propertyType$
), which you can similarly update. If you Tab again (to leave the last placeholder), then you exit placeholder mode and the template becomes plain old text that you can edit normally.
You also get live-update-as-you-type behavior when you rename a local variable. But if you saw this with a property, it was almost certainly a Live Template. (Property renames could affect multiple files, which could take time, so ReSharper waits until you confirm the rename before they do the work. It will also suggest related renames, like doing a corresponding rename to a property's backing field, which also isn't practical with live updates.)
Upvotes: 1