-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Feature Request: Preserve Case - Find / Replace #9798
Comments
This would be life-changing |
Example: currently implementing an immutable red/black tree, and there is an if/else statement, with each branch containing a mirror of the other branch. To implement the second branch, I need to replace all instances of "left" with "right" and vice versa. This includes:
A case-insensitive replacement operation would make this doable in one step. Instead, I have to first replace each case of left with foo (3 steps). Next I replace each case of right with left (3 more steps). Finally, I replace foo with right, for a total of 9 steps. With case insensitive replacement, it'd be 3 steps total. |
Let's track the setting persistence in #6158 |
@ant31 The feature is/would be per-character, not per word, which means your example would resolve as:
|
Sorry for closing it too fast and Thank you for making it clear, it's a valid feature request. |
Just wrote a simple extension that covers some use cases. Check out https://marketplace.visualstudio.com/items?itemName=vilicvane.sensitive-replace |
this should work exactly like described in case when using Cmd + D , Add selection to Next Find there are so many situations in using camel case / hungarian notation where it would be useful... hope it gets built in ? :) |
@vilic 's extension looks almost perfect, it just needs to be across an entire project 👍 |
While an extension can get the job done, being built into the Find/Replace window would be ideal, with an option right next to "Use Regular Expressions", that searches in the entire file. This hasn't been active in a long while. Is this not planned anymore? This would truly be a life changer. |
It would be really appreciated! PHPStorm has this feature for at least 2 years. Unfortunatelly, the extension (even being good) does not get the job done in my case (pun not intended) because so many times I have to search/replace over all project's files, not only on a selected text. |
Really need this. I'm having to do 3 find and replaces where a case preserve would make it only 1. Find: foo FOO->BAR |
The way Eclipse does this is through a regex replace token \C. So I can search for foobar and replace it with \Cbazqux and it will work as expected. |
Why the freak this is not implemented yet ? |
As far as I know, they don't owe you an excuse to NOT implement a feature. |
It's not just any open source project. And not everyone can contribute. It's an important project of Microsoft connected with their effort do being nice to devs again and with their effort to spread TypeScript (among other things I guess). But... Yet another comment with why is this not implemented is not helpful for devs. Just add +1 to the initial comment and maybe some PM from Microsoft will finally make time to do this. |
I just found out that Mac OS X has something called "Paste and Match Style" which defaults to |
Nearly 3 years. Is there any hope of this getting implemented? |
Today was my day to really try vscode. I'm back to emacs with its case aware search and replace. This feature is really very important for refactoring. The current implementation can do harm your code. |
Seems a tad overly dramatic no? If it really is such a game changer and so vital for refactoring, why not just use the extension provided further up the page? |
@itsafire it will match regardless of case so the result will be I use it to fix typos.. But I guess It doesn't really allow this: |
@leawp Neat, but that wouldn't work if you want to the change to be relative to the case of the search. Here
Here, replacing |
@clshortfuse yeah, I've realized it after reading comments, added a little explanation to mine. |
One of those really simple features that forces me to keep another text editor around |
With #60311 merged, you will be able to preserve case when doing single replacement in Find Widget from tomorrow's Insiders. It's still in its early stage so currently we only support following patterns
Considering we already have the infrastructure there, it would be straightforward to add more, all you need to do is
Added Help Wanted label and feel free to contribute more patterns for this feature. Simply follow above 3 steps. |
Amazing, I'm so excited!!! |
Not working as expected; I'll have a PR done in a bit |
Insiders now works as expected :D Thanks for merging! |
Although we have preserve (sensitive) case in normal find and replace we cannot do it when using replace all across multiple files. That would be useful. |
I think this issue can be closed and new issues be created / referenced here for any related functionality that isn't in yet. Thanks to all who contributed 🙂 |
Thanks all for the patience and contribution to this feature. If you are interested in contributing more patterns to Preserve Case, you can follow #9798 (comment) and if you run into issues while playing with this feature, please file new issues in this repository. |
It'd be awesome if a preserve case feature was eventually added to the find/replace functionality!
ST3's implementation of it is a good example if you need one.
The text was updated successfully, but these errors were encountered: