Skip to content
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

Create command for find in selection and add default keybinding #8843

Closed
tbfleming opened this issue Jul 7, 2016 · 20 comments
Closed

Create command for find in selection and add default keybinding #8843

tbfleming opened this issue Jul 7, 2016 · 20 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug editor-find Editor find operations feature-request Request for new features or functionality verified Verification succeeded
Milestone

Comments

@tbfleming
Copy link

  • VSCode Version: Insiders
  • OS Version: Windows 10

actions.find and editor.action.startFindReplaceAction no longer find in selection without having to click an extra button (#8787). The Find in Selection button doesn't have a keyboard shortcut.

I frequently replace in selections. Ideally:

  • Select text
  • Hit a keyboard shortcut bound to a new command
  • The Find in Selection button is already enabled

Also, it would be nice if all buttons and fields in the find dialog could be bound to keyboard shortcuts.

@tbfleming
Copy link
Author

After looking closer, the Find in Selection button is the only thing in the dialog without a shortcut

@dilijev
Copy link

dilijev commented Jul 7, 2016

@tbfleming thanks for opening this :)

@alexdima alexdima added bug Issue identified by VS Code Team member as probable bug feature-request Request for new features or functionality labels Jul 12, 2016
@alexdima alexdima added this to the Backlog milestone Jul 12, 2016
@alexdima alexdima added the editor-find Editor find operations label Jul 12, 2016
@alexdima alexdima changed the title Create workbench commands for find in selection and replace in selection Create command for find in selection and add default keybinding Jul 12, 2016
@bgashler1
Copy link
Contributor

bgashler1 commented Nov 7, 2016

@tbfleming what if we instead had a setting that, if enabled, would always find within a selection by default? That way you can still use the same keyboard shortcut you use today for Find/Replace. Would you prefer that?

@bgashler1
Copy link
Contributor

See #12109 (comment) for background on why we changed the default behavior of Find/Replace to not be scoped by default to a selection.

@tbfleming
Copy link
Author

As long as there's an easy way for me to switch between find selected and find in selected (e.g. whether it's multiline or not), then a setting will be nice.

@mylowillem
Copy link

The change to the default behavior is extremely annoying. Find in selection by default is what users from a Visual Studio / Windows background expect. I suspect users with an OSX background prefer it to be off by default. Please add a setting for this, and I recommend turning find in selection on by default on Windows and off by default for OSX.

@tbfleming
Copy link
Author

@mylowillem may be right. It's been odd seeing people complain about behavior that I expect.

@jasonterando
Copy link

jasonterando commented Jan 26, 2017

By far, this is the biggest frustration I have with VS Code (which is a great product). If I have text selected, it is setting a context of scope, and that scope should be respected on any command executed (including search or search/replace).

@Bill-Stewart we needed to remove the default find in selection behavior due to it being easy to misunderstand what was going on when no results were showing up for some users.

I see this more as a problem with "flat" or minimalist UI than a behavioral issue. The behavior needs to be reverted to work just like the vast majority of code editors out there. To mitigate the risk of confusion, perhaps use something other than a "left justify" icon to indicate "find in selection" search. Using colors with more contrast in the "down" mode for buttons (instead of medium grey) that behave like checkboxes may help as well.

@rebornix
Copy link
Member

rebornix commented May 6, 2017

Let's track the setting persistence in #6158

@rebornix rebornix closed this as completed May 6, 2017
@tbfleming
Copy link
Author

How is this related to persistence? I sometimes need to replace in selection and sometimes not. Switching between them right now is painful.

@rebornix
Copy link
Member

rebornix commented May 6, 2017

@tbfleming First of all, speaking of your pain, I already added a command to toggle Find in selection. #6158 is about setting persistence as some users may want to have their default value for these settings. I commented here to help others know where to find that if they happen to jump into this issue. Sorry for the misleading and let me know if the newly added command helps you out.

@tbfleming
Copy link
Author

Thanks. What is the command? I just tried searching for in Keyboard Shortcuts but don't see it (Insiders build)

@rebornix
Copy link
Member

rebornix commented May 8, 2017

@tbfleming we don't release Insider on weekends, with today's insider, you can toggle it by cmd+alt+l

@tbfleming
Copy link
Author

@rebornix I just updated and checked again. I tried searching for "selection" in Keyboard Shortcuts, but it's not there. I use Windows, which doesn't have a cmd key.

@rebornix rebornix reopened this May 10, 2017
@rebornix
Copy link
Member

@tbfleming can you try search toggleSearchScope in Keybinding?

@tbfleming
Copy link
Author

Found it. Alt+L. These made it hard to find:

  • The name toggleSearchScope has no resemblance to the button's hover text ("Find in selection")
  • The button's hover text doesn't show the shortcut like the other buttons do

@rebornix
Copy link
Member

@tbfleming you are right, I'll fix these you issues you mentioned. Thanks!

@tbfleming
Copy link
Author

Thanks for adding the shortcut!

@rebornix
Copy link
Member

@tbfleming from tomorrow's insider, you should be the shortcut in the hover text and the command will be called toggleFindInSelection

@michelkaporin michelkaporin added the verified Verification succeeded label Jun 1, 2017
@toxic-johann
Copy link

I am using mac OS.
And i want to find in selection.
I follow the issue and find that i have to use mouse to finish this job.
@tbfleming found the key on windows.
But in mac OS, it seems it do not work.
Are there any global setting about this.
Because in sublime, i can set this easily.

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug editor-find Editor find operations feature-request Request for new features or functionality verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

9 participants