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

Search Editor: Add settings for search option default values #89353

Closed
adamlogic opened this issue Jan 27, 2020 · 14 comments
Closed

Search Editor: Add settings for search option default values #89353

adamlogic opened this issue Jan 27, 2020 · 14 comments
Assignees
Labels
feature-request Request for new features or functionality search-editor
Milestone

Comments

@adamlogic
Copy link

Since the new Search Editor treats each search as a new search, it doesn't remember the options for "Match Case", "Match Whole Word", and "Use Regular Expression" (as the sidebar search does). This makes logical sense, but it's inconvenient if you need to toggle those options manually for every search.

It'd be very helpful to specify default search options, so that for example, "Use Regular Expression" was always enabled for each new search.

Ref #88154 (comment)

@vscodebot
Copy link

vscodebot bot commented Jan 27, 2020

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@karlhorky
Copy link

@JacksonKearl This is still an upcoming feature, right? Can we expect it in the March or April releases?

@JacksonKearl
Copy link
Contributor

@karlhorky We'll probably add either default or persistent options, but I don't have a specific timeline for it.

@JacksonKearl
Copy link
Contributor

You can try out "search.searchEditor.experimental.reusePriorSearchConfiguration": true in tomorrow's insiders (not the next Insiders to be released but the one after it) and let me know what you think.

@JacksonKearl
Copy link
Contributor

Going to let this cook as an experimental setting for a bit. If others come across this issue and this works, please upvote so I know it's desired, or comment if this doesn't work as you'd expect.

@JacksonKearl JacksonKearl modified the milestones: April 2020, On Deck Apr 10, 2020
@karlhorky
Copy link

@JacksonKearl thanks!

Which issue should we give a thumbs-up to? Your comment with the configuration setting (#89353 (comment))?

I would suggest against using adamlogic's original description at the top: I think this would be misleading, since a lot of users upvote issues that they want implemented (not even knowing that it is already done), instead of meaning to upvote your implementation thereof.

@carlocardella
Copy link
Member

You can try out "search.searchEditor.experimental.reusePriorSearchConfiguration": true in tomorrow's insiders (not the next Insiders to be released but the one after it) and let me know what you think.

Is this available yet (in Insiders)? I can't find that setting

@JacksonKearl
Copy link
Contributor

@carlocardella its hidden - you’ll have to paste the json manually.

@JacksonKearl
Copy link
Contributor

Took the setting out of experimental, now you'll be able to find it in the UI settings editor. Also related #95582, which allows you to pass args in the keybinding configuration:

    {
        "key": "ctrl+shift+g",
        "command": "search.action.openNewEditor",
        "args": {
            "query": "${selectedText}",
            "filesToInclude": "${relativeFileDirname}"
        },
        "when": "editorTextFocus"
    }

Explicitly passed args override prior config.

@karlhorky
Copy link

Nice! This will appear for users in the stable May 2020 update?

@JacksonKearl
Copy link
Contributor

JacksonKearl commented May 8, 2020

Yes. And it will be out in the next Insiders release (today or Monday).

@dufferzafar
Copy link

@JacksonKearl When using this, and running it with no text selected, I get '${selectedText}' can not be resolved. Make sure to have some text selected in the active editor.

Is there a way to define a single keybinding that can default to empty string if there is no text selected? Perhaps a ${selectedTextOrEmpty} variable?

    {
        "key": "ctrl+shift+g",
        "command": "search.action.openNewEditor",
        "args": {
            "query": "${selectedTextOrEmpty}",
            "filesToInclude": "${relativeFileDirname}"
        },
        "when": "editorTextFocus"
    }

@JacksonKearl
Copy link
Contributor

By default it will use your selectedText or the empty string, you don’t need to include anything for query

@karlhorky
Copy link

Just received the VS Code May 2020 (1.46) update and the configuration below works well, thanks @JacksonKearl !

"search.searchEditor.reusePriorSearchConfiguration": true

@github-actions github-actions bot locked and limited conversation to collaborators Jun 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality search-editor
Projects
None yet
Development

No branches or pull requests

6 participants