Commit Graph
146 Commits
Author SHA1 Message Date
Antonio Scandurra e56609cf0c Ensure prior, deferred selections don't override newer selections 2022-01-05 15:43:26 +01:00
Antonio Scandurra f8c2620166 Fix Buffer::remote_selections_in_range at query range boundaries 2022-01-05 15:04:50 +01:00
Antonio Scandurra 587a908225 Populate deferred operations when an operation can't be applied 2022-01-05 15:04:19 +01:00
Antonio Scandurra bf044506ed Verify that selections are replicated correctly in randomized test 2022-01-05 15:04:08 +01:00
Antonio Scandurra 870fa5f278 Serialize deferred operations 2022-01-05 11:52:41 +01:00
Antonio Scandurra d383ff30ce Introduce randomized test for collaboration on buffers
This test will exercise serialization of operations as well as peers
replicating from an existing buffer.
2022-01-05 11:51:41 +01:00
Antonio Scandurra 7bc8eb4f3d Fix compile errors and get serialization unit test passing 2022-01-05 10:29:29 +01:00
Max Brunsfeld 984e366c32 WIP - Serialize buffer in terms of its state, not its base text + ops
The main reason for this is that we need to include information about
a buffer's UndoMap into its protobuf representation. But it's a bit
complex to correctly incorporate this information into the current
protobuf representation.

If we want to continue reusing `Buffer::apply_remote_edit` for
incorporating the historical operations, we need to either make
that method capable of incorporating already-undone edits, or
serialize the UndoMap into undo *operations*, so that we can apply
these undo operations after the fact when deserializing. But this is
not trivial, because an UndoOperation requires information about
the full offset ranges that were undone.
2022-01-04 18:06:16 -08:00
Max Brunsfeld d7ecbdcc1d Add unit test showing problem with serialization of undo ops 2022-01-04 16:01:12 -08:00
Antonio Scandurra 05a6137549 Capture a new buffer snapshot for excerpts whose selections got updated 2022-01-04 12:22:51 +01:00
Max Brunsfeld 7f8e76e0f1 Remove worktree-specific methods from language::File trait
Use downcasting instead for accessing worktree-specific state of the Files.

