Closed JosephTLyons closed 10 months ago
Same problem in my Typescript projects. .gitignore'd directories still are included in cmd+p call. For projects with big node_modules
this makes the file search almost unusable.
Something else to consider: Maybe there is a global set of excluded patterns in the normal settings, things that are always in the same location and always excluded no matter the project, then additional per-project settings to customize the excluded items further.
Going to prioritize this to start building in the coming weeks.
I hope as part of this effort there will be also support for user-specific (aka SCM-ignored) VS team-shared (committed to SCM) settings files.
Example:
~/.zed/settings.json
would contain user-only settings and apply to everything edited with Zed~/foo-project/.zed/settings.json
would be included in SCM and shared across all members of the foo-project~/bar-project/.zed/usersettings.json
would NOT be included in SCM therefore only apply to bar project and for the local user only.It would be nice to be able to ignore files and directories in the Project Panel (file tree) similarly either on a global or per-project basis.
For python projects, different project may use different formatter, or different code style, it would be nice to support configure these information each project, and if the setting is not found, fallback to user level setting
++ since cargo-fuzz
workspaces aren't picked up automatically by rust-analyzer
, so like in VSCode, I need to tell rust-analyzer
to look at /$CRATE/fuzz/Cargo.toml
manually.
ex: https://github.com/kaleidawave/ezno/tree/main/parser/fuzz
For python projects, different project may use different formatter, or different code style, it would be nice to support configure these information each project, and if the setting is not found, fallback to user level setting
Exactly. Like many, I can't live without "Black on save" for my python projects. However, I can't allow that to happen when working a third-party project which doesn't use Black, as I occasionally do. Without per-project settings, this would be rather cumbersome to deal with.
I'd like the ability to configure formatters at a project-level and default to the local installations of that formatter.
Another feature from VSCode, which I found useful, was explorer.excludeGitIgnore
. This hid files in the file tree that were included in the project's .gitignore
file. Most of the time I wasn't referencing these files, so it was fine to hide them.
I think the title of this issue may be misleading, because project-specific settings file support has been just shipped in v0.90.1
, whereas this issue is mostly requesting to add a new setting which excludes files.
I think the title of this issue may be misleading, because project-specific settings file support has been just shipped in
v0.90.1
, whereas this issue is mostly requesting to add a new setting which excludes files.
I adjusted the title to be more specific to what the body is asking.
VSCode default patterns for excluded files / folders:
/.git /.svn /.hg /CVS /.DS_Store /Thumbs.db
Zed 0.114.1 got a settings knob to exclude certain files, defaults use the proposed above exclusions list:
// Add files or globs of files that will be excluded by Zed entirely:
// they will be skipped during FS scan(s), file tree and file search
// will lack the corresponding file entries.
"file_scan_exclusions": [
"**/.git",
"**/.svn",
"**/.hg",
"**/CVS",
"**/.DS_Store",
"**/Thumbs.db",
"**/.classpath",
"**/.settings"
],
Any file that matches the exclusions is now entirely excluded from Zed and should not be visible in project tree, file finder or anywhere else.
Zed also does not traverse gitignored directories now, so node_modules/
contents is not indexed by default and does not pop up in search results either.
Seems that the majority of the things mentioned here are implemented now, so I'll close this issue. Let's deal with inclusions and other related things in follow-up issues with more relevant details.
is https://zed.dev/docs/getting-started documentation updated? I tried finding a combination of "file_scan_exclusions" and I wasn't able to
I think there's none, so please submit a PR with tue adjustments 🙂
Thank you for adding this feature. It truly helps.
But I discovered an issue which is kind of a deal breaker in cases when you have projects with different directory structure and naming convention.
Defining the file_scan_exclusions
in Folder-specific settings doesn't have any effect. So, I can't specify project specific directories to be excluded, otherwise they appear to be hidden in any other project I open in Zed editor.
Great catch (albeit seems hard to implement?). If you could add an issue with some basic example, it would be really great — otherwise we risk having it forgotten in this closed issue.
@SomeoneToIgnore is it possible to reopen this particular issue? Since the name of this one states "Project-specific settings", but the feature was implemented as global. I would open a new one, but the name would be pretty much the same.
Indeed we can, but the main part of my message is to get an example of such project-specific files/directories that are ok to have in one project and not ok in another.
As mentioned, it's somewhat tricky to implement potentially, and thinking of it more without your part of the context makes me wonder: why would anybody exclude .DS_Store
-like garbage (or project-specific build files, etc.) from one project and keep in another?
Some real-life example would help me to understand it better — maybe there are other ways, or, at least, this way I'm able to test it without setting some synthetic set-up.
@SomeoneToIgnore sure, the reason I discovered this issue is that I tried to search something in my codebase and I was getting unwanted results from my docs
directory. I have some mock files in there with real data my app receives from the API. So I wanted to exclude that folder from search only (I actually would prefer to have that folder still visible in the file explorer but it's a topic for another discussion).
So the way to do the exclusion I discovered is described in this issue - define a file_scan_exclusions
setting option. It works, now I don't get the results from docs
directory. But when I open another project (which also is having a docs
directory in it) I would prefer to have that directory visible perhaps.
So, possibly I misuse this setting and there is another way to exclude files and directories from search? If yes, then it's totally fine to have the file_scan_exclusions
universal for all the projects and have there only garbage and build output files.
You're certainly misusing it! So glad that we've discussed it further before doing anything 🙂
There's a "Toggle filters" button in the project search:
that contains the Exclude:
field which should do what you've described.
In addition to that, project panel allows to narrow the search with a particular directory:
While those things may also have bugs, I do not think that a static file_scan_exclusions
is a good choice for your use case.
Ah, I saw those. They are handy. But they don't remember your choices, so you need to fill them up every time you do the search. Which defies a purpose of fast search.
Search inside is also good. But I would still prefer to exclude some directories from scanning and search as Jetbrains IDEs do. You simply right click on a folder and mark it as excluded for this project.
Yes, persistence for them is lacking for now, alas, we should improve it.
Sorry if this has been answered already, how can I surface .gitignore'd files in "Search project files..."?
There's a button under the search filters (note the filter button toggled on the screenshot, opening the inputs below it) to include them into the search results:
Thanks, I'm referring to "Search project files..." to find a file by filename rather than contents.
Oh, I see now: there's no such thing yet and here's an issue for it: https://github.com/zed-industries/zed/issues/4745
Depending the project, there is quite a bit of noise in some of my file searches. I would like to be able to exclude some directories (virtual environment directories, npm module directories, etc.) from being searched through when using
command+p
to find a file, to remove as much noise as possible. I'm guessing this implies some sort of project settings? I think it could just be as simple as a hidden json file, that gets committed with your project, that excludes items via patterns:A small example might be:
Some open-ended questions about this:
When a directory is added to an exclusion list in a project setting file, what all is affected?
Or are all of those separate project settings?