Have again suggested this long before to Visual Studio team, but since Visual Studio 2013 has a “Send a Frown” feature, I’ve sent it again with some suggestions on how it could be implemented.
I need some clever replace in cases like that one shown in the screenshot below, where I have the implementation of a Sounds property and want to clone that and rename it to Music (this is useful when repeating a coding pattern, but more importantly can use this when refactoring code and need to rename something).
When doing replace on the selection, replacing "sounds" to "music", I want the word/target phrase to detect the casing of the source word/phrase and keep the same casing style, that is:
– IsSoundsOn should become IsMusicOn
– soundsOn should become musicOn
– PROPERTY_SOUNDS should become PROPERTY_MUSIC
As you can understand now I have to do 3 replacement operations, having selected the option "Case sensitive":
– Sounds to Music
– sounds to music
– SOUNDS to MUSIC
I’d rather have an option "Case adaptive" or something like that (marketing people might call this "Smart replace").
Implementation-wise, every time it detects the source text (case insensitive search), it would check if it is found in one of the following casings:
– first letter non-capital
– first letter capital
– all letters small
– all letters capitals
and when replacing with the target text it would apply the same casing state to it (affecting just the first letter of the target or all letters depending on which of the above casing states were detected for the source string at each position it was found in the source text)