Commit Graph

500 Commits

Author SHA1 Message Date
Kirill Bulatov
fbf2f790dd
Return back old project search behavior as default. (#3892)
Add a `workspace::DeploySearch` action and use it as a default for
"cmd-shift-f" binding. This action opens existing search tab if it
exists, or creates a new one otherwise. `workspace::NewSearch` action is
still available and always opens an existing search tab.

Release Notes:

- Added a `workspace::DeploySearch` action and use it as a default for
"cmd-shift-f" binding. `workspace::NewSearch` action is still available
and always opens an existing search tab.
2024-01-05 11:35:28 +02:00
Piotr Osiewicz
783256c80e Move Registrar implementation for Workspace to outer scope.
This fixes various actions like "Activate regex mode" that were dispatched onto main pane instead of assistant search bar.
2024-01-05 00:10:23 +01:00
Piotr Osiewicz
b6655def70 Add DivRegistrar to reduce code duplication 2024-01-05 00:10:23 +01:00
Piotr Osiewicz
9cdcdbea41 Use Registrar in Assistant Panel.
This fixes various actions like "Activate regex mode" that were dispatched onto main pane instead of assistant search bar.
2024-01-05 00:10:23 +01:00
Piotr Osiewicz
5ad125a9e9 Touchups to registrar API 2024-01-05 00:10:23 +01:00
Piotr Osiewicz
f70eddc988 Explore registrar-based API for search bar.
This commit adds a Registrar trait for use by search crate. Registrar can register actions on some target and search can utilize that trait to opaquely add actions on that target.
Notably, search is now opt-in (it always was in zed2 actually). Having editor doesn't make it searchable straight out of the gate. You might have to call BufferSearchBar::new a bunch more.
2024-01-05 00:10:23 +01:00
Kirill Bulatov
4dbec66cdd Return back old project search behavior as default.
Add a `workspace::DeploySearch` action and use it as a default for "cmd-shift-f" binding.
This action opens existing search tab if it exists, or creates a new one otherwise.
`workspace::NewSearch` action is still available and always opens an existing search tab.
2024-01-04 21:17:24 +02:00
Conrad Irwin
84171787a5 Track read_only per project and buffer
This uses a new enum to avoid confusing booleans
2024-01-03 19:31:43 -07:00
Max Brunsfeld
f5ba22659b Remove 2 suffix from gpui
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 12:59:39 -08:00
Max Brunsfeld
dfcb17fe74 Remove 2 suffix for theme
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 12:41:01 -08:00
Max Brunsfeld
4305c5fdbe Remove 2 suffix for ui, storybook, text
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 12:33:51 -08:00
Max Brunsfeld
0cf65223ce Remove 2 suffix for collab, rope, settings, menu
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 12:29:16 -08:00
Max Brunsfeld
5ddd298b4d Remove 2 suffix for fs, db, semantic_index, prettier
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 12:09:42 -08:00
Max Brunsfeld
53bdf6beb3 Remove 2 suffix for client, call, channel
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 12:02:14 -08:00
Max Brunsfeld
9f99e58834 Remove 2 suffix for lsp, language, fuzzy
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 11:58:02 -08:00
Max Brunsfeld
c5a1950522 Remove 2 suffix for project
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 11:53:34 -08:00
Max Brunsfeld
789ce8dd75 Remove 2 suffix for workspace
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 11:08:51 -08:00
Max Brunsfeld
588976d27a Remove 2 suffix for editor
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 10:58:57 -08:00
Max Brunsfeld
0ac8aae17b Remove 2 suffix for language_tools, search, terminal_view, auto_update
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-03 10:52:40 -08:00
Kirill Bulatov
da44b51a53 Always open new project search view workspace::NewSearch action 2023-12-11 13:11:07 +02:00
Kirill Bulatov
c2751c717e Parallelize ignored entries for search lookup 2023-11-23 09:53:00 +02:00
Kirill Bulatov
71e9bd8fa3 Use a git file icon for toggle gitignored search option 2023-11-22 19:09:10 +02:00
Kirill Bulatov
566857b0b7 Output non-ignored files first 2023-11-22 19:03:27 +02:00
Kirill Bulatov
92953fb53d If enabled, search in ignored files during project search 2023-11-22 16:41:02 +02:00
Kirill Bulatov
8180938401 Fix most of the TODOs 2023-11-17 21:40:57 +02:00
Kirill Bulatov
c52fe2f536 Move toggle ignored button into include directories editor 2023-11-17 21:40:56 +02:00
Kirill Bulatov
a5c615ceb4 Pass a new query parameter into the search 2023-11-17 21:40:56 +02:00
Kirill Bulatov
d673efebd2 Add prettier workspace resolution test 2023-11-03 11:02:50 +02:00
KCaverly
4835c77840 update text for project search if not authenticated 2023-10-21 10:28:54 -04:00
KCaverly
106115676d update semantic search to use keychain as fallback 2023-10-21 10:19:50 -04:00
Piotr Osiewicz
99121ad5cd
buffer_search: Discard empty search suggestions. (#3136)
Now when buffer_search::Deploy action is triggered (with cmd-f), we'll
keep the previous query in query_editor (if there was one) instead of
replacing it with empty query.

This addresses this bit of feedback from Jose:
> If no text is selected, `cmd + f` should not delete the text in the
search bar when refocusing

Release Notes:
- Improved buffer search by not clearing out query editor when no text
is selected and "buffer search: deploy" (default keybind: cmd-f) is
triggered.
2023-10-18 18:05:13 +02:00
Piotr Osiewicz
6ccaf55e54
search: Reorder items in search bar (#3039)
Release Notes:

- Reordered items in project and buffer search bar
2023-09-27 16:51:20 +02:00
Piotr Osiewicz
36f022bb58
project_replace: Fix up key bindings (#3034)
Release Notes:
- N/A
2023-09-26 18:40:41 +02:00
Conrad Irwin
359847d047 Revert "Revert "workspace: Improve save prompt. (#3025)""
This reverts commit 5c75450a77.
2023-09-25 12:18:03 -06:00
Conrad Irwin
769c330b3d Merge branch 'vim-command' 2023-09-25 11:41:13 -06:00
Kyle Caverly
3c2b05be90
add semantic index status, for non authenticated users (#3005)
Update project search semantic ui to accommodate for users who have not
set the OPENAI_API_KEY in their environment variables.

Release Notes:

- Expand Semantic Index status to include status for non authenticated
users
- Update Search UI to illustrate this status.
2023-09-21 14:18:58 -04:00
KCaverly
997f362cc2 add semantic index status, for non authenticated users 2023-09-21 13:40:01 -04:00
Piotr Osiewicz
dbfa1d7263
[WIP] Replace in project (#2984)
Targeting Preview of 09.27.
This is still pending several touchups/clearups:
- We should watch multibuffer for changes and rescan the excerpts. This
should also update match count.
- Closing editor while multibuffer with 100's of changed files is open
leads to us prompting for save once per each file in the multibuffer.
One could in theory save in multibuffer before closing it (thus avoiding
unnecessary prompts), but it'd be cool to be able to "Save all"/"Discard
All".

Release Notes:

- Added "Replace in project" functionality
2023-09-21 16:27:58 +02:00
Conrad Irwin
a25fcfdfa7 Iron out some edge-cases 2023-09-20 20:44:42 -06:00
Conrad Irwin
2d9db0fed1 Flesh out v1.0 of vim : 2023-09-20 20:44:41 -06:00
Conrad Irwin
f4d4a2f41b
vim fixes for find&replace (#2995)
* allow replacing with the empty string to delete
* fix <enter> for ReplaceNext (in vim mode)

Release Notes:

- allow replacement to be empty
2023-09-20 16:42:39 -06:00
KCaverly
37a0c6615f remove conditional action registration for activate semantic search mode 2023-09-20 12:38:29 -04:00
KCaverly
22d095bd35 enable project search states to persist between workspace project searches 2023-09-20 12:12:01 -04:00
KCaverly
28ed406d54 add keymaps for activating text, regex and semantic modes 2023-09-20 10:04:43 -04:00
KCaverly
912e6e8091 create initial action for Semantic search mode 2023-09-20 09:48:27 -04:00
Conrad Irwin
2da664ed17 vim fixes for find&replace
* allow replacing with the empty string to delete
* fix <enter> for ReplaceNext
2023-09-19 20:48:01 -06:00
Piotr Osiewicz
4525509804
buffer/replace: Advance match index on each replace. (#2992)
Release Notes:
- Fixed "Replace next" not advancing the match index.
2023-09-19 23:56:22 +02:00
Piotr Osiewicz
616d328f3c
chore: Use aho-corasick 1.1 in direct dependencies (#2983)
Nothing too fancy, we've depended indirectly on 1.0/1.1 already, so this
is essentially bookkeeping.

Release Notes:
- N/A
2023-09-18 17:01:08 +02:00
Nate Butler
24974ee2fa Unify icons using multiple variants, remove all unused icons 2023-09-15 12:50:49 -04:00
Kirill Bulatov
8d3c251cc2
Rework inlay hover model (#2969)
Fixes
```
thread 'main' panicked at 'byte index 2 is not a char boundary; it is inside '…' (bytes 0..3) of `…)`'
```
panics like
https://zed-industries.slack.com/archives/C04S6T1T7TQ/p1694535396473329

by reworking the inlay hover model:
* avoid storing "hardcoded" coordinates of hovered inlay labels (such as
`InlayOffset`), instead, remember `inlay_id` and apply required
highlights there when hint with the same id is handled
* add randomized tests on inlay highlights
* sped up inlay hint cache lookup by inlay_id

As a downside, background highlights are no long appearing on inlay
hints, but Zed does not receive any tooltips for inlays anyway (r-a does
not send them for some reason, other LSP seem to have no such feature?),
so it does not matter now.
Nontheless, if the logic for displaying hint pop-ups is present and
works for harcoded tooltips in r-a, only background highlight is missing
now.

Release Notes:

- Fixed inlay hint highlights causing panic for certain cases with
"large" characters
2023-09-15 10:40:02 +03:00
Piotr Osiewicz
a1353b8bb9
search_bar: Add toggle_replace_on_a_pane. (#2966)
This allows users to add a keybind to ToggleReplace from Editor/Pane
contexts.

Release Notes:
- Fixed replace in buffer not reacting to keyboard shortcuts outside of
search bar<preview-only>.
2023-09-14 23:25:27 +02:00
KCaverly
8ff3e37044 small fix to rate status update 2023-09-14 15:42:21 -04:00
Kirill Bulatov
890a587254 Use standalone inlay background highlights 2023-09-14 22:08:12 +03:00
Joseph T. Lyons
15bdff1c5b Fix toggle replace tooltip 2023-09-13 20:19:14 -04:00
Piotr Osiewicz
a63b78d5a0
Replace in buffer adjustments (#2960)
This PR addresses feedback from @maxbrunsfeld on new replace in buffer.
It fixes:
- missing padding surrounding replace input.
- missing padding around replace buttons.
- missing `.notify` call which made the replace fields not show up
immediately sometimes.

Release Notes:
- N/A

---------

Co-authored-by: Max <max@zed.dev>
2023-09-12 22:08:39 +02:00
Piotr Osiewicz
4cb8647702
Z 1200/replace in buffer (#2922)
This is still WIP, mostly pending styling. I added a pretty rudimentary
text field and no buttons whatsoever other than that. I am targeting a
Preview of 09.13, as I am gonna be on PTO for the next week.

I dislike the current implementation slightly because of `regex`'s crate
syntax and lack of support of backreferences. What strikes me as odd wrt
to syntax is that it will just replace a capture name with empty string
if that capture is missing from the regex. While this is perfectly fine
behaviour for conditionally-matched capture groups (e.g. `(foo)?`), I
think it should still error out if there's no group with a given name
(conditional or not).
Release Notes:

- Added "Replace" functionality to buffer search.
2023-09-12 18:46:54 +02:00
KCaverly
e678c7d9ee swap
SystemTime for Instant throughout rate_limit_expiry tracking
2023-09-11 10:26:14 -04:00
KCaverly
7df21f86dd move cx notify observe for rate_limit_expiry into ProjectState in the semantic index
Co-authored-by: Antonio <antonio@zed.dev>
2023-09-11 10:11:40 -04:00
KCaverly
37915ec4f2 updated notify to accomodate for updated countdown 2023-09-08 16:53:16 -04:00
KCaverly
bf43f93197 updated semantic_index reset status to leverage target reset system time as opposed to duration 2023-09-08 15:04:50 -04:00
KCaverly
a5ee8fc805 initial outline for rate limiting status updates 2023-09-08 12:35:15 -04:00
Antonio Scandurra
eda7e00645 Implement SemanticIndex::status and use it in project search
Co-Authored-By: Kyle Caverly <kyle@zed.dev>
2023-09-07 19:39:30 +02:00
Antonio Scandurra
47d7aa0b91 Allow searching before indexing is complete
Co-Authored-By: Kyle Caverly <kyle@zed.dev>
2023-09-07 19:04:45 +02:00
Antonio Scandurra
65e17e212d Eagerly index project on workspace creation if it was indexed before
Co-Authored-By: Kyle Caverly <kyle@zed.dev>
2023-09-07 18:51:55 +02:00
Antonio Scandurra
93b889a93b Merge remote-tracking branch 'origin/main' into semantic-search-watch-worktrees 2023-09-07 15:07:46 +02:00
Antonio Scandurra
de0f53b39f Ensure SemanticIndex::search waits for indexing to complete 2023-09-06 11:40:59 +02:00
Antonio Scandurra
3c70b127bd Simplify SemanticIndex::index_project
Co-Authored-By: Kyle Caverly <kyle@zed.dev>
2023-09-05 16:54:48 +02:00
Nate Butler
f0ab27a83d Reorder "Select All" button 2023-08-29 14:04:17 -04:00
Max Brunsfeld
70bea75897 Change cycle mode action to reflect new mode button order 2023-08-28 15:15:54 -07:00
Max Brunsfeld
3eee282a6b Overhaul search bar layout
* Use a single row, instead of centering the search bar within a double-row toolbar.
* Search query controls on the left, navigation on the right
* Semantic is the final mode, for greater stability between buffer and project search.
* Prevent query editor from moving when toggling path filters
2023-08-28 14:20:09 -07:00
Max Brunsfeld
04354675ca Remove search dismiss button 2023-08-28 10:35:23 -07:00
Piotr Osiewicz
07b9c6c302
language: Make Buffer::new take an explicit ID (#2900)
See Linear description for the full explanation of the issue. This PR is
mostly a mechanical change, except for the one case where we do pass in
an explicit `next_id` instead of `model_id` in project.rs.

Release Notes:
- Fixed a bug where some results were not reported in project search in
presence of unnamed buffers.
2023-08-28 11:51:50 +02:00
Piotr Osiewicz
2495d6581e
Un serialize project search (#2857)
This is the first batch of improvements to current project search. There
are few things we can do better still, but I want to get this out in
next Preview.
Most of the slowness at this point seems to stem from updating UI too
often.

Release Notes:
- Improved project search by making it report results sooner.

---------

Co-authored-by: Julia Risley <julia@zed.dev>
2023-08-26 01:31:52 +02:00
Max Brunsfeld
404f76739c Format let-else statements 2023-08-25 10:11:32 -07:00
Kyle Caverly
bc7e9088fe
Eager Semantic Indexing Queue (#2886)
Optimization to the Semantic Indexing Engine.

We've transitioned from a framework in which the entire project tree is
walked at each index command, to an eager queuing method, in which an
initial queue of outstanding indexing work is initialized upon workspace
creation, and then subscriptions are leveraged for file change events to
continually keep an updated view on outstanding work.

This optimization contributes towards quicker user feedback, when
initializing or using Semantic Search functionality. It also opens the
doors towards better transparency across the system on outstanding
indexing work.

Release Notes:

- Refactored index operation queue to an eager queuing framework.
- Moved semantic search initialization to workspace creation.
- Adjusted rate limiting strategy on api delays to reduce time spent
waiting for rate limits.
2023-08-25 11:03:05 +02:00
KCaverly
ee97bc54cf cleaned up warnings 2023-08-25 10:38:01 +02:00
Joseph T. Lyons
8288e5591d Automatically enable project search filters when using Search Inside 2023-08-25 02:21:07 -04:00
KCaverly
0b204bfdc8 reindex semantic index when search project pane is reactivated in semantic mode
Co-authored-by: Piotr <piotr@zed.dev>
2023-08-24 13:40:04 +02:00
KCaverly
a1519e4c38 move semantic search project intialization to a subscribe event for workspace created
Co-authored-by: Piotr <piotr@zed.dev>
2023-08-24 13:14:19 +02:00
Mikayla
707ca34f19
Merge branch 'main' into disclosable-component 2023-08-23 16:30:27 -07:00
KCaverly
b72c4c576b catchup with main 2023-08-23 22:31:39 +02:00
KCaverly
e42b9e910e fix async calls on project updated entries to ensure that all files are updating appropriately 2023-08-23 22:28:30 +02:00
Nathan Sobo
d375f7992d Merge branch 'main' into divs 2023-08-22 16:35:56 -06:00
KCaverly
aabdfa210f working on initialization + index breakup 2023-08-22 14:45:27 +02:00
KCaverly
ced2b2aec3 reworked ProjectState to include additional context 2023-08-22 11:58:48 +02:00
Piotr Osiewicz
67a48ec106 project_search: use search history's current entry as a tab name.
Previously the tab name for Semantic Search was not updated, as we didn't have an active query to go off of

Co-authored-by: Kyle <kyle@zed.dev>
2023-08-21 13:30:32 +02:00
Mikayla
e946b0a2ec
Finish building out adapters and names
Document core traits
Add start for a component storybook
2023-08-19 14:40:05 -07:00
Mikayla
bd3ab82dac
Add disclosable components into channels
Rename components to more closely match their purpose
2023-08-19 05:18:53 -07:00
Mikayla
2d37128693
Actually get it compiling, omg 2023-08-18 19:02:27 -07:00
Mikayla
3178adefde
WIP: Add disclosable channels 2023-08-18 18:11:05 -07:00
Mikayla
48553d7c8f
Revert "Remove semantic search UI"
This reverts commit c0f042b39a.
2023-08-18 16:18:28 -07:00
Mikayla
4c15f26eba
Finish rename correctly 2023-08-18 15:26:36 -07:00
Mikayla
66e94aa199
Make search re-query eagerly when changing modes
Fix a bug where focus could be lost when clearing the search results
2023-08-17 17:53:58 -07:00
Mikayla
c0f042b39a
Remove semantic search UI 2023-08-17 17:28:09 -07:00
Mikayla
21fa6090b8
Add action button component for rendering the search options 2023-08-17 17:28:09 -07:00
Mikayla
8630557ece
Add action button component for rendering the search options 2023-08-17 15:30:40 -07:00
KCaverly
b7dd12e53e ensured search results are cleared appropriately while cycling modes 2023-08-17 11:11:09 +01:00
Mikayla
afebe3faf8
Merge branch 'main' into project_search_design 2023-08-17 01:56:05 -07:00
Kirill Bulatov
1938fd85e8 Do not leak pane handles 2023-08-16 23:38:11 +03:00
Kirill Bulatov
5c3d563f0f Draft quick actions bar 2023-08-16 23:38:11 +03:00