-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Compute Projects switcher results in a worker to avoid freezes #21275
Conversation
- ProcessWorkers don't need threads, so they are not necessary. - Also, add a method to ProcessWorker to set its current working directory.
Also, reduce the number of results shown in the switcher to display it without lags.
This is necessary now that fzf is called asynchronously.
Also, rename methods in Projects related to switcher searching to be more meaningful.
It's not clear why that was required before.
This is necessary to make some adjustments in the switcher when that's the case.
Also, avoid a small lag when opening the symbol finder by calling the `setup` method directly after that.
Also, simplify when `setup_sections` is called: instead of doing it every time an item is added, now we do it after all of them have been sorted.
Also, change that section name to "Project" because we don't support multiple projects.
Also, expand that test to check that: - We make sections visible for the right number of items. - Searching in the switcher is working as expected. - The switcher is updated when removing files.
That avoids a ton of Qt warnings to be displayed.
4c9975a
to
843535f
Compare
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.
Thanks @ccordoba12 ! I was checking this locally and seems like there is some delays still for certain files? I tried with a dummy project with a lot of .parquet
files and I noticed a lot of lag and also the files not appearing vs checking .py
was more quick.
Checked with latest master
and although there you can sense some general lag it shows the .parquet
as well as the .py
files:
Maybe there is now some logic/validation about what files to show that needs to be move to a worker too?
Also, I was thinking and maybe adding/showing some sort of loading indicator while searching could be worthy?
That's much faster than trying to detect if they are binary to exclude them.
I was using However, I changed that to simply compare the file extension of the
As I said, there's no value in showing binary files if you want to quickly find and open a project file in the editor.
I agree, but that's a UI improvement that I have planned for later. |
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.
Thanks @ccordoba12 ! Left comment/suggestion regarding a commented out line and a comment. Also, checking locally seems like an entry for the project root directory is created (not sure if that is intended or not). Other than that this LGTM 👍
This only happened on Windows
@dalthviz, besides fixing the problem you reported in your last review, I also added some changes to prevent trying to populate the switcher when closing it. |
Thanks for the fixes @ccordoba12 ! Checked again and the pointed elements look good now 👍 . However while checking again, I realized that I haven't checked this without |
- This helps to simplify the _on_search_text_changed method of its widget. - Use that method from Projects to remove the items added by it before painting new ones.
That way its results can be filtered when fzf is not present.
That created a special case for Projects, which is not really necessary.
Thanks for noticing that @dalthviz! It should be fixed now with my last commits. When I was doing those changes, I also realized that we don't need to create a special, unnecessary dependency between the Switcher and Projects. So, I decided to remove it. |
Checked again @ccordoba12 and seems like while the filtering works without Also, should we add some tests for the different scenarios we have been discussing here (trying to search for a binary file, trying to search with and without |
Great!
Yep, that's the behavior implemented before and I kept it in this PR too. I think that's more a UX issue than a backend problem (which is what I'm trying to fix here), so it should be left for later. In addition, we're currently discussing about that in our UX meetings and haven't decided what to do yet. |
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.
Thanks @ccordoba12 ! This LGTM. However, before merging, do you think that adding more tests is worthy? If not feel free to merge 👍
Good point and sorry for missing the comment you posted about it (I just read it):
I'll expand our current test for the projects/switcher integration to cover those scenarios as well. |
4b863ac
to
907395c
Compare
This includes new cases for binary and nonexistent files, and missing fzf.
907395c
to
d51c98d
Compare
Test improved, so I'm going to merge this one. Thanks @dalthviz for all your help! |
Description of Changes
fzf
because they can't be opened in the editor.Issue(s) Resolved
Fixes #20940.
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct: @ccordoba12