-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
#42382 Preserve case while search and replace #60311
Conversation
86f6fe1
to
4362e07
Compare
4362e07
to
ea97d58
Compare
ea97d58
to
73af37c
Compare
@JulienMalige thanks for taking this, I like the idea of case preserving and glad that you can help with this feature. I don't worry too much about how this feature is implemented, either IntelliJ way or Emacs way. But I'm not sure where the option/flag should be placed, the find input box is already crowded. cc @misolori and @roblourens , this one looks like a generic feature for both Find Widget and Search Viewlet and we share the same UI component. |
I think this feature is quite useful, but I also agree that I'm not sure where this toggle should be placed. It seems like this would go well with the rest of the replace/all, which could go into a context dropdown: @rebornix thoughts? we'd need to revisit this for the sidebar since we already use the context icon to expand the search details, but that's a poor choice of an icon to begin with since we use the chevron icon to expand content. |
@misolori the dropdown in your mockup looks neat, I like it. The only concern here is we don't want to make things hard for users who only do replace and replace all, introducing a dropdown always will add one more step. One solution is we can probably keep the existing UI and hide advanced features like Preserve Case or others behind flags, when they are enabled, we start to show the dropdown icon. Another way is trying to show all icons when possible but display a dropdown when the find widget is not wide enough for all of them. Right now there are a few feature requests that we can't easily implement as we lack of space in find widget, but once we have a good UX for it, they can be unblocked. |
What's wrong with the original proposal? I think it makes sense and doesn't (yet) feel crowded if it's by itself in the replace box. It's consistent in that the other toggle buttons in the search input also control "modes" for your find/replace. I think the replace buttons would be out of place in the replace input because they are actions, not toggle buttons. |
And we do also need to do this for search, I think it's ok to be a separate PR but should go out in the same month as in the find widget. |
I think the issue with the original proposal is that it's adding to an already cluttered UI, look at the positioning of the toggles (red) and actions (blue): And this brings up an interesting scenario for the find widget where we've maximized the real estate for it. I also think this is a good candidate to bring up in our UX Sync this week. |
My initial idea was actually to preserve the differentiation between toggles and actions. For me, the toggles must be close to the actions they affect. My toggle is directly related to the content of the input, so I think it has to be inside of it (like the toggles of the search). The "isolated" toggle on the right is not disturbing me, because it affects the buttons close to him (previous/next). @roblourens, are you speaking about the global search ? |
Let's visit this in December and have it merged, having the toggle button inside the replace input box is good enough. |
This looks like a great feature to have! Looking forward to it someday! |
I will try to finish it on May 🚀 |
Please merge soon. This would have saved me lots of time today already!! |
Finally got this in a good shape and merged. Thanks for your contribution and everyone's patience ;) With this change and in tomorrow's Insiders, you should be able to preserve case when doing a single replacement. Currently we support
Feel free to contribute more patterns for this feature. |
Btw, this search-replace 'popup' is too small and crowded. Any thoughts about making this bigger and maybe horizontally-centered within the editor window? |
@gmosx you can drag the left border of the find widget to resize it. |
Hm, didn't notice that. Still the popup is very small. If it was centered, I believe it would 'feel' better. |
Ex JetBrains IntelliJ user, I was looking for a "preserve case" option in the "search and replace" box.
#42382, #9798 are linked to my use case.
Replacing with case preservation can uses different strategies. I chose the Emacs one :
https://www.gnu.org/software/emacs/manual/html_node/emacs/Replacement-and-Lax-Matches.html#Replacement-and-Lax-Matches
There is no test regression but it's still a WIP :