zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
35.32k stars 1.79k forks source link

editor: search project files shows only from unfolded directories in project panel #7554

Closed avetisk closed 3 months ago

avetisk commented 3 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

When I use the fuzzy search, it looks only in the folders that have been unfolded in the project panel at least once.

It should look into all the directories of the project, regardless to their folded state.

Environment

Zed: v0.121.5 (Zed) OS: macOS 14.3.0 Memory: 24 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

If you only need the most recent lines, you can run the zed: open log command palette action to see the last 1000.

No response

stpoa commented 3 months ago

I have the same problem on my Mac. I opened the project with TypeScript monorepo and I can find only files that are in root directory. After unfolding it also finds other files in unfolded folder.

Zed 0.121.5 MacBook Pro (16-inch, 2019) MacOS Monterey 12.7 CPU: 2,3 GHz 8-Core Intel Core i9 RAM: 32 GB 2667 MHz DDR4 GPU: AMD Radeon Pro 5500M 4 GB

Is there a way to unfold all folders in file tree as a workaround?

JosephTLyons commented 3 months ago

I'm not able to reproduce on my end.

Brand new project, with b.txt nested in nested (I never opened `nested):

SCR-20240208-pkqr

This is a very interesting bug, so I'll keep my eyes peeled. If you run into any other info for reproducing, let me know!

avetisk commented 3 months ago

I'm not able to reproduce on my end.

Here is my full config if it may help:

{
  "assistant": {
    "dock": "bottom",
    "button": false,
    "default_open_ai_model": "gpt-4-1106-preview"
  },
  "active_pane_magnification": 1.5,
  "auto_update": true,
  "autosave": "off",
  "buffer_font_family": "Victor Mono",
  "buffer_font_size": 12,
  "buffer_line_height": "standard",
  "calls": {
    "mute_on_join": true
  },
  "chat_panel": {
    "button": false,
    "default_width": 240,
    "dock": "left"
  },
  "collaboration_panel": {
    "button": false,
    "default_width": 240,
    "dock": "left"
  },
  "confirm_quit": true,
  "cursor_blink": true,
  "diagnostics": {
    "include_warnings": true
  },
  "enable_language_server": true,
  "ensure_final_newline_on_save": true,
  "extend_comment_on_newline": true,
  "features": {
    "copilot": false
  },
  "format_on_save": "on",
  "formatter": "auto",
  "git": {
    "git_gutter": "tracked_files",
    "gutter_debounce": 10
  },
  "hard_tabs": false,
  "hover_popover_enabled": true,
  "inlay_hints": {
    "enabled": true,
    "show_other_hints": true,
    "show_parameter_hints": true,
    "show_type_hints": true
  },
  "journal": {
    "hour_format": "hour12",
    "path": "~/"
  },
  "notification_panel": {
    "button": true,
    "default_width": 240,
    "dock": "bottom"
  },
  "prettier": {
    "semi": false
  },
  "project_panel": {
    "auto_reveal_entries": true,
    "default_width": 240,
    "dock": "left",
    "file_icons": true,
    "folder_icons": true,
    "git_status": true,
    "indent_size": 20
  },
  "relative_line_numbers": true,
  "remove_trailing_whitespace_on_save": true,
  "scrollbar": {
    "git_diff": true,
    "selections": true,
    "show": "auto"
  },
  "seed_search_query_from_cursor": "selection",
  "semantic_index": {
    "enabled": true
  },
  "show_call_status_icon": true,
  "show_completion_documentation": true,
  "show_completions_on_input": true,
  "show_copilot_suggestions": false,
  "show_whitespaces": "all",
  "show_wrap_guides": true,
  "soft_wrap": "editor_width",
  "tabs": {
    "close_position": "left",
    "git_status": true
  },
  "preferred_line_length": 79,
  "tab_size": 2,
  "telemetry": {
    "diagnostics": true,
    "metrics": true
  },
  "terminal": {
    "alternate_scroll": "on",
    "blinking": "terminal_controlled",
    "copy_on_select": true,
    "default_width": 640,
    "dock": "right",
    "env": {},
    "font_family": "Victor Mono",
    "font_size": 12,
    "line_height": "standard",
    "working_directory": "current_project_directory"
  },
  "theme": "Gruvbox Dark Hard",
  "ui_font_size": 14,
  "use_on_type_format": true,
  "ui_font_family": "Zed Mono",
  "use_autoclose": true,
  "vim_mode": true,
  "wrap_guides": [2, 79, 140]
}
palmamartin commented 3 months ago

@JosephTLyons: I observed the same, here is a screen recording:

https://github.com/zed-industries/zed/assets/381/e4cd59a1-5b05-4b18-9962-d00db180e402

It finds the files only if I unfold the folder ./src/lib as you can see.

palmamartin commented 3 months ago

I future investigated and it seem that for me it only happens on Typescript projects, on a Rust or Go project it works as expected. Strange.

It happens on both Zed and Zed Preview:

Zed: v0.122.2 (Zed)
OS: macOS 14.3.1
Memory: 16 GiB
Architecture: aarch64
Zed: v0.123.2 (Zed Preview)
OS: macOS 14.3.1
Memory: 16 GiB
Architecture: aarch64
avetisk commented 3 months ago

Now it's even worse: it only shows files that I have opened 😆

Zed: v0.124.1 (Zed Preview) OS: macOS 14.3.1 Memory: 24 GiB Architecture: aarch64

SomeoneToIgnore commented 3 months ago

Are those files gitignored by any chance?

avetisk commented 3 months ago

Are those files gitignored by any chance?

Well, I don't usually ignore all my codebase, would lose the meaning of using git 😅

When I said "only shows files that I have opened", I really meant that.

Which means, if I have opened none, it will match no file at all.

SomeoneToIgnore commented 3 months ago

Please provide your codebase then (or any public repo that has the same symptoms), it gets quite hard to guess things based on your answers.

avetisk commented 3 months ago

@SomeoneToIgnore here is a fresh repo, create with npx create-next-app@latest: https://github.com/avetisk/zed-issue-7554

You can clone it and open it in zed: CMD-p won't show you any file. I even tried it on the preview version, just in case something was fixed in the meantime, but didn't work.

Zed: v0.124.4 (Zed Preview) OS: macOS 14.3.1 Memory: 24 GiB Architecture: aarch64

avetisk commented 3 months ago

BTW, for those getting this same bug, you can simple use find DIR_1 DIR_N | xargs zed in the terminal to open all your project files (and then CMD-K CMD-W to close everything at once).

Zed behind ultra fast and not using much memory per tab, if your project doesn't have 10K files, this should be enough as a short-term hack.

avetisk commented 3 months ago

This bug seems to affect project search too.

While TS references, definitions, etc., work just fine.

SomeoneToIgnore commented 3 months ago

Thank you for the project example.

Something odd is definitely going on here: I seem to be able to open and search files just fine: https://github.com/zed-industries/zed/assets/2690773/ca177285-de24-468d-a028-43d6f7e822b1

That project had been cloned into ~/Downloads directory and opened with Zed Preview 0.124.4

I do not have any good theories so far:

my config Spoiler text. Note that it's important to have a space after the summary tag. You should be able to write any markdown you want inside the `
` tag... just make sure you close `
` afterward. ```json5 { "base_keymap": "VSCode", "toolbar": { // Whether to show breadcrumbs. // "breadcrumbs": false, // "breadcrumbs": true, // Whether to show quick action buttons. // "quick_actions": true // "quick_actions": false }, //"vim_mode": true, "collaboration_panel": { "dock": "right" }, "ui_font_family": "Monocraft", "buffer_font_family": "Monocraft", "project_panel": { "dock": "left" // "auto_reveal_entries": false }, // "formatter": "", "terminal": { "dock": "right" }, "vector_store": { "enabled": true }, "features": { "copilot": true }, "theme": "One Dark", "format_on_save": "on", "show_whitespaces": "all", "preferred_line_length": 120, "soft_wrap": "editor_width", "cursor_blink": false, "tab_size": 4, "calls": { "mute_on_join": true }, "inlay_hints": { "enabled": true // "enabled": false, // "show_type_hints": false, // "show_parameter_hints": false, // "show_type_hints": true, // "show_parameter_hints": true, }, "autosave": "off", "languages": { "Rust": { "code_actions_on_format": { // "quickfix": true } } }, "lsp": { "rust-analyzer": { "initialization_options": { "inlayHints": { "maxLength": null, "lifetimeElisionHints": { "useParameterNames": true, "enable": "skip_trivial" }, "closureReturnTypeHints": { "enable": "always" } }, "procMacro": { "enable": true, "attributes": { "enable": true } }, "completion": { "snippets": { "custom": { "Arc::new": { "postfix": "arc", "body": [ "Arc::new(${receiver})" ], "requires": "std::sync::Arc", "scope": "expr" }, "Some": { "postfix": "some", "body": [ "Some(${receiver})" ], "scope": "expr" }, "Ok": { "postfix": "ok", "body": [ "Ok(${receiver})" ], "scope": "expr" }, "Rc::new": { "postfix": "rc", "body": [ "Rc::new(${receiver})" ], "requires": "std::rc::Rc", "scope": "expr" }, "Box::pin": { "postfix": "boxpin", "body": [ "Box::pin(${receiver})" ], "requires": "std::boxed::Box", "scope": "expr" }, "vec!": { "postfix": "vec", "body": [ "vec![${receiver}]" ], "description": "vec![]", "scope": "expr" } } } }, "diagnostics": { "experimental": { "enable": true } }, "checkOnSave": false } } } } ```

Either way, now it's a good time to look at Zed logs tail -f ~/Library/Logs/Zed/Zed.log (or use a corresponding command inside Zed) and, if everything fails and you'll be interested to debug still, prepare to run Zed from source — I'll post more details about the places worth adding a few dbg! prints if you're interested.

avetisk commented 3 months ago
  • We do have a "feature" with nested gitignored hierarchies

WAIT! WAIT! WAIT!

There was no mention of "nested .gitignore" anywhere! (I may be blind though).

And indeed, this is the issue...

I am using git for my dotfiles at the root of my user folder, hence ignoring the main code folder which contains all my projects...

I moved the .gitignore file and it works fine!

Now there's another issue: can you add a option that would look up the .gitignore files only within the project scope?

SomeoneToIgnore commented 3 months ago

There was no mention of "nested .gitignore" anywhere! (I may be blind though).

That's what I tried to ask in https://github.com/zed-industries/zed/issues/7554#issuecomment-1961995538 but sure wording was not very elaborate.

hence ignoring the main code folder which contains all my projects...

So, in the end, you have the entire project gitignored, if I read that right? I'm confused given the https://github.com/zed-industries/zed/issues/7554#issuecomment-1962010889 comment stating otherwise.

can you add a option that would look up the .gitignore files only within the project scope?

This is hard — we sure have to do it at some point, but the problem is that whatever indexing strategy you pick, there will be a node_modules of size enough to make you suffer. This becomes harder knowing that not only we have to index the files, but also track their FS events which makes indexing node_modules even a bigger liability — in fact, Zed used to do index all files including the ones .gitignored but it became slow and unresponsive too fast ergo the current approach. What's even worse is that there are people wanting exactly that: having files from node_modules in both file finder and project search: https://github.com/zed-industries/zed/issues/4745

So, we have to somehow solve this, but no good approach had been proposed yet, it's a hard task. I'm going to close this, as there are plenty of issues for this already.

SomeoneToIgnore commented 3 months ago

Last but not least — Zed knows very little (if anything) about language semantics and, in particular, language project semantics, so target, node_modules, .idea, .vscode, custom gitignored directories — they are all the same for Zed.

Whatever heuristics you try to pick to ignore-vs-indexing there, another NewLang + NewBuildTool risks blowing the entire thing up. At this point it seems that we should either add some "indexing whitelists" into Zed settings (which, again, does not save Zed from breaking on some particular project) or redesign the way file finder searches things entirely.

avetisk commented 3 months ago

How do other editors handle this?

Because they do it, and I never stumbled on any performance issues.

I hope this will be solved soon :/

While I love Zed, I just realized the project is not mature enough for me to entirely switch to it.

I'll keep following it, but there's way too many issues for me being able to use it in an efficient way, plus priority can't be focused on my personal needs (which is of course 100% understandable), so...

Hopefully I will see Zed completed before I retire!

nticaric commented 3 months ago

I'm also experiencing this issue, and my files are not being ignored by Git. A potential solution could be to create a ".zed" folder that contains specific settings. This would allow users to manually add indexing rules.

SeanRoberts commented 3 months ago

I ran into this issue right off the bat, my project is nested within a parent folder that gitignores it. I confirmed that moving that parent gitignore file resolved the issue. Unfortunately this makes Zed unusable for me for the time being. Sorry if this comment is unhelpful, just wanted to help confirm the cause of the issue with another data point but maybe it's getting into +1 territory.

nticaric commented 3 months ago

SeanRoberts Thanks for the comment. Upon further investigation, I realized that the .gitignore file was located not in the parent directory, but rather in the grandparent directory. It seems puzzling to me that Zed would search two levels up to find a .gitignore file.

All other editors, that I use, are working just fine, VS Code and Sublime

SeanRoberts commented 3 months ago

I understand the logic behind it. Gitignore is cascading, right? If you have a .gitignore in your home dir that ignores .DS_Store for example that will work system-wide. So I understand why Zed would want to implement that logic and people like you and I that have weird .gitignore setups are likely outliers.

nticaric commented 3 months ago

However, this scenario is quite common. For instance, a straightforward example involves opening a project within a node_modules directory to review some code. It would significantly improve the situation if it didn't search for .gitignore files in parent directories like other editors do

avetisk commented 3 months ago

However, this scenario is quite common. For instance, a straightforward example involves opening a project within a node_modules directory to review some code. It would significantly improve the situation if it didn't search for .gitignore files in parent directories like other editors do

It should do whatever it's told.

That's the whole point of an IDE.

It should provide enough customization to meet the different (at least common) setups.

Adding an option to lookup or not doesn't seem to be too much to ask.

icanq commented 2 months ago

Hi is there any updates on this issue?

SeanRoberts commented 2 months ago

@icanq It's fixed for me in the latest Zed Preview Release

icanq commented 2 months ago

@icanq It's fixed for me in the latest Zed Preview Release

I see, so i need to clean install then, thank you!

avetisk commented 2 months ago

@icanq It's fixed for me in the latest Zed Preview Release

Got the latest version, still not working for me.

Moshyfawn commented 2 months ago

Got the latest version, still not working for me.

Can you please confirm the version number?

avetisk commented 2 months ago

Got the latest version, still not working for me.

Can you please confirm the version number?

Zed: v0.125.2 (Zed Preview) OS: macOS 14.3.1 Memory: 24 GiB Architecture: aarch64

avetisk commented 2 months ago

@Moshyfawn never mind, it works!