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

Add debounced submission on input in project search #24086

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Tebro
Copy link

@Tebro Tebro commented Feb 1, 2025

Closes #9318

Release Notes:

  • Added debounced search submission on input in project search

Copy link

cla-bot bot commented Feb 1, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @Tebro on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@@ -168,6 +169,8 @@ pub struct ProjectSearchView {
replace_enabled: bool,
included_opened_only: bool,
_subscriptions: Vec<Subscription>,
search_debounce: Option<Task<()>>,
prevent_focus_results: bool,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better way to handle this state?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Been trying to solve the issue of keeping the prevent_focus_results as struct field. I don't really like having it there but can't quite figure out how to make it proper. Any suggestions would be welcome.

@Tebro
Copy link
Author

Tebro commented Feb 1, 2025

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Feb 1, 2025
Copy link

cla-bot bot commented Feb 1, 2025

The cla-bot has been summoned, and re-checked this pull request!

@maxdeviant maxdeviant changed the title Added debounced submission on input in project search Add debounced submission on input in project search Feb 1, 2025
@@ -335,6 +335,11 @@
"include_ignored": false,
"regex": false
},
// These settings define whether the project search should search as you type, or only on enter.
"project_search": {
"automatic_submission": true,
Copy link
Contributor

@osiewicz osiewicz Feb 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe you don't need to have a separate automatic_submission setting, as you could determine it based on whether the automatic_submission_delay is non-null.

@mgsloan
Copy link
Contributor

mgsloan commented Feb 2, 2025

Thanks for working on this! I realized that we probably need to do some UI design work before being able to merge this feature. Added some thoughts in a comment on the issue.

If the Option A choices are made, then I think the need for prevent_focus_results will naturally go away - enter is always just a focus switch to the results, and focusing the results would cause the full set of search results to be loaded. Please wait on implementation while we sort out what makes sense for the design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enable type on search by default
3 participants