helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.76k stars 2.51k forks source link

Disable searching for git/ignore files for path completion #7715

Open sigmaSd opened 1 year ago

sigmaSd commented 1 year ago

Currently helix uses default git/ignore searching options for file walker https://github.com/helix-editor/helix/blob/master/helix-term/src/ui/mod.rs#L484-L488

This searching for git/ignore files issues 14 syscalls total per directory instead of 3 without them disable with

        .git_ignore(false)
        .git_exclude(false)
        .ignore(false)

As an example if a folder contains 287 files it issues 4110 syscalls instead of 926 , this in my testing with cold cache change the time from 15 second to 100 ms (in an old pc with hdd)

Also note that this searching is useless because we're already searching in depth ==1, so the only thing needed is the git/ignore files inside the current directory and not the sub-directories, (so 9 extra syscalls instead of 3186)

This is currently configurable in the file picker, but not i the path completer

What do I propose:

Another idea is since the search is for depth 1 in case of completer, we can keep the same functionality while gaining all the performance, by disabling the git/ingore search, and manually filtering the git/ignore entries only in the current directory

sigmaSd commented 1 year ago

ref https://github.com/helix-editor/helix/issues/6867 https://github.com/helix-editor/helix/issues/6114 https://github.com/helix-editor/helix/issues/5871

pascalkuthe commented 1 year ago

I am strongly opposed to changing the default for the file picker. Gitignore is a very useful feature and the overhead is negligebale since its a recursive crawl anyway. All the issues you linked regarding the file licker are unrelated

Something you left out here but mentioned on latex. This was a system with an old HDD and a cold cache. On a modern system the overhead is not very significant

norcalli commented 9 months ago

@pascalkuthe You're forgetting about NFS, which many of us have to use for work reasons and is definitely not negligible.

For me, every keystroke is slow and I checked via strace that it is in fact invoking this recursive search every time the path changes, not caching the information despite the path being appended to in 99% of cases, meaning that all of the ancestor git ignore information should probably still be valid.

Yutsuten commented 1 month ago

I'd love to have :open not ignoring files in .gitignore for a different reason.

In my work, they've added to .gitignore a config file and committed a config.example. We're supposed to cp config.example config and then edit config as we please. But when I try to :open I don't get any completions for config because it is ignored by git. I tried changing [editor.file-picker], but it does not affect :open's completion options.

config here is an example, there are more long filenames like docker-compose.yml that I have to fully type and hope there are no typos every time. The first time I even thought: "The file don't exist??". It would be much faster to just type :o d<TAB><ENTER>.

(I know this is a strange usage of .gitignore, but it is beyond my control...)

Gitignore is a very useful feature and the overhead is negligebale since its a recursive crawl anyway.

I can understand the feeling, but I'd not force the feature on everyone. At least make it configurable, please.

How about adding a [editor.open-file] with similar options than [editor.file-picker], like this?

[editor.open-file]
hidden = false
ignore = false
git-ignore = false
git-global = false
git-exclude = false