Antonio Scandurra
2b4738d82d
Avoid passing a closure to workspace::register_project_item
...
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-17 17:39:25 +01:00
Antonio Scandurra
5d14c9abdf
Introduce workspace::register_project_item
...
This lets downstream crates like `editor` define how project items should be
opened.
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 15:54:34 +01:00
Antonio Scandurra
bff414cfbc
Remove Editor::find_or_create
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 15:13:47 +01:00
Antonio Scandurra
6f9c37851c
Add Editor::for_multibuffer
and repurpose Editor::for_buffer
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 14:39:02 +01:00
Antonio Scandurra
44d997c00c
Rename app_state
to global
in gpui
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 14:33:01 +01:00
Antonio Scandurra
6446660c88
Rename open_buffer_for_path
to open_buffer
2022-03-17 11:42:13 +01:00
Antonio Scandurra
e6755f4115
Search only in active pane when using Editor::find_or_create
2022-03-17 11:39:39 +01:00
Antonio Scandurra
a691c2fbdb
Delete unused code
2022-03-17 11:33:58 +01:00
Antonio Scandurra
0efce8f70a
Rename ItemView
to Item
2022-03-17 11:32:46 +01:00
Antonio Scandurra
aced1e2315
Finish refactoring of how editors are opened
2022-03-17 11:29:46 +01:00
Nathan Sobo
728c708150
WIP: Massage opening of editors
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-03-16 17:40:09 -06:00
Nathan Sobo
0036e5c86c
Replace ProjectEntry struct with ProjectEntryId
...
Previously, we tracked the worktree_id and entry_id separately, but now that entry ids are unique across all worktrees this is unnecessary.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-16 15:59:47 -06:00
Max Brunsfeld
a88320dc5f
Remove workspace::Item trait
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Keith Simmons <keith@zed.dev>
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2022-03-16 13:34:06 -07:00
Max Brunsfeld
76fc9c955e
Restore underline for warnings about unused code
2022-03-15 13:13:33 -07:00
Antonio Scandurra
c6c72a7249
Skip over unnecessary code diagnostics when hitting f8
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:55:39 +01:00
Antonio Scandurra
7155dabf5b
Fade out unnecessary code
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:51:59 +01:00
Antonio Scandurra
021699e51c
Implement shift-f8
to go to previous diagnostic
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:13:23 +01:00
Antonio Scandurra
a6d0caf557
Don't seek FilterCursor
upon creation
...
This lets us use `next` or `prev` to decide whether to park the cursor
at the first or last filtered item.
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:13:23 +01:00
Antonio Scandurra
45ce503afd
Start on implementing filtering support for Cursor::prev
2022-03-15 15:13:23 +01:00
Antonio Scandurra
fbf7cdf4f2
Make all HighlightStyle
properties optional
...
Previously, some of those properties such the font weight, style and color
would be mandatory: when the theme didn't specify them, Zed would use a default
value during deserialization. This meant that those default properties would
unconditionally override the base text style, causing a rendering bug when
combining syntax highlights with diagnostic styles.
This commit fixes that by making `HighlightStyle`s more additive: each property
can be set independently and only the properties that theme specifies get
overridden in the base text style.
2022-03-15 10:39:43 +01:00
Max Brunsfeld
e7835caac4
Merge pull request #621 from zed-industries/autoclose-before-punctuation
...
Autoclose brackets before a language-specific set of characters
2022-03-14 15:33:47 -07:00
Max Brunsfeld
325e6c31ae
Autoclose brackets before a language-specific set of characters
...
Fixes #588
2022-03-14 15:17:40 -07:00
Max Brunsfeld
2c25e619b4
Respect theme's background color when rendering field editors
2022-03-14 14:24:51 -07:00
Max Brunsfeld
e392368d89
Fix layout panic on empty editors with blocks
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-14 12:03:26 -07:00
Antonio Scandurra
21eebede37
Add more assertions to investigate #503 in the future
2022-03-14 16:53:39 +01:00
Antonio Scandurra
a3ea6a34d9
Ensure there's at least one selection in Editor::set_selections
...
This commit introduces an assertion that will cause Zed to panic as
soon as the invariant gets violated. This will be useful to investigate
issue #503 .
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-14 16:17:14 +01:00
Max Brunsfeld
b33a049958
Merge branch 'main' into settings-file
2022-03-13 10:43:23 -07:00
Nathan Sobo
992fc07133
Hide selections in original editor when renaming
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-12 10:45:11 -07:00
Nathan Sobo
308cead8a8
🙊
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-12 10:44:11 -07:00
Nathan Sobo
9f629fa307
Improve selection handling when pending rename is taken
...
- Set selection to the intuitive cursor position when moving up rather than restoring the full selection of the rename editor.
- When cancelling, restore the original selection.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-12 10:30:57 -07:00
Nathan Sobo
33bcd6d904
Merge remote-tracking branch 'origin/main' into select-on-rename
2022-03-12 10:10:23 -07:00
Nathan Sobo
4f086b8d7a
Refresh document highlight after rename, but not during
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-12 10:10:06 -07:00
Antonio Scandurra
965f82ec31
Merge pull request #589 from zed-industries/fold-map-test-failures
...
Avoid re-using excerpt IDs in `MultiBuffer`
2022-03-12 17:59:48 +01:00
Antonio Scandurra
dd1711d53f
Account for all excerpts ever inserted when determining new excerpt ID
2022-03-12 17:50:09 +01:00
Antonio Scandurra
cd4a9f3178
Fix bug in selection position maintenance while renaming symbol
...
We were resolving the selection with the wrong buffer, which now
causes a panic because we don't check the anchor's `buffer_id` anymore.
2022-03-12 13:03:45 +01:00
Max Brunsfeld
48848de82c
Store settings as a global via a gpui app_state
2022-03-11 15:58:58 -08:00
Nathan Sobo
c35a96c425
On rename, replace background highlights with transparent text highlights
2022-03-11 15:54:17 -07:00
Nathan Sobo
951fd1ab36
Merge branch 'main' into select-on-rename
2022-03-11 15:30:07 -07:00
Keith Simmons
87b1cfe34f
Merge pull request #576 from zed-industries/cursor-shape
...
Add support for rendering the cursor as a Block and Underscore
Co-authored-by: Max Brunsfeld <max@zed.dev>
2022-03-11 11:51:24 -08:00
Antonio Scandurra
71aa5e5360
💄
2022-03-11 17:13:28 +01:00
Antonio Scandurra
a74b602f18
Assume the anchor is valid if we can find an excerpt that contains it
2022-03-11 17:08:12 +01:00
Nathan Sobo
5407f25c94
Don't reuse excerpt ids in MultiBuffer
...
This prevents anchors from swapping their ordering, which was causing issues in FoldMap.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-11 08:50:50 -07:00
Antonio Scandurra
c67cfd7fe1
Respect excerpt's range when comparing two anchors both belonging to it
2022-03-11 12:42:22 +01:00
Keith Simmons
5f62f69907
Add unwrap check if buffer_line not available
2022-03-10 20:04:16 -08:00
Nathan Sobo
94bf3366f6
Focus in-progress rename editor when editor is focused
2022-03-10 16:42:20 -07:00
Nathan Sobo
a498cd32c8
When renaming, match the color of the renamed token in the rename editor
2022-03-10 16:38:45 -07:00
Nathan Sobo
69ce021f32
Remove unused variable
2022-03-10 15:27:29 -07:00
Nathan Sobo
3968b37e26
When renaming, fade out the old name and select all
2022-03-10 14:55:31 -07:00
Keith Simmons
5502c00d9a
swap default cursor shape back to bar
2022-03-10 13:28:13 -08:00
Keith Simmons
5b35c68d2e
Fix failing gpui test from missing cursor shape
2022-03-10 13:20:45 -08:00
Keith Simmons
eddb089f27
render character under block cursor
2022-03-10 13:16:31 -08:00
Nathan Sobo
e6b1fea117
WIP
2022-03-10 11:32:14 -07:00
Antonio Scandurra
ee6d7fc6d5
Delete till previous tabstop when backspacing within indent column
2022-03-10 10:28:24 +01:00
Keith Simmons
0d42c85195
fix formatting
2022-03-10 01:09:25 -08:00
Keith Simmons
178442a4a8
Add support for rendering cursors as a block and underscore
2022-03-10 01:09:02 -08:00
Nathan Sobo
ac1eb19f83
Start on text highlight support
2022-03-09 20:51:35 -07:00
Nathan Sobo
49e38e6e00
Eliminate ToFoldPoint trait
...
Just make it a method on FoldMap
2022-03-09 20:49:18 -07:00
Antonio Scandurra
f15e3177d3
Merge pull request #569 from zed-industries/refine-autoclose
...
Refine bracket auto-closing behavior
2022-03-09 16:28:35 +01:00
Antonio Scandurra
97da93c9ec
💄
2022-03-09 15:44:58 +01:00
Antonio Scandurra
d9b3f04436
Surround selections with brackets when they are non-empty
2022-03-09 15:41:54 +01:00
Antonio Scandurra
f54ce8a19c
Autoclose bracket only if next char is whitespace or the end of a pair
2022-03-09 15:38:17 +01:00
Max Brunsfeld
4cb4b99c56
Assign buffer's completion triggers from LSP capabilities
...
Also, make LanguageServer::new() async. The future resolves
once the server is initialized.
2022-03-08 17:41:52 -08:00
Antonio Scandurra
317a1bb07b
Remove language servers from buffers
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-08 15:16:07 -08:00
Antonio Scandurra
29cad65ce0
Open untitled buffers via the Project
...
This allows the registration of such buffers in the project, which is necessary
to correctly support `::save_buffer_as` and opens the door to sharing untitled
buffers with guests in the future.
Note that, for now, this disallows guests to create untitled buffers in the
current window and will create a new window instead. This is because we don't
yet have a global way of allocating a buffer's remote id (nor a way of saving
such buffers in the host's worktree) and we instead rely on the local model ID,
which could clash with the host's buffer IDs.
I think we should revisit this once guests can share their untitled buffers
with the host and other remote peers, as well as once we start keying
operations by entry id.
2022-03-04 15:25:39 +01:00
Antonio Scandurra
dc5a09b3f7
Merge pull request #525 from zed-industries/preserve-worktrees
...
Grow worktrees monotonically when sharing and move most messages to the background
2022-03-04 09:48:18 +01:00
Max Brunsfeld
05df1dfae9
Disable doctests for all libraries
...
We don't use them, and they add a lot of noise to the test output
when running all tests in the workspace.
2022-03-03 16:15:56 -08:00
Antonio Scandurra
68cfce1fb8
Rename weak
to visible
...
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-02 14:38:16 -08:00
Antonio Scandurra
466db69780
Pass a reference to TestAppContext
in tests
...
This allows us to drop the context *after* we ran all futures to
completion and that's crucial otherwise we'll never drop entities
and/or flush effects.
2022-03-01 12:01:02 +01: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
dabb17a2ef
Clone editor's searchable state on split
2022-02-27 09:48:46 -07:00
Nathan Sobo
dd6f8d20a3
Remove carriage returns
2022-02-27 07:47:46 -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
Antonio Scandurra
afea5a3d5e
🎨
2022-02-26 14:31:36 +01: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
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
b506db7c93
Use the new split pane's navigation history when cloning an item
2022-02-25 17:22:30 +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
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
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
9e173564e9
Pass an AsyncAppContext
to fake language server request handlers
2022-02-23 16:14:36 +01:00
Max Brunsfeld
e140f70e3c
Show document highlights from the language server when moving the cursor
2022-02-22 17:16:31 -08:00
Max Brunsfeld
25d45378e4
Implement find-all-references
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-22 14:27:16 -08:00
Max Brunsfeld
64098247cb
Allow languages to be registered at any time
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-22 10:35:20 -08:00
Antonio Scandurra
8a8ae0fbcd
Rename CompletionLabel
to CodeLabel
and add Project::symbols
...
This only works locally for now and we haven't implemented the
`RustLsp::label_for_symbol` method yet.
2022-02-22 10:01:08 +01:00
Nathan Sobo
618f0a127a
Don't insert input in editor when control keys are pressed
2022-02-21 18:21:27 -07:00
Nathan Sobo
c752383042
Merge pull request #459 from zed-industries/spurious-macro-errors
...
Download language servers dynamically on startup
2022-02-21 17:08:50 -08:00
Nathan Sobo
66c69e538e
Don't offset text vertically with gutter margin
...
Fixes #467
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-21 11:41:46 -07:00
Antonio Scandurra
aee479d615
Show message indicating when we're downloading language servers
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-21 17:25:52 +01:00
Antonio Scandurra
cf7cc83f85
Simplify undo_to_transaction
and redo_to_transaction
...
We don't need to mutate the history anymore now that we render pending renames
with a block decoration.
2022-02-19 10:52:21 +01:00
Max Brunsfeld
b573a39cbc
Ensure we never leak block decorations when renaming
2022-02-18 17:00:57 -08:00
Max Brunsfeld
80bca57bfa
Tweak behavior of selections when renaming
2022-02-18 15:44:57 -08:00
Max Brunsfeld
f0a6e8cb9c
Use a block decoration for entering rename text
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-18 13:51:43 -08:00
Antonio Scandurra
d705244210
WIP
2022-02-18 10:47:22 -08:00
Antonio Scandurra
62e5947b76
Cancel pending rename when hitting escape
2022-02-18 15:24:24 +01:00
Antonio Scandurra
20c1a1e310
Use theme to highlight in-progress rename
2022-02-18 12:20:59 +01:00
Antonio Scandurra
a682ebb08d
Add test for preparing and performing a rename
2022-02-18 12:18:01 +01:00
Antonio Scandurra
f9723ae16b
Undo temporary edits before performing rename or canceling it
...
Also, wire up remote renames.
2022-02-18 11:41:47 +01:00
Antonio Scandurra
514d69e83d
Merge branch 'main' into rename
2022-02-18 09:11:05 +01:00
Max Brunsfeld
54d7642712
Start work on renames
2022-02-17 18:01:07 -08:00
Max Brunsfeld
10580f96a3
Automatically include current view id in element state ids
2022-02-17 13:44:46 -08:00
Max Brunsfeld
6d8db5f6bb
Convert some project tests to use FakeFs
...
Also, tweak some FakeFs methods to make them slightly more convenient.
2022-02-17 11:09:27 -08:00
Max Brunsfeld
d173e4ef3c
Fix non-unique ids passed to MouseEventHandlers
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-17 09:44:02 -08:00
Antonio Scandurra
985d216e4b
Make completion unit test on editor more resilient
2022-02-17 17:30:10 +01:00
Max Brunsfeld
90f31bb123
Allow FakeLanguageServer handlers to handle multiple requests
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 16:19:27 -08:00
Max Brunsfeld
c4dff12d69
Allow multiple fake language servers to be started for a given project
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 16:10:36 -08:00
Max Brunsfeld
e9250e647b
Fix mouse event handler for code actions indicator
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-14 14:06:55 -08:00
Antonio Scandurra
fadb94afb2
Use selection instead of just the cursor when fetching code actions
2022-02-14 14:13:36 +01:00
Antonio Scandurra
1eea2f3653
Add integration test for code actions
2022-02-14 11:42:56 +01:00
Antonio Scandurra
8d3b7e996f
Proceed with saving a buffer even if formatting fails
2022-02-12 13:02:19 +01:00
Antonio Scandurra
a2100627c3
Refresh diagnostics and code actions more selectively
2022-02-12 13:01:55 +01:00
Max Brunsfeld
174c9d7ab0
Adjust multibuffer history test to reflect new behavior
2022-02-11 16:55:00 -08:00
Max Brunsfeld
d4b9d9e820
Inline MultiBuffer::format
...
Put all the logic in Editor. Add an `all_buffers` method so the editor can
format all of the buffers by itself.
2022-02-11 16:22:19 -08:00
Max Brunsfeld
06bb8d2779
Fix panic when canceling with a pending selection
2022-02-11 15:31:54 -08:00
Max Brunsfeld
01664d494c
Restructure fake language server to setup request handlers in advance
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 15:08:56 -08:00
Max Brunsfeld
680d1fedc2
Always call set_selections in mouse selection methods
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 09:52:18 -08:00
Max Brunsfeld
947fe848c1
Make multibuffer anchor's buffer_id optional
...
Avoid using 0 for a buffer id on Anchor::min and max
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 09:51:47 -08:00
Nathan Sobo
fa194c8e14
Pass the pending selection to update_selections and set_selections
...
This helps us preserve our invariant of always having at least a pending selection in set_selections when comparing old and new cursor positions.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-11 10:07:42 -07:00
Nathan Sobo
ad9a0e2d4f
Revert "Ensure there's always at least one selection in the editor"
...
This reverts commit b1a44b5816
.
2022-02-11 09:21:04 -07:00
Antonio Scandurra
612a33147a
Allow toggling of code actions
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 17:01:22 +01:00
Antonio Scandurra
7b28418979
Allow deployment of code actions from indicator
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 16:47:40 +01:00
Antonio Scandurra
b1a44b5816
Ensure there's always at least one selection in the editor
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 16:25:26 +01:00
Antonio Scandurra
a41725daee
Render code actions indicator
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 16:01:15 +01:00
Antonio Scandurra
2fcdcac080
Fetch code actions on cursor movement instead of on-demand
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 14:41:19 +01:00
Antonio Scandurra
763d57c94a
Don't return error when definition, completions, etc. are unavailable
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 13:16:17 +01:00
Antonio Scandurra
3fc3e51a44
Fix panic when trying to render a diagnostic that has no message
2022-02-11 12:16:20 +01:00
Antonio Scandurra
4929b8c525
Move Buffer::format
to Project::format
2022-02-11 12:07:46 +01:00
Max Brunsfeld
424b35253a
Don't open a multibuffer when code actions's edits are contained in the current editor
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-10 09:55:21 -08:00
Nathan Sobo
5049c1b286
Make Editor::newest_anchor_selection return a non-optional value
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-10 10:16:54 -07:00
Nathan Sobo
93eb005f74
Correctly redo all undone edits after undoing in multi-buffer
...
When undoing edits performed in the multi-buffer, we also undo subsequent edits that may have occurred outside of the multi-buffer. This commit makes us redo those edits as well.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-10 09:26:20 -07:00
Nathan Sobo
c5b0b5f902
Store the oldest transaction id for each excerpted buffer in multi-buffer transactions
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-10 09:14:39 -07:00
Nathan Sobo
9936bb2efa
Undo subsequent edits when undoing in multi-buffer
...
When undoing in the multi-buffer, don't preserve edits that occurred outside the multi-buffer after the edit being undone.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-10 09:04:53 -07:00
Antonio Scandurra
d1f1563278
Push transaction into multi-buffer to allow undoing of a code action
2022-02-10 09:55:03 +01:00
Antonio Scandurra
dd223f93ec
Allow editor to be saved when in multi-buffer mode
...
Also, this commit enables the customization of the title in a multi-buffer.
When specified, it will take precedence over a filename (or "untitled").
2022-02-10 09:35:19 +01:00
Antonio Scandurra
9ea535986f
Fix push_excerpts_with_context_lines
when ranges overlap
2022-02-10 09:06:11 +01:00
Max Brunsfeld
9749fea705
Start work on MultiBuffer::push_excerpts_with_context_lines
...
Use it in Editor::confirm_code_action
2022-02-09 18:28:15 -08:00
Max Brunsfeld
471c23e22f
Allow inserting multiple excerpts in a batch
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 17:56:06 -08:00
Max Brunsfeld
aa7dfbdd9c
Remove ExcerptProperties struct
...
Pass buffer and range as separate parameters
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 17:52:17 -08:00
Max Brunsfeld
b67be5ded3
Add MultiBufferItemHandle
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 17:09:03 -08:00
Max Brunsfeld
1ee15e1a59
Add and remove excerpts in randomized FoldMap and WrapMap tests
2022-02-09 14:43:24 -08:00
Max Brunsfeld
5b4c0d64bc
Get tests passing and project diagnostics view working w/ new excerpt headers
2022-02-09 13:51:52 -08:00
Max Brunsfeld
3d9c39d0eb
Silence warnings
2022-02-09 13:00:09 -08:00
Max Brunsfeld
fc70c6d4fd
Fix BlockMap's handling of trailing empty excerpt updates with other edits
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 11:54:59 -08:00
Antonio Scandurra
cbf59ffafb
Handle replacing trailing empty excerpt with another empty excerpt
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-09 19:38:18 +01:00
Antonio Scandurra
fab6f0c568
Add/remove excerpts in BlockMap randomized tests and fix resulting errors
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-09 19:10:13 +01:00
Antonio Scandurra
8d95dbe3e6
Render path headers in editor element
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 16:28:18 +01:00
Antonio Scandurra
f1e3d5285b
Fix randomized test failures on BlockMap
with excerpt headers
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 15:17:40 +01:00
Antonio Scandurra
0e1318dfe4
WIP: Make editor
crate compile again
...
Tests are still failing though.
2022-02-09 11:09:11 +01:00
Max Brunsfeld
c7e2fae9cb
WIP - Add excerpt headers as a built-in feature of BlockMap
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-08 18:15:45 -08:00
Max Brunsfeld
6731d92f60
Give the editor a handle to the project, not a weak handle to the workspace
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-08 15:48:44 -08:00
Max Brunsfeld
624dbc1d0e
Fix confirming completions in a multibuffer
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-08 15:05:34 -08:00
Max Brunsfeld
93bcde953c
Consolidate logic for completion alongside code actions in Project
...
This way, completions are dealt with more consistently with code actions,
and the logic is not spread across so many places. The `language::File`
trait and the multibuffer no longer need to deal with completions. Completions
are no longer generic over an anchor type.
2022-02-08 14:24:45 -08:00
Max Brunsfeld
722c84c976
Consolidate all code actions logic into Project
2022-02-08 13:17:57 -08:00
Max Brunsfeld
e0fe8b5a7c
Merge branch 'main' into assists
2022-02-08 12:41:57 -08:00
Max Brunsfeld
8bad05a4ba
Don't populate editor's context menu state if there are no completions
...
This would accidentally stop the enter key from working.
2022-02-08 12:37:20 -08:00
Antonio Scandurra
7d8641afb6
Make transactions serializable to enable edits on behalf of other users
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-08 19:48:21 +01:00
Antonio Scandurra
dca974c7d4
Apply code actions remotely
2022-02-08 12:18:14 +01:00
Max Brunsfeld
e3f055d950
Use a pool of databases to speed up integration tests
...
Also, use env_logger consistently in the tests for each crate.
Only initiallize the logger at all if some RUST_LOG env var is set.
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 15:00:00 -08:00
Antonio Scandurra
8f3ff1590e
Apply edits received from LSP code actions and open all touched buffers
2022-02-07 18:48:45 +01:00
Antonio Scandurra
a172c3c5c6
Apply file-system operations coming from an LSP code action
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 16:11:40 +01:00
Antonio Scandurra
982e90539d
WIP: Start on applying code actions
2022-02-07 12:20:03 +01:00
Nathan Sobo
dc20be256e
Start on code action confirmation
2022-02-05 12:37:34 -07:00
Nathan Sobo
ba99b01de6
Generalize showing and hiding of context menus
...
We still cancel pending completions when hiding the context menu so its not perfectly general, but I think this is ok.
2022-02-05 12:13:02 -07:00
Nathan Sobo
025e83c1ec
Render code actions context menu
2022-02-05 11:04:05 -07:00
Nathan Sobo
93a3f4b615
Move rendering and select prev/next into ContextMenu enum
...
This prepares the way to have a code actions context menu.
2022-02-05 10:19:43 -07:00
Nathan Sobo
ee661516fa
Start generalizing the completions menu into a context menu
...
This will let us render the code actions menu in a way that's mutually exclusive with completions.
2022-02-05 09:43:25 -07:00
Max Brunsfeld
83d4fe8e3a
Start work on code actions
...
Just print out the returned code actions for now
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-04 17:45:00 -08:00
Max Brunsfeld
4900019e9b
Add a ToPointUtf16 trait in text and multibuffer
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-04 17:35:37 -08:00
Antonio Scandurra
fe1729ff70
Merge pull request #424 from zed-industries/fix-goal-column-on-cut
...
Clear selection goal column when cutting a full line
2022-02-04 19:01:23 +01:00
Nathan Sobo
3f897ed588
Clear selection goal column when cutting a full line
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-04 10:19:26 -07:00
Nathan Sobo
c38fe473cd
Delete to hard line boundary when deleting to start/end of line
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-04 10:10:30 -07:00
Nathan Sobo
90a780a604
Improve moving to start or end of soft-wrapped lines
...
When moving to end, stop at the soft-wrap line boundary first, then move to the end of the hard line. Vice versa when moving to the beginning.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-04 09:52:50 -07:00
Nathan Sobo
aa12eb6b55
Span across soft-wraps when triple clicking a line
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-04 09:21:13 -07:00
Antonio Scandurra
bf043fe3fb
Merge pull request #396 from zed-industries/fix-autocomplete-bugs
...
Refine autocomplete
2022-02-04 16:13:16 +01:00
Antonio Scandurra
55f0933872
Show completions as soon as possible
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-04 16:01:04 +01:00
Antonio Scandurra
625beaaa9b
Finish writing test for the new autocompletion behavior
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-04 15:47:19 +01:00
Nathan Sobo
f8dce23440
Merge pull request #394 from zed-industries/fix-selections-after-format
...
Fix selection positions after typing with old selection anchors
2022-02-04 06:02:18 -07:00
Antonio Scandurra
0f266cff54
WIP: Start refactoring completion test
...
The idea is to write more assertions related to how autocompletion
behaves with multiple cursors, prefixes that don't match, etc.
2022-02-04 12:24:04 +01:00
Antonio Scandurra
99d0100c45
Remove unused bytes_at
method
2022-02-04 12:07:30 +01:00
Antonio Scandurra
32859a38ed
Refine autocompletion when text matches a prefix of the suggestion
2022-02-04 12:05:57 +01:00
Antonio Scandurra
8d17287167
Move cursor to diagnostic even if the only diagnostic is currently shown
2022-02-04 09:34:32 +01:00
Max Brunsfeld
d23115f628
Fix selection positions after typing with old selection anchors
2022-02-03 18:14:00 -08:00
Max Brunsfeld
3dfff3866a
Add integration test for getting and resolving completions
2022-02-03 15:24:16 -08:00
Max Brunsfeld
6e33f14218
Confirm completion on tab key as well as enter key
2022-02-03 14:14:24 -08:00
Antonio Scandurra
39152bc85f
Add unit test for multi-cursor snippet
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-03 19:26:24 +01:00
Antonio Scandurra
3e8707ebf6
Support multi-cursor autocompletion
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-03 18:58:36 +01:00
Antonio Scandurra
d56e721fab
Mute color of completion's text that can't be filtered
2022-02-03 15:39:53 +01:00
Antonio Scandurra
1375c7b7e4
Fix panic when trying to show completions but none match the query
2022-02-03 14:36:45 +01:00
Antonio Scandurra
85e6ea1091
Transact on applying completion to allow restoring of selections on undo
2022-02-03 12:10:22 +01:00
Antonio Scandurra
f41f1e51a8
Hide completions when {un,re}doing past initial insertion boundaries
2022-02-03 11:42:52 +01:00
Antonio Scandurra
efcbf2714c
Support clicking on a completion to confirm it
2022-02-03 11:39:19 +01:00
Antonio Scandurra
7865c32727
Optimize summaries_for_anchors
when MultiBuffer
is a singleton
2022-02-03 11:22:55 +01:00
Antonio Scandurra
ab26a175a4
Opt into language-aware features when getting buffer chunks
...
We use chunks a lot to transform points and sync the various display maps,
and always querying tree-sitter or the LSP diagnostics in those cases is
unnecessarily expensive.
2022-02-03 11:21:30 +01:00
Antonio Scandurra
bd441723a0
Cancel innermost snippet insertion when hitting esc
2022-02-03 10:37:15 +01:00
Antonio Scandurra
426ca94b52
Allow completions to bleed off the editor's bounds
2022-02-03 10:23:34 +01:00