vscode-helix icon indicating copy to clipboard operation
vscode-helix copied to clipboard

Search in selection fails because VSCode doesn't have an API to seed the search bar (without selecting next item)

Open jasonwilliams opened this issue 1 year ago • 1 comments

So we have an issue where after selecting multiple occurrences (within a range) you can't then search between them. The obvious method is to execute:

vscode.commands.executeCommand('editor.action.addSelectionToNextFindMatch')

But sadly this does 2 things when we only want it to do 1.. It will both:

  • Add the current selection to the search register.
  • Select the next occurrence of the text in the selection

This doesn't work for selections (ctrl+d/cmd+d), because as soon as you've searched your query and trigger that command, it will immediately select the next occurrence outside of the range what we want.

We want a way to seed the search register without selecting the next match, it doesn't seem VS Code offer this :/ Something like:

vscode.commands.executeCommand('editor.action.addSelectionToSearchRegister')

would be ideal

jasonwilliams avatar Dec 20 '23 18:12 jasonwilliams