This will allow us to introduce a WorktreeId type and use that everywhere
for identifying worktrees. It also just removes some unnecessary coupling
between the language crate and the worktree.
2022-01-04 11:28:44 +01:00
Max BrunsfeldandNathan Sobo cbd9e186b5 Store selections with a right start bias so that autoindent moves them
Previously, cursors at column 0 had to be explicitly moved when those lines
were autoindented. This behavior was lost when we moved selections from
the buffer to the editor. Now, with the right bias, we get this behavior automatically.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-27 15:33:57 -08:00
Max BrunsfeldandNathan Sobo 43db9e826b Clear autoindent requests when applying autoindent
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-27 13:33:48 -08:00
Nathan Sobo cf81f5a555 Update tests to reflect that we no longer attempt to recycle group ids 2021-12-24 16:36:21 -07:00
Antonio ScandurraandNathan Sobo a85e400b35 Start on a DiagnosticProvider implementation for Rust
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-24 16:22:22 +01:00
Antonio Scandurra 393009a05c Implement Buffer::diagnostic_group 2021-12-24 12:08:55 +01:00
Antonio Scandurra 11e3874b4a Remove duplication when assigning diagnostics and hardcode provider names 2021-12-24 12:07:26 +01:00
Max Brunsfeld 4f774e2bde wip 2021-12-23 23:10:28 -08:00
Max Brunsfeld d5a17053df Get code compiling with some todos 2021-12-23 14:21:10 -08:00
e3ecd87081 WIP
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-23 11:24:35 -07:00
7b453beebc WIP: Use cargo check for on-disk diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-12-23 18:35:50 +01:00
Antonio ScandurraandNathan Sobo b9d1ca4341 Show only disk-based diagnostics in ProjectDiagnosticsEditor
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-23 16:47:54 +01:00
Antonio Scandurra dcf26acaac Use a different invalidation strategy for project-wide diagnostics 2021-12-23 15:41:43 +01:00
Antonio Scandurra 9164c5f239 Emit an UpdateDiagnostics from Worktree when buffer diagnostics change 2021-12-23 09:57:50 +01:00
Max Brunsfeld 5d8ed535be Clear out old disk-based diagnostics after 2 seconds 2021-12-22 15:51:51 -08:00
Max Brunsfeld b9551ae8b1 Preserve group ids when updating diagnostics 2021-12-22 14:50:51 -08:00
Max Brunsfeld 0faf5308ac Add a unit test for preserving disk-based diagnostics 2021-12-22 13:27:43 -08:00
Max Brunsfeld 1544da887e Start work on preserving continuity of disk-based diagnostics 2021-12-22 12:52:50 -08:00
Max Brunsfeld 3c26f67ea3 Minor cleanup in Buffer::update_diagnostics 2021-12-21 14:07:50 -08:00
Max Brunsfeld 528d64d3cc WIP - Improve project diagnostic context rendering 2021-12-16 18:34:29 -08:00
1bdaeda43e Remove disk diagnostics that were invalidated by a buffer edit
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-12-15 18:29:01 +01:00
Nathan SoboandMax Brunsfeld 6c5b27af1d Group diagnostics by primary
Render primary message above the excerpt and supporting messages as block decorations with a `Below` disposition. This is still super rough.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-14 18:26:42 -07:00
Antonio Scandurra 08e9f3e1e3 Maintain a different undo/redo stack in MultiBuffer
This only applies to singleton mode.
2021-12-14 17:43:41 +01:00
Max Brunsfeld 4efdc53d9f WIP 2021-12-13 17:44:20 -08:00
Max BrunsfeldandNathan Sobo 52b8e3d1a2 Get tests passing after diagnostic + selection changes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-13 11:34:56 -08:00
418a9a3d66 Get things compiling with diagnostics on worktree
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-13 11:15:03 -08:00
Antonio ScandurraandNathan Sobo 85674ba506 WIP
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-13 16:46:35 +01:00
Antonio Scandurra c984b39aaa Show remote collaborators' active selections 2021-12-13 11:38:38 +01:00
Nathan Sobo cdbcbdfe6d Test undo/redo at editor layer, including selection restoration 2021-12-12 15:04:19 -07:00
Nathan Sobo 1e7184ea07 Get selections rendering again when local selections are owned by Editor 2021-12-11 13:42:46 -07:00
Nathan Sobo 4dd0752e80 More messy progress towards selections in editors 2021-12-11 00:29:34 -07:00
Nathan Sobo 8432daef6a WIP: Start on removing selections from buffer in favor of editor 2021-12-10 19:23:34 -07:00
Nathan Sobo f35c419f43 Return optional transaction ids from undo/redo
This will allow the editor to restore selections that it associated with the start or end of a transaction.
2021-12-10 18:08:26 -07:00
Nathan Sobo 77defe6e28 Return optional transaction ids when starting/ending a transaction
If the transaction was nested, we return None. Otherwise we return the transaction id in preparation for editors to maintain their own selection state.
2021-12-10 18:00:09 -07:00
Nathan Sobo c8b43e3078 Move multi_buffer to editor crate 2021-12-10 17:37:53 -07:00
Max BrunsfeldandNathan Sobo 6caf016df9 Get tests passing w/ multibuffer in editor
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-10 15:54:25 -08:00
Max BrunsfeldandNathan Sobo 75dd37d873 Update multibuffer when buffers' syntax trees or diagnostics change
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-10 15:54:06 -08:00
Max Brunsfeld ceff57d02f Don't append a trailing newline in singleton MultiBuffer 2021-12-10 14:27:58 -08:00
Max Brunsfeld a758bd4f8d Fill in some missing methods on MultiBuffer, MultiBufferSnapshot 2021-12-10 14:27:04 -08:00
Antonio ScandurraandNathan Sobo 5b31c1ba4e Start making MultiBuffer work with a singleton buffer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-10 18:04:11 +01:00