Antonio Scandurra
3a69943df3
Require that PartialEq
is implemented for Action
2022-06-06 09:18:44 +02:00
Max Brunsfeld
724affc442
Upgrade deps to avoid multiple versions of transitive deps
...
* env_logger
* prost-build
* bindgen
2022-06-02 17:38:33 -07:00
Antonio Scandurra
238827642a
Align tooltip based on the available window space
2022-06-01 10:03:46 +02:00
Antonio Scandurra
aefdde66a6
Pass a &mut BlockContext
when rendering blocks
...
This wraps and derefs to `RenderContext<Editor>`, so that we can
easily use `MouseEventHandler`s in blocks.
2022-05-31 15:50:34 +02:00
Antonio Scandurra
339069b1d3
Cap MessageStream
buffer size to 1MB
...
We temporarily let it grow when the message size exceed the limit,
but restore the buffer's capacity shortly after. This ensures that,
for each connection in its entire lifetime, we only ever use 1MB.
2022-05-31 11:16:32 +02:00
Antonio Scandurra
20e1044d49
Merge branch 'main' into project-panel-with-new-mouse-events
2022-05-30 18:29:46 +02:00
Keith Simmons
4a5317b6e4
Remove unused context_menu file in rust crate
2022-05-27 11:32:15 -07:00
Antonio Scandurra
9099c40364
Merge branch 'mouse-events' into project-panel-context-menu
2022-05-27 12:07:00 +02:00
Nathan Sobo
893f15ddab
Switch MouseEventHandler to use MouseRegions
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 20:00:01 -06:00
Nathan Sobo
2ea085b178
Pass a RenderContext to UniformList
...
In some cases, we need to render during layout. Previously, we were rendering with a LayoutContext in some cases, but this commit adds the ability to retrieve a render context with a given handle and we use that feature in UniformList.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:03:34 -06:00
Keith Simmons
8e7c6871db
Track selection changes in mutable selections collection
2022-05-26 17:02:05 -07:00
Max Brunsfeld
42cd2ae142
Avoid switching to visual mode when following in vim mode
...
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-05-26 17:02:05 -07:00
Keith Simmons
d11bc2a4b7
Fixup paste locations
2022-05-26 17:02:05 -07:00
Keith Simmons
e104cb94e7
fix bug in marked_range utils
2022-05-26 17:02:05 -07:00
Keith Simmons
98f9575653
WIP
2022-05-26 17:02:05 -07:00
Keith Simmons
e93c49f4f0
Unify visual line_mode and non line_mode operators
2022-05-26 17:02:05 -07:00
Keith Simmons
61f0daa5c5
Visual line mode handles soft wraps
2022-05-26 17:02:05 -07:00
Keith Simmons
082036161f
Enable copy and paste in vim mode
2022-05-26 17:02:05 -07:00
Keith Simmons
d094d1d891
WIP copy on delete
2022-05-26 17:02:05 -07:00
Keith Simmons
f8f316cc64
Working change and delete in line mode
2022-05-26 17:02:05 -07:00
Keith Simmons
d7d17b2148
WIP line mode operations
2022-05-26 17:02:05 -07:00
Nathan Sobo
0866f0ed55
Introduce CursorRegion struct
...
This will blend in with an upcoming MouseRegion struct that sits next to it in the scene.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-26 11:00:10 -06:00
Nathan Sobo
6b96822c1a
Fix editor tests
2022-05-26 09:59:25 +02:00
Nathan Sobo
b110fd5fb7
Render a context menu when right-clicking in project panel
...
It doesn't currently do anything, but I managed to get it rendering in an absolutely positioned way.
2022-05-26 09:59:25 +02:00
Max Brunsfeld
acf9a59cc2
Merge pull request #1027 from zed-industries/missing-menu-commands
...
Add missing File menu commands, improve handling of unsaved multibuffers
2022-05-23 21:29:32 -07:00
Max Brunsfeld
0becbe482a
Distinguish between singleton and non-singleton workspace items
...
* Prompt to save singleton items before non-singleton ones
* Don't prompt to save multi-buffers if they contain excerpts to items that are open elsewhere and not being closed.
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-05-23 16:03:00 -07:00
Max Brunsfeld
fbd589b589
Start work on handling multibuffers properly when closing unsaved buffers
2022-05-22 16:48:33 -07:00
Antonio Scandurra
37ca06df53
Clear multi-buffer redo stack when pushing transaction onto undo stack
2022-05-22 10:44:32 +02:00
Max Brunsfeld
e72f5cea22
Add "New Window" command
2022-05-20 11:01:20 -07:00
Max Brunsfeld
c4fc3d9c7f
Merge pull request #1023 from zed-industries/app-menu-improvements
...
Correctly populate application menus' keystrokes and enabled status
2022-05-20 10:22:20 -07:00
Max Brunsfeld
ef0b584532
Remove AppState from workspace actions
...
This allows those actions to be bound to keystrokes in the keymap.
Also, remove the WorkspaceParams struct, simplify how Workspaces are
constructed.
2022-05-19 14:37:26 -07:00
Keith Simmons
bacfed37b7
Clone selections on editor split
2022-05-19 11:22:53 -07:00
Antonio Scandurra
c0bf4a5bfd
Bump FoldSnapshot version if excerpt gets edited outside of its bounds
...
This will cause layers above `FoldMap` to grab a fresh snapshot of the `FoldMap`
and, as a result, of the underlying `MultiBufferSnapshot`. It is a necessary change
because, even though the coordinate space is not affected, a buffer edit taking place
*before* an excerpt range could cause the excerpt buffer rows to change, e.g. if
lines were added or removed. This manifested itself in a randomized test.
2022-05-18 10:13:18 +02:00
Keith Simmons
a2fd41174f
Reduce accessibility of multibuffer read to reduce risk of borrowing snapshot and buffer refcells twice
2022-05-13 16:58:30 -07:00
Keith Simmons
45ea3d4c38
Review fixes
2022-05-13 15:55:27 -07:00
Keith Simmons
20c97637a4
minor tweaks to selections collection api
2022-05-13 15:55:27 -07:00
Keith Simmons
c3a36e6d8a
Rename selected_ranges and selected_display_ranges to remove redundant selected
2022-05-13 15:55:27 -07:00
Keith Simmons
de9dc27980
store buffer and display_map model handles on selections collection
2022-05-13 15:55:27 -07:00
Keith Simmons
db0a9114c2
Passing tests and removed local argument. Also pulled autoscroll argument out to change_selections
2022-05-13 15:55:27 -07:00
Keith Simmons
c9dcfff607
Move selection helpers to SelectionCollection, add update_anchor_selections, add a number of invariant preserving mutation functions to the MutableSelectionCollection
2022-05-13 15:55:17 -07:00
Keith Simmons
c4738d7316
Add test coverage for same cursor in multiple excerpts of the same buffer
2022-05-10 14:30:27 -07:00
Keith Simmons
68de51ba8a
Fix multiple cursors inserting repeated text in multibuffers
2022-05-10 13:32:27 -07:00
Keith Simmons
6c57fcf9be
Merge pull request #968 from zed-industries/vim-visual-mode
...
Vim visual mode
2022-05-10 12:51:58 -07:00
Keith Simmons
37c921f972
Initial visual mode
2022-05-10 11:12:28 -07:00
Antonio Scandurra
61346f734d
WIP
2022-05-05 15:15:58 +02:00
Max Brunsfeld
8fdc5c9be3
Improve the appearance of project panel filename editor
...
* Always layout single-line editors with a fixed height
* Preserve directory chevron when editing folder names
* Allow theming the filename editor
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-05-04 10:28:44 -07:00
Max Brunsfeld
d4492086b3
Abstract more local project setup inside Project::test helper
2022-05-04 10:28:09 -07:00
Antonio Scandurra
aa4919a76f
Merge pull request #964 from zed-industries/transpose
...
Introduce `Editor::transpose` bound to `ctrl-t`
2022-05-04 10:04:55 +02:00
Antonio Scandurra
9a7c07f539
Improve transpose when cursors are two chars away from each other
2022-05-04 09:59:34 +02:00
Antonio Scandurra
95680aa5f2
Account for multi-byte characters in Editor::transpose
2022-05-03 14:35:03 +02:00
Antonio Scandurra
b6ff07afac
Add failing test for multi-byte characters
2022-05-03 14:33:57 +02:00
Antonio Scandurra
070607c821
Implement Editor::transpose
without accounting for multi-byte chars
2022-05-03 14:33:43 +02:00
Keith Simmons
b2138f5935
Add insert line above and below
2022-05-02 11:49:10 -07:00
Keith Simmons
833a7b6e76
WIP just missing insert line above and below
2022-05-02 11:49:10 -07:00
Antonio Scandurra
2977b33dd9
Use the new batched edit API when pasting
...
This fixes a bug that would cause zed to paste text at the wrong
location when inside a multi-buffer where the same buffer was excerpted
more than once.
2022-05-02 10:21:53 +02:00
Antonio Scandurra
5821ce9b82
Insert newlines on paste if copied selections don't match current ones
2022-05-02 10:21:20 +02:00
Keith Simmons
d4bef67cf2
Merge pull request #929 from zed-industries/non-uniform-batched-edits
...
Allow batched edits where each range is associated with different insertion text
2022-04-29 16:14:38 -07:00
Keith Simmons
2eb1c107ce
Convert common edit strings to Arc<str> and simplify duplicate line
2022-04-29 14:57:20 -07:00
Max Brunsfeld
2c2ca1bfbd
Reduce string allocations in Editor::insert
...
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-29 10:07:21 -07:00
Keith Simmons
b4b61b4bbc
Consolidate edit and edit_batched functions
2022-04-28 16:52:04 -07:00
Max Brunsfeld
fa358c01cf
Add format_on_save setting
...
This lets you turn of formatting on save for specific languages.
2022-04-28 14:31:06 -07:00
Keith Simmons
74b467aaa8
tweak editor selection mutating functions
2022-04-28 13:46:06 -07:00
Keith Simmons
42b900774e
add anchor to selection fixup info in newline
2022-04-28 13:10:31 -07:00
Max Brunsfeld
37a3cead03
Merge pull request #921 from zed-industries/new-status-bar-design
...
Style the status bar according to the latest design
2022-04-28 12:42:25 -07:00
Antonio Scandurra
0bb889afec
Merge pull request #923 from zed-industries/navigate-panic
...
Clip `scroll_top_row` before navigating back to it
2022-04-28 10:22:09 +02:00
Keith Simmons
04fc1d5982
Building, but failing test WIP
2022-04-27 17:25:38 -07:00
Max Brunsfeld
a3700e0dd8
Combine diagnostic status w/ diagnostic message indicators
...
Improve the indicator styling
2022-04-27 14:25:39 -07:00
Max Brunsfeld
3ad13bdd4f
Display buffers in order of their path in refactor multibuffers
...
Previously, they were non-deterministically ordered via a HashMap iterator.
This was causing integration tests to fail spuriously on PRs.
2022-04-27 14:01:37 -07:00
Antonio Scandurra
c9478cab09
Don't panic when navigation data contains invalid anchors and/or points
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-04-27 16:51:48 +02:00
Antonio Scandurra
cde5a45318
Clip scroll_top_row
before navigating back to it
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-04-27 16:25:26 +02:00
Keith Simmons
c61ae6f31f
Merge pull request #877 from zed-industries/misc-normal-commands
...
Add inclusive vs exclusive motions to vim mode
2022-04-22 14:25:56 -07:00
Nathan Sobo
92f040df00
Apply cursor styles during paint
...
This makes the editor's cursor an IBeam and properly deals with nested cursor styles.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-04-22 10:54:18 -06:00
Antonio Scandurra
53bf7b61c0
Merge pull request #887 from zed-industries/fix-typescript-rename
...
Use document highlights to prepare rename if LSP doesn't support it
2022-04-22 16:37:13 +02:00
Antonio Scandurra
5e16adc6c9
Use document highlights to prepare rename if LSP doesn't support it
2022-04-22 15:43:57 +02:00
Nathan Sobo
8ec2b5e359
Delete selected text when deleting to beginning of line
2022-04-22 06:04:14 -06:00
Keith Simmons
5ea782de21
Add inclusive vs exclusive motions to vim mode
2022-04-21 16:50:23 -07:00
Antonio Scandurra
5081eafa9d
Always wrap lines that are wider than 512 em advances
...
We went with a more conservative upper bound so that the number of
characters (hopefully) never exceeds `MAX_LINE_LEN` (1024) when laying
out text.
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-04-21 19:29:37 +02:00
Antonio Scandurra
2695b13947
Always clear rename state when selections change
...
At some point during the implementation of rename, we added logic for
invalidating the rename state when the selection moved outside the original
rename range. After transitioning to displaying renames as a block decoration,
we don't need that anymore given that a new, temporary editor is used instead.
This commit removes that invalidation logic and always calls `Editor::take_rename`
when the editor selections change. Doing so also fixes a bug that was causing Zed
to hide the cursor when clicking on the editor to dismiss the rename.
2022-04-15 10:32:07 +02:00
Max Brunsfeld
3cdda79fc3
Merge pull request #817 from zed-industries/dynamic-editor-highlights
...
Store accessors for editor highlight colors not colors themselves
2022-04-14 10:36:38 -07:00
Antonio Scandurra
6d33697e82
Fix warning
2022-04-14 13:03:46 +02:00
Antonio Scandurra
1a1d670104
Speed up WrapSnapshot::line_len
using the indexed transforms
2022-04-14 13:01:29 +02:00
Antonio Scandurra
91d4c835ad
Introduce TabMap::line_len
2022-04-14 12:55:33 +02:00
Keith Simmons
292d075f81
Store accessors for editor highlight colors not colors themselves
2022-04-13 15:30:57 -07:00
Keith Simmons
b893cb6d82
rename NavigationData anchor and offset to cursor_anchor and cursor_offset
2022-04-13 14:53:47 -07:00
Keith Simmons
9cec6d8d65
add comment explaining offsets
2022-04-13 13:30:07 -07:00
Keith Simmons
f20e3f35a1
Record scroll position in nav history
2022-04-13 12:30:33 -07:00
Max Brunsfeld
949fbe7cd3
Allow dumping the project diagnostic view's state as JSON
...
Also, improve DebugElements action so that it shows the JSON in an editor.
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-04-11 19:51:46 -07:00
Max Brunsfeld
b3c64e47f1
Merge branch 'main' into cancel-buffer-search
2022-04-11 17:38:26 -07:00
Max Brunsfeld
92a5c30389
Merge branch 'main' into load-keymaps
2022-04-11 15:55:10 -07:00
Keith Simmons
4b295f566a
Handle editor cancel in pane in order to dismiss find toolbar
2022-04-11 15:11:23 -07:00
Max Brunsfeld
3636c9ec25
Load workspace and editor key bindings from a JSON file
2022-04-10 11:18:08 -07:00
Nathan Sobo
17195e615e
Merge pull request #781 from zed-industries/structured-logging
...
Introduce structured logging
2022-04-09 07:40:24 -06:00
Max Brunsfeld
fd4b81c8fc
Allow actions to be deserialized from JSON
...
Introduce separate macro for implementing 'internal' actions which
are not intended to be loaded from keymaps.
2022-04-08 15:47:51 -07:00
Nathan Sobo
7e5a3f9f6b
Introduce structured logging
...
We're enabling the log crate feature everywhere, but only using it on the server for now.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-04-08 10:06:51 -06:00
Max Brunsfeld
c801a52492
Convert some actions to use named fields
...
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-07 16:44:37 -07:00
Max Brunsfeld
5242a3a6dc
Restructure action macro to assign a namespace to every action
...
Also, allow arbitrary types to be used as Actions via the impl_actions macro
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-07 16:20:49 -07:00
Antonio Scandurra
73f2fd6b09
Pass visible bounds to Element::dispatch_event
2022-04-07 15:10:09 +02:00
Antonio Scandurra
52251c3463
Merge pull request #745 from zed-industries/scroll-tabs
...
Allow pane tabs to be scrolled when they overflow
2022-04-07 09:48:54 +02:00
Max Brunsfeld
ec837fa6d7
Update breadcrumbs when multibuffers' excerpts change
2022-04-06 17:12:36 -07:00
Max Brunsfeld
ea63df0519
Don't activate the next pane when opening excerpts
2022-04-06 15:46:11 -07:00
Keith Simmons
67b15ee037
Use language specific tabsize in editor commands
...
Co-authored-by: Max Brunsfeld <max@zed.dev>
2022-04-06 15:10:29 -07:00
Keith Simmons
1812480cbb
Tab size is pulled properly from settings instead of hardcoded
2022-04-06 10:23:37 -07:00
Max Brunsfeld
866ffdd4ae
Move Settings to its own crate
...
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-06 10:23:33 -07:00
Max Brunsfeld
664f17f92b
Avoid maintaining indent size as state on buffers
...
Indent size is still hard-coded, but it's now controlled by the
editor and not the buffer.
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-06 10:22:29 -07:00
Nathan Sobo
eb99588368
Remove stray dbg! expressions
2022-04-05 20:02:45 -06:00
Keith Simmons
05a05157fa
Move style source files to src and build to dist
...
Co-authored-by: Nate Butler <nate@zed.dev>
2022-04-04 14:43:13 -07:00
Antonio Scandurra
c62a3ea672
Merge pull request #687 from zed-industries/vim-word-and-line-movement
...
Add word and line movement in vim normal mode
2022-04-04 14:42:27 +02:00
Antonio Scandurra
b0b54365c7
Re-render breadcrumbs when buffer has been reparsed
2022-04-02 16:33:24 +02:00
Antonio Scandurra
c39de1f9dc
Show full path for file worktrees or when there is more than 1 worktree
2022-04-02 16:10:10 +02:00
Max Brunsfeld
fe27a27cb6
Merge branch 'main' into prompt-on-close
2022-04-01 15:29:23 -07:00
Max Brunsfeld
79bd8642e6
Merge pull request #702 from zed-industries/typescript
...
Add support for JS/Typescript/TSX, allow language servers to support multiple languages
2022-04-01 15:24:58 -07:00
Max Brunsfeld
ba009724dd
Handle LSP apply workspace edit request fully before responding
2022-04-01 11:59:21 -07:00
Antonio Scandurra
703f1c3be0
Introduce workspace::Item::reload
to manually trigger a reload
2022-04-01 14:02:49 +02:00
Antonio Scandurra
bdd95a82d7
Merge pull request #705 from zed-industries/breadcrumbs
...
Introduce breadcrumbs
2022-04-01 11:02:54 +02:00
Max Brunsfeld
e987a8ba63
Let fake and real LanguageServer access AsyncAppContext in handler callbacks
...
Also, reimplement FakeLanguageServer by wrapping LanguageServer, instead of
duplicating its functionality differently.
2022-03-31 21:57:00 -07:00
Max Brunsfeld
4805cfe48c
Merge branch 'main' into typescript
2022-03-30 14:44:07 -07:00
Max Brunsfeld
ebc711f9f5
Restructure fake language server setup
...
Replace FakeLanguageServerConfig with FakeLanguageServerAdapter
2022-03-29 17:55:57 -07:00
Keith Simmons
ec57c1f4ac
Properly dedup restarts of language servers
2022-03-29 17:46:39 -07:00
Keith Simmons
6d91fd078c
Add restart-lsp keybinding
2022-03-29 17:24:23 -07:00
Antonio Scandurra
099250c691
Introduce MultiBuffer::symbols_containing
2022-03-29 15:08:37 +02:00
Max Brunsfeld
a8600e76a3
Make language's language server config non-optional
2022-03-28 18:14:49 -07:00
Antonio Scandurra
f274a6ab4f
Avoid unnecessary clones when undoing/redoing selections
2022-03-28 17:47:14 +02:00
Antonio Scandurra
5ef6337b09
Merge branch 'main' into selection-history
2022-03-28 17:24:46 +02:00
Antonio Scandurra
aec82ef71e
Test selection history
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-28 17:20:52 +02:00
Antonio Scandurra
45ecd8e0a6
Always use square brackets in marked_text_ranges
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-28 17:11:35 +02:00
Antonio Scandurra
686085dd60
Merge pull request #690 from zed-industries/indent-keybindings
...
Bind `Outdent` and `Indent` respectively to `cmd-[` and `cmd-]`
2022-03-28 16:50:23 +02:00
Antonio Scandurra
bbfb63ff89
Cap selection history to 1024 entries
2022-03-28 16:37:48 +02:00
Antonio Scandurra
2a1fed1387
Insert tabs instead of indenting only when all selections are empty
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-28 16:36:12 +02:00
Antonio Scandurra
73c2f52158
Implement cmd-u
and cmd-shift-u
to undo and redo selections
2022-03-28 16:05:44 +02:00
Antonio Scandurra
4ed0607e1e
Extract SelectionHistory
in preparation to store an undo/redo stack
2022-03-28 14:52:54 +02:00
Antonio Scandurra
3cfa2c65b3
Autoscroll to newest cursor on cmd-d instead of fitting all selections
2022-03-28 14:38:51 +02:00
Antonio Scandurra
ac88003c19
Bind Outdent
and Indent
respectively to cmd-[
and cmd-]
2022-03-28 11:34:46 +02:00
Antonio Scandurra
a2c4205c5c
Make indent and outdent explicit actions and unify tab
bing logic
2022-03-28 11:34:38 +02:00
Antonio Scandurra
2c78c830eb
Skip formatting during save if it takes too long
2022-03-28 11:02:20 +02:00
Antonio Scandurra
cbd266052d
Allow returning futures in fake language server request handlers
2022-03-28 10:44:32 +02:00
Keith Simmons
a7a52ef3f7
Add word and line movement in vim normal mode
...
Add jump to start and end of the document
Move vim tests to relevant vim files
Rename VimTestAppContext to VimTestContext for brevity
Improve VimTestContext assertions to pretty print locations when selection position assertion panics
2022-03-27 17:58:28 -07:00
Nathan Sobo
fe1f857e84
Merge pull request #684 from zed-industries/subword
...
Add bindings for subword movement and deletion
2022-03-26 07:18:29 -06:00
Nathan Sobo
d4436277ee
Merge pull request #682 from zed-industries/vim-hjkl
...
Vim hjkl
2022-03-26 07:11:46 -06:00
Nathan Sobo
2dc76a2b58
Add bindings for subword movement and deletion
2022-03-26 07:10:16 -06:00
Keith Simmons
1a29180185
Fixed issue with enabling and disabling vim mode dynamically
...
Also added indoc and marked text utility to vim tests to improve readability
2022-03-25 20:10:52 -07:00
Keith Simmons
0aaf270650
Add clip_to_line_end to display_map/snapshot and set it to ensure vim positioning in normal mode
...
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-25 20:10:52 -07:00
Keith Simmons
bb9b36dccd
Add initial vim mode mode switching
...
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-25 20:10:37 -07:00
Nathan Sobo
2c232d585a
Merge branch 'main' into unfold-on-select-match
2022-03-24 14:13:27 -06:00
Nathan Sobo
ccc276da7a
Merge pull request #672 from zed-industries/fix-unfollowing-on-edit
...
Automatically unfollow leader only for edits that originate from the follower editor
2022-03-24 13:26:28 -06:00
Keith Simmons
92c7b5d6ef
Remove result from anchor cmp functions
...
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-24 11:48:31 -07:00
Keith Simmons
ab631cf6c3
Change language: ⚓ :min() to a constant
...
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-24 10:41:33 -07:00
Keith Simmons
f6805eb802
Make rename highlights work across multibuffer excerpts
...
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-24 10:22:47 -07:00
Antonio Scandurra
1c25b3d150
Test the new inclusive
parameter when unfolding
2022-03-24 17:20:28 +01:00
Antonio Scandurra
7fa7b7e507
Unfold range when selecting the next match
...
Selected matches are unfolded when in project search, buffer search and
when hitting `cmd-d` to select the next match.
2022-03-24 17:16:21 +01:00
Antonio Scandurra
78b52168fa
Rename Editor::unfold
to Editor::unfold_lines
2022-03-24 17:15:40 +01:00
Antonio Scandurra
4f50da759a
Allow customizing whether FoldMap::unfold
treats ranges as inclusive
2022-03-24 17:14:41 +01:00
Antonio Scandurra
9421ad04f7
Add a unit test for editor edit events
2022-03-24 09:17:56 +01:00
Antonio Scandurra
87981bb2ab
Emit an Edited
event when ending, undoing or redoing a transaction
2022-03-24 08:56:37 +01:00
Antonio Scandurra
a739c362d9
Rename editor::Event::Edited
to editor::Event::BufferEdited
...
This is to distinguish it from a new event we're about to add which
represent edits originating from that specific editor.
2022-03-24 08:55:46 +01:00
Antonio Scandurra
864bede8a2
Use Editor::transact
everywhere
...
This is in preparation of emitting an edit event every time a transaction ends
or it is undone/redone.
2022-03-24 08:48:06 +01:00
Max Brunsfeld
ff4bdb3114
Fix incorrect highlighting when an empty range is highlighted via the DisplayMap
...
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-23 18:20:55 -07:00
Max Brunsfeld
8f7966bf35
Merge pull request #668 from zed-industries/no-lsp-when-following
...
Avoid making LSP requests when moving cursor due to following
2022-03-23 11:54:45 -07:00
Max Brunsfeld
cbd4ef2ec5
Merge pull request #667 from zed-industries/fix-duplicate-nav-entries
...
Fix duplicate nav entries
2022-03-23 11:49:00 -07:00
Max Brunsfeld
f7e7d58f49
Avoid making LSP requests when moving cursor due to following
2022-03-23 11:41:20 -07:00
Keith Simmons
e36104f30d
Add navigation deduping
...
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-03-23 11:32:25 -07:00
Antonio Scandurra
5cd94b5b92
WIP
2022-03-23 19:05:46 +01:00
Antonio Scandurra
255a8c5d14
Don't push a duplicate nav entry when changing selections via the mouse
...
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-23 18:45:45 +01:00
Max Brunsfeld
0b3a63b843
Fix error in follower when leader creates pending selections
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-23 10:24:26 -07:00
Antonio Scandurra
10f176073d
Merge pull request #662 from zed-industries/fix-refresh-selections-when-mouse-selecting
...
Account for pending selections when calling `Editor::refresh_selections`
2022-03-23 15:58:28 +01:00
Antonio Scandurra
b73f57d37a
Don't destroy pending selection on Editor::refresh_selections
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-23 15:21:11 +01:00
Antonio Scandurra
004f98cc6d
Merge pull request #661 from zed-industries/follow
...
Introduce basic following experience
2022-03-23 15:17:44 +01:00
Antonio Scandurra
5ac39aa7cd
Don't show local cursors when editor is not focused
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-23 14:46:33 +01:00
Antonio Scandurra
d24bd6f19a
Account for pending selections when calling Editor::refresh_selections
2022-03-23 11:46:35 +01:00
Max Brunsfeld
fa62fd968f
Autoscroll when leader moves cursors
...
instead of copying their scroll top.
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-22 18:02:54 -07:00
Max Brunsfeld
fad299eb3f
Add unit test for editor's following methods
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-22 17:39:34 -07:00
Max Brunsfeld
8699dd9c56
Replicate fractional component of leader's scroll position
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-22 17:20:13 -07:00
Max Brunsfeld
4435d9b106
Combine updates from multiple view events when updating followers
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-22 16:22:42 -07:00
Keith Simmons
fba6f24ab7
Add editor lifetime events
2022-03-22 16:14:32 -07:00
Keith Simmons
6a1c197c1b
Add editor selection utilities
...
Also improved test that was failing during above to use marker text approach as a drive by
2022-03-22 16:08:22 -07:00
Max Brunsfeld
fc811e0856
Don't represent editor's scroll top anchor as an option
...
Use Anchor::min as the special value representing a scroll top of zero
2022-03-22 13:32:25 -07:00
Keith Simmons
df751867a1
Remove results from movement function return values, and move editor test utilities to test file
2022-03-22 10:55:03 -07:00
Antonio Scandurra
5dc36260e5
Reflect leader's view state when recycling existing local editors
2022-03-22 10:51:17 +01:00
Antonio Scandurra
34e5a1f6bb
Always render local selections on top of remote ones
2022-03-22 10:31:28 +01:00
Antonio Scandurra
3117554568
Automatically unfollow when editing, scrolling or changing selections
2022-03-22 09:17:01 +01:00
Max Brunsfeld
c550fc3f01
WIP - Start work on unfollowing automatically
2022-03-21 21:52:28 -07:00
Max Brunsfeld
1728551282
Always mirror the leader's selections when following
2022-03-21 21:47:29 -07:00
Nathan Sobo
ee3e6049a3
Make boundary-finding methods wrap across newlines
...
This requires word and subword methods to explicitly acknowledge that they want to stop at newlines, which I think actually increases clarity. It makes the boundary finding method more general and useful for external callers such as the forthcoming vim crate.
2022-03-21 21:25:02 -06:00
Nathan Sobo
f70f4c7729
Improve DisplayPoint Debug impl
2022-03-21 21:07:56 -06:00
Nathan Sobo
e5a00d72f8
Implement next_subword_end
2022-03-21 20:02:08 -06:00
Nathan Sobo
c0d05c82b7
WIP: Start on previous_subword_start
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-21 19:53:01 -06:00
Nathan Sobo
5b54874705
Extract logic for scanning over character boundaries
2022-03-21 16:01:22 -06:00
Nathan Sobo
0c89ad3ac0
Make multi-byte and surrounding_word tests more readable
...
Just merge multi-byte tests into the main word movement tests
2022-03-21 15:41:42 -06:00
Nathan Sobo
210fa4c443
Remove CharKind::Newline
...
This is just a character, and so it seems clearer to refer to it specifically when we want to know if a character is a newline. There was only one case where we relied on Newline being different from Whitespace, and we special-cased that instance. Changing this actually makes us match the behavior of VS Code when double-clicking runs of multiple newlines.
/cc @as-cii
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-21 15:17:32 -06:00
Nathan Sobo
baeb7d27b8
Clarify word movement function names and improve test coverage
...
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-21 15:17:25 -06:00
Max Brunsfeld
06cd9ac664
Match the leader's last selection when unfollowing
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-21 14:04:55 -07:00
Max Brunsfeld
3e0bc979c3
Avoid infinite loop when collaborators follow each other
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-21 11:47:00 -07:00
Antonio Scandurra
a2dbebd9ba
Hide cursor both locally and remotely when following
2022-03-21 15:16:56 +01:00
Antonio Scandurra
0e920ad5e9
Unset follower's scroll anchor when editor is scrolled all the way up
2022-03-19 10:50:23 +01:00
Max Brunsfeld
570c987455
Handle view updates when following
...
Basic following now works. Editors' scroll positions
are their only replicated view state.
2022-03-18 15:56:57 -07:00
Max Brunsfeld
d860ed25c1
Allow FollowableItem::to_state_message to return None
...
This way, we can avoid a panic if we don't handle certain cases,
like a non-singleton editor.
2022-03-18 13:36:05 -07:00
Max Brunsfeld
d02ab9bd06
Start work on updating editors's scroll positions when following
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-18 12:56:20 -07:00
Antonio Scandurra
f4520d4184
WIP
2022-03-18 18:07:03 +01:00
Antonio Scandurra
7d7e10598a
Broadcast active view to followers
2022-03-18 16:00:03 +01:00
Antonio Scandurra
10e6d82c3e
WIP: Start on sending view updates to followers
2022-03-18 14:20:09 +01:00
Antonio Scandurra
f0b7bd6e17
Serialize initial follow state in leader and reflect it in follower
2022-03-18 10:22:13 +01:00