Commit graph

3068 commits

Author SHA1 Message Date
Nathan Sobo
64d22925c2 Implement navigation between project search matches 2022-02-27 14:18:04 -07:00
Nathan Sobo
7ef98fb935 Make versions oldest_selection and newest_selection that don't require snapshots
I thought I needed this but actually didn't, but I still kinda think it's a good change for the public interface of Editor.
2022-02-27 13:02:09 -07:00
Nathan Sobo
19b5de2181 Introduce ProjectSearchView constructor
We had some duplication when cloning on split, so this is to unify that before we add any more complexity to construction.
2022-02-27 09:49:16 -07:00
Nathan Sobo
dabb17a2ef Clone editor's searchable state on split 2022-02-27 09:48:46 -07:00
Nathan Sobo
136699e7bd Add log dependency in search crate 2022-02-27 09:25:40 -07:00
Nathan Sobo
c7338ebe88 💄 2022-02-27 09:25:27 -07:00
Nathan Sobo
039765b698 Limit project search tab label to 24 characters
I'd love to fade the text out, but for now I just append an ellipsis.
2022-02-27 08:27:02 -07:00
Nathan Sobo
ec317159d7 Rename "find" to "search"
Search is both a verb and a noun, which makes it more natural to use in situations where we need to name a thing rather than a process.
2022-02-27 08:15:38 -07:00
Nathan Sobo
dd6f8d20a3 Remove carriage returns 2022-02-27 07:47:46 -07:00
Nathan Sobo
28b71cbc03 Select query when focusing query editor
Also: Clear the selection when we focus the results editor because we continue to render the selection even when the editor isn't focused and it looks awkward. Another approach we could take is to not render selections for non-focused editors, either always or with an option. But considering that we select all anyways next time we return focus to the query editor, I think this is ok for now.
2022-02-26 14:12:31 -07:00
Nathan Sobo
e96d0a9355 Activate the *newest* existing project find view on cmd-shift-F 2022-02-26 14:03:14 -07:00
Nathan Sobo
2f427769df Allow a new search to be created with cmd-enter
This replaces the `cmd-alt-shift-F` binding to open a new search. Instead, you can preserve the existing search results by entering a query and then hitting `cmd-enter` instead of `enter`. This opens a new project find view and restores the previous view to whatever query it was previously displaying. It's a bit strange, but I don't want to rely on splitting as the only way of creating multiple sets of search results.
2022-02-26 13:23:05 -07:00
Nathan Sobo
ae1a46a4e4 Render a magnifier icon and the query in project search tab
Also: Wire up events so the modified status updates correctly.
2022-02-26 08:21:38 -07:00
Antonio Scandurra
a78fe4ef6a Don't focus results editor on cmd-shift-f when there are no results 2022-02-26 14:43:02 +01:00
Antonio Scandurra
afea5a3d5e 🎨 2022-02-26 14:31:36 +01:00
Nathan Sobo
f6b7cbd5cf Always open a new project find on alt-cmd-shift-F 2022-02-25 19:48:43 -07:00
Nathan Sobo
60710fa5d5 Only store one nav history entry when opening excerpts
Also: Introduce the ability to disable and enable the nav history directly. This allows us to explicitly push an entry when opening excerpts and then disable all pushes as we open individual buffers.
2022-02-25 19:26:15 -07:00
Nathan Sobo
721258911c Open excerpts on alt-enter
Also: Remove special handling for alt-shift-D binding in diagnostics view that opens excerpts. Rely on alt-enter in all multi-buffers instead.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 16:49:28 -07:00
Nathan Sobo
dea40c5d1a Don't show buffer search UI on ProjectSearchView
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 16:14:45 -07:00
Nathan Sobo
ed6c8b1836 Allow actions to be propagated from nested ViewContexts
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 16:14:16 -07:00
Nathan Sobo
d5cc3fea3d Implement Debug for keymap::MatchResult
Helpful when debugging issues with keystroke dispatch.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 16:13:53 -07:00
Nathan Sobo
92f411f01e Extract generic forward_project_request function on server
All these methods did the same thing with different message types.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 15:20:42 -07:00
Nathan Sobo
e822c6a64e Handle project-wide search on guests
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-25 15:09:47 -07:00
Max Brunsfeld
1278f5484f Add project search RPC messages 2022-02-25 12:38:31 -08:00
Max Brunsfeld
8dce91be23 Upgrade time crates to silence warning on Rust 1.59 2022-02-25 10:39:44 -08:00
Max Brunsfeld
9a97588f79 Eliminate RwLock around LanguageServer's outbound message channel
We observed a deadlock when quitting zed. The main thread was attempting
to acquire a write lock to this outbound message sender. We weren't able
to understand exactly how this occurred, but we removed the use of a
lock there, so this shouldn't happen anymore.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-25 10:04:57 -08:00
Antonio Scandurra
368301fcec Reuse a previous project find whenever possible
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-25 18:30:28 +01:00
Antonio Scandurra
e278c423d3 Don't assume that cloning on split will reuse the same underlying model
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-25 18:30:04 +01:00
Antonio Scandurra
7123407f42 Don't share query editor state after project find has been split
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-25 18:10:48 +01:00
Antonio Scandurra
1e04411066 Don't focus query editor if there are matches on tab switch 2022-02-25 17:23:03 +01:00
Antonio Scandurra
b506db7c93 Use the new split pane's navigation history when cloning an item 2022-02-25 17:22:30 +01:00
Antonio Scandurra
88bfe5acb0 Allow splitting project find and maintain the searches in sync 2022-02-25 16:20:02 +01:00
Antonio Scandurra
29e035a70d Don't report a buffer when it doesn't contain any matches 2022-02-25 15:40:19 +01:00
Antonio Scandurra
2611b5449f Always sync before clearing or removing excerpts from MultiBuffer
We don't have any test that proves this is needed but seems good nonetheless.
2022-02-25 15:36:43 +01:00
Antonio Scandurra
ff0fa0e0bd Gracefully handle passing an empty set of ranges to push_excerpts 2022-02-25 15:36:16 +01:00
Antonio Scandurra
f649074d36 Refine project find's UX
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-25 15:27:34 +01:00
Nathan Sobo
51c645f6b4 Toggle focus between query editor and results on cmd-shift-F 2022-02-25 05:04:45 -07:00
Antonio Scandurra
2147db9b41 Open searched buffers in parallel 2022-02-25 12:29:50 +01:00
Antonio Scandurra
5be93044f6 Focus results editor when project find matches are updated 2022-02-25 12:17:25 +01:00
Antonio Scandurra
561123d6de Avoid extra smol::channel when iterating through snapshot paths 2022-02-25 11:49:33 +01:00
Antonio Scandurra
6a0cca7178 Add a fast path for when the search query is empty 2022-02-25 10:58:45 +01:00
Antonio Scandurra
a077210873 Focus query editor when deploying project-find 2022-02-25 10:58:32 +01:00
Antonio Scandurra
7aacb63762 Respect field editor background, color and selection styling 2022-02-25 10:48:22 +01:00
Antonio Scandurra
0bf944e038 Use Project::search in ProjectFind and show search results 2022-02-25 10:32:45 +01:00
Max Brunsfeld
5644336df3 Merge branch 'main' into project-find 2022-02-24 17:22:09 -08:00
Max Brunsfeld
fb1103e26d
Merge pull request #482 from zed-industries/c-support
Add C support with clangd
2022-02-24 17:16:55 -08:00
Max Brunsfeld
826a458162
Merge pull request #492 from zed-industries/editor-settings
Provide editor styling information separately from editor settings
2022-02-24 17:16:38 -08:00
Max Brunsfeld
47b654063e Provide editor styling information separately from editor settings
* Since regular editors' font sizes and families are controlled by
  the settings and not the theme, don't store a dummy text style in
  the theme. Instead, only store a font color, and synthesize
  the text style for regular editors using both the theme and the
  settings.
* Style single-line and auto-height editors (now called "field
  editors") using a single function that takes the entire theme and
  selects a relevant sub-object.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-24 16:42:00 -08:00
Antonio Scandurra
6d9b003634 WIP: Start sketching in ProjectFindView
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-24 19:07:00 +01:00
Antonio Scandurra
e83d1fc9fc Start on a regex implementation of SearchQuery 2022-02-24 16:33:31 +01:00