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

How to ignore directories in project and reduce file picker debounce time #23504

Open
AmerM137 opened this issue Jan 18, 2025 · 11 comments
Open

Comments

@AmerM137
Copy link

These are more like questions than actual issues.

Is there a way to ignore entire directories? I see that you can ignore specific files under the "Files" preferences but it doesn't seem like we can ignore entire directories. It would be nice to be able to do that as I tend to work with projects that have a lot of files that should not show up in the file picker.

For the file picker and the symbol finder, the debounce time (if that's the right word for it) is too high. As in, it takes too long to get feedback after I stop typing. Is there a way to reduce that so the picker/finder feels more responsive? The symbol finder in particular used to be instant in previous versions of Spyder.

@dalthviz
Copy link
Member

dalthviz commented Feb 6, 2025

Hi @AmerM137 sorry for the late response and thank you for the feedback! Regarding your questions:

Is there a way to ignore entire directories?

I think we don't have a way to do that, sorry. For the moment, as you mention, we only offer a filter for files using glob patterns over the Files pane,

Is there a way to reduce that so the picker/finder feels more responsive?

If you are using Spyder 6, we implemented a search feature that enables you to search files all over the active project directory which could cause some performance degradation as mentioned over #22461. Probably in a future release we will add an option to disable it. Besides that, there is also another issue about performance when you have an active project on Windows that could be related with what you are experiencing at #22556

Let us know if the info above helps!

@AmerM137
Copy link
Author

AmerM137 commented Feb 8, 2025

Hi @dalthviz, unfortunately I don't have a way to reduce the number of files. I have the root directory of the project open in spyder, and I have a src and data folders as well as others. I also have python source code in a different folder than src, call it tasks. Right now, when I try to find a python file, the search brings back .py files as well .csv, .xml etc.. you get the idea.

It would be great if we can just specify an entire folder to ignore. I would like to ignore my data folder (but not always), and keep the src and tasks folder searchable. I can switch the project location to point to src only but then I can't search anywhere outside of that directory.

My current project is medium size I'd say, ~ 7700 files. At most, I am interested in about ~500-1000 of these files. Sometimes I have an snippets folder where I throw in random snippets for data exploration and I would like to ignore that folder as well.

@dalthviz
Copy link
Member

Thank you for the extra info @AmerM137 ! Reading this again, and just to be sure, by file picker you mean the file switcher widget, right? So this widget:

Image

And I guess then you would like to have a way to exclude/ignore specific file extensions and directories from the file switcher search (which I think makes sense) hoping that such exclusion config increases the responsiveness of the file switcher, right?

Let us know!

@AmerM137
Copy link
Author

AmerM137 commented Feb 10, 2025

Yes correct!

Edit: Also it would be really good if the results come back faster, what I am calling debounce time. I think searching through less files should improve it, but I feel like there's a set amount of time the picker is "thinking" before results come back, even if it's only a few of them. Hope this makes sense.

@dalthviz
Copy link
Member

What do you think about this @spyder-ide/core-developers ?

@mrclary
Copy link
Contributor

mrclary commented Feb 10, 2025

This is interesting...
For me, the File Switcher widget has only ever shown files that are currently open in the Editor, and does not show files in the entire project.

@jitseniesen
Copy link
Member

I am a bit afraid that not many people will find the option to ignore directories in a project. Maybe we should first try to optimize the File Switcher? If that turns out to be too hard or impossible, we can add an option.

For me, the File Switcher widget has only ever shown files that are currently open in the Editor, and does not show files in the entire project.

@mrclary The changelog implies that this only works "in conda environments or if the fzf package is installed".

@mrclary
Copy link
Contributor

mrclary commented Feb 11, 2025

@mrclary The changelog implies that this only works "in conda environments or if the fzf package is installed".

Hmm... both conditions are satisfied for my setup:

>> conda list -p ~/Library/spyder-6/envs/spyder-runtime/ fzf
# packages in environment at /Users/rclary/Library/spyder-6/envs/spyder-runtime:
#
# Name                    Version                   Build  Channel
fzf                       0.59.0               he954eb5_0    conda-forge

@AmerM137
Copy link
Author

@mrclary are you sure you have a Spyder project open? On my setup, there is a ".spyproject" directory in my project root directory.

@mrclary
Copy link
Contributor

mrclary commented Feb 11, 2025

@mrclary are you sure you have a Spyder project open? On my setup, there is a ".spyproject" directory in my project root directory.

Yep, project open in Spyder, .spyproject present.

Image

@dalthviz
Copy link
Member

Thanks @mrclary and @jitseniesen for the comments!

For me, the File Switcher widget has only ever shown files that are currently open in the Editor, and does not show files in the entire project.

Could it be that fzf has issues on macOS? On Windows even without typing anything in the File Switcher lineedit to search I can see the project files division (which I think comes from fzf checking the available files over the project directory):

Image

Maybe opening an issue to track that could be worthy 🤔

I am a bit afraid that not many people will find the option to ignore directories in a project. Maybe we should first try to optimize the File Switcher? If that turns out to be too hard or impossible, we can add an option.

I think in terms of optimization/handle of the search performance the only idea we have though about as far as I remember is to automatically disable fzf/searching inside the projects directory in case a size threshold is reached (something like if your project has more than X amount of files fzf usage gets disabled automatically - #22461 (comment)). But trying to first find a way to make it faster makes sense to me 👍

Another thing that probably could be worthy to explore is improving the feedback for searches (maybe some sort of spinner indicating that a search is being done?) but maybe this is a little out of scope from the discussion here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants