-
Notifications
You must be signed in to change notification settings - Fork 28k
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
Smarten workspace search from selection logic #91901
Comments
This is only once per window session for me, and I don't necessarily "know" if the search view is empty.
This feels like an arbitrary condition to me. I think if we change the behavior for a bunch of individual special cases then it will just feel like the behavior is random and unpredictable. |
I wonder about having different commands/keybindings to "focus and search" vs "just focus". I think a big part of the problem is still that cmd+shift+F is overloaded |
Thinking about it more, maybe "always focus and search unless results were removed" is not that bad |
Also #88160 is relevant, about the inconsistency in when we grab the word under the cursor |
I think that issue should be considered along with this. If we want consistency in when the word under the cursor is taken, we have to either A. Do that every time cmd+shift+F is pressed I don't like A or B because sometimes I want that and sometimes I don't. What would people feel about C? Could pick a keybinding like Then, I would also say that selected text is always copied to the search input. Then in both of these cases, we would always trigger a search, unless the user has "dirtied" the result tree by removing results. Then they have to press enter to trigger the search. Thoughts? |
I think uncoupling "focus search" and "focus and seed search" is a good idea. That's probably slightly better than an option for the seed behavior. As long as I can imagine other users wanting an option to allow To ensure I'm understanding correctly, the final result would be this
That last part is concerning. I'm not sure how all this interacts with regular Ctrl+F searching. I'd assume we want the same range of capability and control. |
So apparently I wrote a duplicate #92477, but for all it is worth, since it is a regression from previous behavior and there is no way to config what happens if one runs |
I think we should put back the behavior for the keybinding with text selected, but leave the seach triggering off when you click the search icon. But still have to think about the other points above. I wouldn't change the behavior for the editor find, but I forgot that search actually respects the |
Current thinking:
{
"key": "shift+cmd+f",
"command": "workbench.view.search.focus"
}
|
It seeds input but won't perform new search if results are "dirty". BTW looks like there is inconsistency in marking results as "dirty" - removing file from result prevents next search to be performed immediately (requires Enter ), but removing one match from file that has several - allows immediate search. |
So are you asking for a way to trigger a new search with a single keypress even when the prior search results were dirty? |
Yes, but I guess it should be available (probably as an option if feasible) only when Otherwise it will be back to state when searches were fast but previous searches were lost unintentionally. |
I think the dirty case is rare enough that requiring an extra |
@JacksonKearl I am lost what actually changed and how this new setting I still actually would like a setting to have this behaviour:
|
I prefer it always to search what I've selected in the search editor, no matter what already exists in the search view input field 😆 |
@thernstig in my case I had a large search with thousands of results that I used like my todo list where I carefully collapsed some and removed others. In that case, replacing the list with a new search at random can really be frustrating. |
Is it only when Because if it's applied when it |
To be clear: I am only referring to the automated execution of search that seems to happen based on my editor selection and without further interaction once I focus the search viewlet. If you have a keybinding for running a search it should trigger no matter what. |
To verify:
|
I often see that search is not triggered when I invoke Cmd+Shift+F but I don't think I modified the search results. What is the exact condition that needs to apply for the search to run from the selection in the editor, can you show me in code? |
Yes, the core of the logic is here:
|
@JacksonKearl yeah I think I found the bug:
=> 🐛 search is NOT executed again! In other words, it looks like once I cleared search results this feature is disabled from then on. This explains why often I noticed that it would not work for me anymore... |
Good catch, clearing the results triggers the "removed results" logic which it shouldn't in this case |
@bpasero can you verify? Thanks! |
I think this could get a bit more clever:
Originally posted by @bpasero in #90962 (comment)
The text was updated successfully, but these errors were encountered: