Add Search Everywhere feature (JetBrains-style universal search) - #44674
Add Search Everywhere feature (JetBrains-style universal search)#44674portseif wants to merge 1 commit into
Conversation
7c8bf13 to
2bccc6f
Compare
Implement a unified search modal (shift shift) that combines: - File search using fuzzy matching - Symbol search using Tree-sitter outlines (works for all languages) - Action/command search from command palette Features: - Tab filtering (All, Files, Symbols, Actions) - Project-wide symbol indexing with progress indicator - Global symbol cache persisted across modal open/close - File path display for each symbol result - Keyboard shortcut display for actions - Respects .gitignore for file indexing
1855f1b to
98fb42a
Compare
|
If we want to go further in the integration of this PR, maybe it would be necessary to replace the command palette as well as the file search with this modal with the corresponding active tab so as not to duplicate them. |
maxbrunsfeld
left a comment
There was a problem hiding this comment.
Questions
@portseif Can you give more explanation about the decision to do our own symbol index, rather than relying on the language servers? I'm not necessarily opposed to this, but what concrete use case does it solve? What languages are people typically editing where there is no language server available? For languages where there is an LSP, should we prefer that instead of building our own index?
Why would you ever want command palette actions to be mixed into this dataset? They seem very different from the other targets, which are locations in code.
Concrete changes we'd need
- Right now, it looks like the
SymbolCacheis never updated once it is initially populated. If we want to have aSymbolCache, we'll need to keep it up to date as buffers and files change. - I think the
shift shiftbinding matches JetBrains tools. We would want that binding in the Jetbrains keymap. But by default, Zed uses the VS Code keymap. Does it make to still haveshift shiftas the binding? - We would need keyboard control over the tabs. In Zed's
Run/Debugmodal, you can switch between the tabs with the same bindings that you can change tabs in panes. - It would be nice to have previews, similar #44530. Can we share any code there, if we merge that PR?
|
One follow-up on the With this primitive, we could implement the |
|
I do think that we would land this feature if all of the feedback I listed were addressed. I'm going to close this one out for now, to remove it from our review backlog, because I think some large changes are required before it'd be ready to land, but we can re-open it if you make progress on this feedback. Thanks for working on this direction! |
Hey @maxbrunsfeld, I apologize for the delay - was busy on other projects and the holidays. TLDR: I kept running into issues when trying to use LSP symbols with web projects in HTML, CSS, PHP, and JS. That's why I added the
The cache is specifically for the Tree-sitter path, not the LSP path. LSP symbols come fresh from the language server on each query. 1. Why build our own symbol index instead of relying on language servers? The Tree-sitter outline indexing serves a different use case than LSP workspace symbols. LSP symbols are excellent when available, but:
That said, when an LSP is available and responsive, it should probably take priority. The current implementation queries both sources and merges results, but we could consider preferring LSP symbols when they exist and falling back to Tree-sitter outlines otherwise. 2. Why mix command palette actions into this dataset? Fair pushback. The original idea was to mirror JetBrains' "Search Everywhere" which combines files, symbols, and actions in one place. The thinking was: users don't always know whether what they want is a file, a symbol, or a command - they just want to find it. In practice, you're right that actions feel different from code locations. A few options:
What's your preference? I'm happy to remove actions entirely or move them to an opt-in tab. 3. Concrete changes needed SymbolCache updates: Yes, the cache is static after initial population. To keep it current, we'd need to:
Keybinding: Good point. Keyboard tab switching: The debugger modal uses Previews: PR #44530 adds a
If that PR merges first, we could potentially reuse its preview infrastructure directly. |
That makes a lot of sense. Breaking out the
For the // In project.rs
pub fn symbols(&self, query: &str, cx: &mut Context<Self>) -> Task<Vec<Symbol>> {
let lsp_symbols = self.lsp_workspace_symbols(query, cx);
let cached_symbols = self.symbol_cache.query(query);
// Merge, preferring LSP when available for a given file
// Fall back to cached Tree-sitter symbols otherwise
}
I can start on that separate PR. The main work would be:
- Move `SymbolCache` to the project crate
- Subscribe to `BufferEvent::Reparsed` for outline updates on open buffers
- Watch `worktree::Event::UpdatedEntries` for file changes
- Debounce updates to avoid thrashing
- Add a method to query the cache with fuzzy matching
Once that lands, this PR would just consume `Project::symbols` and the UI code stays clean.
Want me to start on that, or would you prefer to scope out the API first? |
Sounds good, thanks for the detailed feedback. I'll work through the changes:
I'll start with the |
|
@maxbrunsfeld Added Symbol Index extraction #45719 & Search Everywhere improvements #45720 |






Summary
Implements a unified "Search Everywhere" modal (similar to JetBrains' Shift+Shift) that allows users to search across files, symbols, and actions from a single interface.
Keybindings:
Shift Shift(double-tap shift key)search_everywhere::ToggleTest Plan
Release Notes
Shift Shifton all platforms): a unified search modal that combines file search, symbol search, and action search in one interface with tab filtering