zed icon indicating copy to clipboard operation
zed copied to clipboard

Project Search not working

Open bklebe opened this issue 1 year ago β€’ 15 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

When I try to search in Project Search, I always get "No results: No results found in project for the provided query."

Environment

Zed: v0.119.21 (Zed) OS: macOS 14.3.0 Memory: 16 GiB Architecture: aarch64

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

Screenshot 2024-01-30 at 10 36 48 Screenshot 2024-01-30 at 10 36 59

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.

zed.log

bklebe avatar Jan 30 '24 15:01 bklebe

Hoping someone has a lead on this because I'm really liking Zed but not having full project search working is like having my left arm cut off, especially for large codebases.

sivy avatar Feb 28 '24 14:02 sivy

I feel the same way, Zed is great but I need full-project search. Had to switch back to VSCode until this is resolved.

bklebe avatar Feb 28 '24 17:02 bklebe

I'm wondering why in the original screenshot, where the entry is listed in the file, the opened file is not selected in the tree view / project panel πŸ€”? It might have something to do with the issue at hand.

Moshyfawn avatar Feb 28 '24 17:02 Moshyfawn

I'm wondering why in the original screenshot, where the entry is listed in the file, the opened file is not selected in the tree view / project panel πŸ€”? It might have something to do with the issue at hand.

I gather there might be some sort of "project" that Zed needs to recognize in order to do search? But I couldn't figure out how to configure it properly. I've done File > Add Folder to Project... but it didn't fix the project search.

bklebe avatar Feb 28 '24 18:02 bklebe

I just added a random huge Node.js project to an already open one and the search seems to have picked up the contents of the file. Maybe I should try to create an Elixir project to try to reproduce the issue.

Moshyfawn avatar Feb 28 '24 18:02 Moshyfawn

I can replicate this with a Python project as well, for what it's worth.

bklebe avatar Feb 28 '24 18:02 bklebe

Is there anything from the setup described in #8419 that you might have in your project?

Moshyfawn avatar Feb 28 '24 18:02 Moshyfawn

My python project is a simple project with no git repo or .gitignore setup.

sivy avatar Feb 28 '24 18:02 sivy

Is there anything from the setup described in #8419 that you might have in your project?

Aha! Yes, my $HOME is a Git repository itself, and all of my projects are nested under it.

bklebe avatar Feb 28 '24 18:02 bklebe

Great, I'm glad we've at least identified the cause of your specific problem. I would suggest +πŸ‘ing the other issue and possibly adding any additional info you may have in the other thread.

It seems like others may have a different bottleneck, so I'll leave this issue open for now.

Moshyfawn avatar Feb 28 '24 18:02 Moshyfawn

After moving my project out of $HOME and into my normal location, project search is working again.

sivy avatar Feb 28 '24 18:02 sivy

For anyone following this thread for this bug, can you try the latest preview version and see if the issue persists?

https://zed.dev/releases/preview

JosephTLyons avatar Mar 04 '24 05:03 JosephTLyons

For anyone following this thread for this bug, can you try the latest preview version and see if the issue persists?

https://zed.dev/releases/preview

I just tried Zed 0.125.1 and I am still running into the same issue of everything being grayed out and search not working, unless I delete ~/.gitignore. One possible problem might be that I have been experimenting with non-Git VCS recently, namely Sapling and Jujutsu, which both use .gitignore but store their repo in .sl or .jj respectively (rather than .git). My $HOME repo is currently .sl. I tried hunting through the diffs to see if this could be the cause but couldn't find the specific commit that was supposed to fix this problem. Additionally, I can still replicate it even if I git init in $HOME, so it might not be related.

bklebe avatar Mar 04 '24 17:03 bklebe

Actually, if I run git init in a project repo, that fixes it, so it probably is related. I think I had the problem a bit backwards, sorry. Intuitively I would expect that the editor would only respect .gitignore in the open folder and not parents of the open folder. I believe this is how VSCode works, as I haven't encountered this issue in that editor, but reading the docs on gitignore (https://git-scm.com/docs/gitignore), it's not exactly how Git works, so maybe it would be better to recognize .sl and .jj as VCS folders instead.

bklebe avatar Mar 04 '24 17:03 bklebe

I suspect it's this code that would need to be updated: https://github.com/zed-industries/zed/blob/9c6a0d98eda255ec934cff1855f5ad1353eb0c86/crates/project_core/src/worktree.rs#L3351-L3354 Happy to look into fixing this myself since I realize non-Git VCS are a bit exotic, though not sure what the project thinks is the best way to go about it.

bklebe avatar Mar 04 '24 17:03 bklebe

I have the same problem . so sad.

finscn avatar May 06 '24 14:05 finscn

Also happening to me using git worktrees. My dir tree:

/.gitignore  <-- contains a single literal `*`, i.e., ignoring everything
 +-- proj1  <-- "main" project dir
   +-- .git  <-- git dir as usual
 +-- proj1_worktree  <-- created with `git worktree add ../proj1_worktree some_branch_name` inside proj1
   +-- .git  <-- just a file, as usual for a git worktree, with content like `gitdir: /full/path/proj1/.git/worktrees/some_branch_name`

When I open zed inside proj1_worktree, all files are greyed out in the Project Panel. I suspect because it's using the "root" .gitignore, and not proj1's .gitignore. When I remove the "root" .gitignore, it seems to work as expected. Thanks!

pineman avatar May 19 '24 13:05 pineman

In Zed, it won't automatically search when you type. After typing the keyword you want to search for within the project, then press > Enter to see the results if any. Screenshot 2024-06-10 at 10 11 31

Quocker22 avatar Jun 10 '24 03:06 Quocker22

I believe this may have been fixed as part of the work on these related issues.

  • #8419
  • #6998

If you are still experiencing this, please open a new issue with as much details as possible. Thanks all!

notpeter avatar Jul 24 '24 14:07 notpeter