-
Notifications
You must be signed in to change notification settings - Fork 37.6k
Make editor.action.*SelectionMatchFind* ignore the editor.find.seedSearchStringFromSelection setting
#165981
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
Make editor.action.*SelectionMatchFind* ignore the editor.find.seedSearchStringFromSelection setting
#165981
Conversation
…*` ignore the `editor.find.seedSearchStringFromSelection` setting
| if (editor.getOption(EditorOption.find).seedSearchStringFromSelection !== 'never') { | ||
| selectionSearchString = getSelectionSearchString(editor, 'single', seedSearchStringFromNonEmptySelection); | ||
| } | ||
| const selectionSearchString = getSelectionSearchString(editor, 'single', false); |
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.
seeding the search from cursor position alone should still be possible if seedSearchStringFromSelection is set to always. Hard coding the last parameter to false will break that scenario
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.
Have you tried it, or just going off the variable name? IIRC the last parameter has somewhat tricky name and means the exact opposite of what you mean here, unless I mistake your meaning... setting it to false hard-codes it to seed either from selection or cursor position alone — both cases are respected... I'll do some testing though once I get to my home machine.
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.
note that I meant the new code to behave exactly as the old code with seedSearchStringFromSelection==='always'; now it passes 'none' instead of 'single' at line 749, but that was effectively a no-op as far as I can tell
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.
from looking at getSelectionSearchString, this change will require that text is selected for it to be seeded as the search string, whereas currently the word at the cursor location will be used as the seed if nothing is selected
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.
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.
Here is a separate issue that I see though, where the Find Widget is not populated — but the search is still seeded! Just to make sure to not mix it up with my issue...
It happens (1) only on the very first invocation after startup (2) if the find widget is closed, and (3) the same happens on the mainline version with the default settings — so should be out of scope for this issue.

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.
ok, you were right, I still had it backwards. This will always use the current word as the seed when nothing is selected, regardless of the settings. Seems ok since the regular find command is configurable to only seed when something is selected.
|
Thank you both for the discussions and contribution. |

The name of the command already has "Selection" in it, so it does not make sense to respect
editor.find.seedSearchStringFromSelection==never... Intuitively, this command shouldbehave similarly to the Ctrl+D default.