-
Notifications
You must be signed in to change notification settings - Fork 8.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
Teach Find command to search selected text #8510
Conversation
Do we need to add this to settings? Some people may not like the idea of arbitrarily populating the selected text. |
@skyline75489 - this is a good question 😊
Where
And the default by now will be None? |
Honestly I'm good as long as the default behaviour remains the same. Remember the MRU tab switching thing? That just backfired in like no time. So considering this is also a breaking change, we should learned from the tab switching lesson. |
Great work! I like the design for this setting with just a few nits:
|
@carlos-zamora - I added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meh. These are just nits at this point. So excited for this to go in! Plan on using it all the time!!
// we should use all the lines to populate the search box. | ||
// If the flag is set to false and multiple lines are selected, | ||
// we should not use the selected text to populate the search box. | ||
// - caseSensitive: boolean that represents if the current search is case sensitive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// - caseSensitive: boolean that represents if the current search is case sensitive |
I don't see a caseSensitive
param here haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. Will fix it (in any case need to work on docs)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, I completely forgot to ask you to make a PR on the docs site haha.
This is something I would actually consider making default. VS Code does this by default and we tend to follow in their footsteps for a lot of our features. I'm curious how the team feels about this. For the setting, I'm wondering if this should just be a boolean instead: to either populate with a selection or not. |
I'm down for just making it a bool (true --> multiLine, false --> none). Also down to make true the default because chromium edge and VSCode have it enabled by default. |
What if we don’t make it a setting at all? Let the users complain if they hate it |
Do it by default and only. Users can delete the search needle if they don’t want it |
@DHowett - in general I like your approach: let's put it in the preview and see if anyone complains. The question is wether it usually works? I am not experienced enough, my only input is that it didn't work for MRU. But probably then it was an issue with the timing. I am not sure if this one goes to 1.5 or 1.6, but probably we should put it optional in 1.5 and default in 1.6 preview? Won't it allow us to get as much inputs as possible? Then we can cleanup the code. I guess the main cost for this approach is translating the resources 😄 So probably, let's use a single Unrelated to above, should we allow only single line selection (aka VS Code) or allow multiple lines by concating them (aka notepad++)? |
@carlos-zamora - hmm from what I played right now:
|
Created an alternative PR here: #8521. |
I'm obviously biased towards whatever Sublime does, and they will pre-populate the search box with the selection, so I think that'd be cool 😎 @skyline75489 I definitely appreciate you thinking about this changing a default behavior. We were burned super hard about this, and we've had no shortage of discussion of "DONT CHANGE THE DEFAULTS" in the past month. I guess I can imagine a user wanting this to be disabled. That being said, it's a lot less breaking than in-order/mru tab switching IMO. For tab switching, there was no good remedy without changing the settings. You couldn't get an in-order-like behavior in MRU without changing the settings. For this one, you can still get the old behavior by pressing Bkspc. I think IF someone comes along saying "but muh cheese moved", then we have a plan for how we would make this configurable. (We do have a team sync planned for later today, so we'll be discussing this one) On another topic, we've maybe revealed a bit of a shortcoming with the Terminal's search functionality here. We don't support multi-line searching at all. We probably should! But I don't think we should really start worrying about this in this PR. Let's just make the behavior here the same as "select some text, copy it, open the find box, paste the text". We can loop back around on multiline in the future. |
Mike's rationale matches mine for making it non-configurable. This doesn't need to be a knob that users can turn; I expect that if we did make it a knob we would only ever see users use two things: "turn it off" and "do the freakin' sane thing" (which is "it acts just like copy/paste of the selection would"). We are possibly the most configurable terminal that exists (I kid, but maybe?). That doesn't mean that we need to make literally everything an option. Down that road lies madness. Down that road lies "I want the letter |
@DHowett - what's wrong with madness? Sanity is overrated after all 😄 |
From our team meeting today: Team fully agrees that this should not be configurable. Redirect all to #8510 😄 |
Erm, #8521 |
PR Checklist
Detailed Description of the Pull Request / Additional comments
Add
selectionMode
field to thefind
command.none
is provided - behave as before.selectionMode
is set tosingleLine
and a single line of text is selected,use it to populate the search box.
selectionMode
is set tomultiLine
concatenate all lines with line-breaks omitted,and use the resulting string to populate the search box.
The population logic will be applied whenever the search box control gets loaded /
reset by the consequent find command.
If the population logic should be applied while the search box is already populated,
an old value will be overridden.
Validation Steps Performed