Commit Graph

753 Commits

Author SHA1 Message Date
Max Brunsfeld
435d405d10 Implement MultiBuffer::insert_excerpt_after 2021-12-22 17:59:44 -08:00
Max Brunsfeld
a86ba57983 Add Editor::remove_blocks 2021-12-22 17:30:14 -08: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
06d2cdc20d Remove unused multi_buffer::FromAnchor trait 2021-12-22 13:27:43 -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
e31205c95e Revert "Implement MultiBuffer::remove_excerpts by inserting tombstones"
This reverts commit 275b7e8d4f.
2021-12-22 10:18:33 -08:00
Antonio Scandurra
275b7e8d4f Implement MultiBuffer::remove_excerpts by inserting tombstones
This will make it easier to use anchors in the presence of deletes.
2021-12-22 17:57:36 +01:00
Max Brunsfeld
2c3efdea8c WIP - Start work on updating project diagnostics view 2021-12-21 16:39:23 -08:00
Max Brunsfeld
a888620e5f Implement MultiBuffer::remove_excerpts
We'll need this for updating project diagnostics
2021-12-21 15:25:57 -08:00
Max Brunsfeld
a93f5e5fb4 Avoid repeated subscriptions + clones when adding another excerpt for same buffer 2021-12-21 14:28:23 -08:00
Max Brunsfeld
3c26f67ea3 Minor cleanup in Buffer::update_diagnostics 2021-12-21 14:07:50 -08:00
Max Brunsfeld
bc906fef9c Store worktree's diagnostics summaries ordered by path 2021-12-21 14:07:09 -08:00
Max Brunsfeld
699dafbbd4 Avoid cloning diagnostic messages from language server 2021-12-21 14:06:17 -08:00
Max Brunsfeld
8492c6e7ac Fix maintenance of MultiBuffer's buffer states 2021-12-21 13:07:43 -08:00
Max Brunsfeld
13ecd16685 Index max buffer row on MultiBuffer 2021-12-21 12:36:46 -08:00
Nathan Sobo
61b806e485 Add an endpoint for creating an access token for a GitHub login 2021-12-21 13:05:32 -07:00
Max Brunsfeld
04d577e326 Fix context line handline in project diagnostic view 2021-12-21 11:46:47 -08:00
Max Brunsfeld
60f7169008 Remove header heights from multibuffer randomized test 2021-12-21 10:24:01 -08:00
Antonio Scandurra
eec1748dc7 Render excerpt headers using DisplayMap::insert_blocks
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-12-21 18:32:27 +01:00
Antonio Scandurra
91c786a8db WIP: Insert blocks in BlockMap for MultiBuffer headers 2021-12-21 17:38:03 +01:00
Antonio Scandurra
8534a9cc41 Don't insert headers in MultiBuffer
This lays the groundwork to insert headers in the block map instead.
2021-12-21 16:38:18 +01:00
Antonio Scandurra
99317bbd62 Delete unit test
Sharing/unsharing is already exercised via the integration tests.
2021-12-21 14:51:09 +01:00
Antonio Scandurra
89c0b358a7 Allow sharing/unsharing of projects 2021-12-21 12:45:20 +01:00
Antonio Scandurra
17094ec542 Allow opening of remote projects via the contacts panel 2021-12-21 12:05:38 +01:00
Antonio Scandurra
5d2c4807db Fix invalid theme variables 2021-12-21 10:25:37 +01:00
Antonio Scandurra
c6dd797f4e Drop project instead of worktree to simulate client leaving 2021-12-21 10:20:05 +01:00
Antonio Scandurra
afec4152f4 Update contacts as projects/worktrees get registered/unregistered 2021-12-21 10:17:26 +01:00
Antonio Scandurra
40da3b233f Get more integration tests passing 2021-12-21 09:50:11 +01:00
Antonio Scandurra
1e8ef8a4c1 Register local worktrees after acquiring a project remote id 2021-12-21 09:49:13 +01:00
Antonio Scandurra
4053d683d9 Re-enable commented out worktree test 2021-12-21 08:35:08 +01:00
Max Brunsfeld
788bb4a368 Get some RPC integration tests passing 2021-12-20 18:08:53 -08:00
Max Brunsfeld
636931373e Add missing RPC handlers for local projects 2021-12-20 18:08:06 -08:00
Max Brunsfeld
870b73aa36 Send a LeaveProject message when dropping a remote project 2021-12-20 18:07:51 -08:00
Max Brunsfeld
a138955943 Fix logic for waiting for project's remote id 2021-12-20 18:07:34 -08:00
Max Brunsfeld
5d8d7de68d Fix accidental usages of local worktree id instead of remote id 2021-12-20 18:06:58 -08:00
Max Brunsfeld
55910c0d79 Get the server and integration tests compiling 2021-12-20 16:30:29 -08:00
Max Brunsfeld
466a377e1d Merge branch 'main' into share-project
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-20 11:42:59 -08:00
Max Brunsfeld
614ee4eac7 Send worktree info only when sharing worktree
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-20 11:36:59 -08:00
Antonio Scandurra
697e641e8e Get back to a compiling state for client
This temporarily disables some tests and there are still some server-side
compiler errors.
2021-12-20 16:08:34 +01:00
Nathan Sobo
323e1f7367 Add the fetching of user JSON by github login with a token header 2021-12-19 09:43:13 -07:00
Nathan Sobo
f4b9772ec2 Relocate admin routes to make room for API
I want to use the top-level /users route for the API that we'll access from the front-end site running on Vercel, and this is the easiest way to make space. Eventually we won't have admin pages, but I want to be additive for now.
2021-12-19 09:06:57 -07:00
Nathan Sobo
29bc2db6e8 Fix journal format strings 2021-12-18 12:15:07 -07:00
Nathan Sobo
0a37d40fad Pad single-digit months, days, and minutes with a leading zero 2021-12-18 11:11:04 -07:00
Nathan Sobo
ab5db0bc1e Fix warnings and tests 2021-12-18 11:06:07 -07:00
Nathan Sobo
e4f18947de Insert a time heading when creating a journal entry 2021-12-18 10:38:54 -07:00
Nathan Sobo
9e8ef31452 Return item handles when opening items
This will support interacting with the opened item. Although I think I should probably return the ItemView rather than the Item. Next commit.
2021-12-18 08:26:57 -07:00
Nathan Sobo
ca0d7e5e1f Add journal crate and move supporting logic into workspace crate
I needed to interact with the workspace to open a file from the journal crate, so I moved a bunch of logic out of main related to opening new workspaces and paths.
2021-12-18 08:12:59 -07:00
Nathan Sobo
cd65031cda Halt keystroke dispatch immediately when we call a global action handler
Someday, we may want to define a global action context that allows us to propagate the action, but this isn't currently supported. Previous to this commit, we were invoking the same global action handler multiple times, once for each view in the responder chain.
2021-12-18 08:12:08 -07:00
Max Brunsfeld
c41b958829 WIP - start restructuring collaboration around entire projects
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-17 22:00:39 -08:00
Antonio Scandurra
88d663a253 Allow saving of all buffers contained in project diagnostics editor
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-17 16:48:16 +01:00
Antonio Scandurra
f0fe346e15 Gracefully degrade diagnostics_in_range, diagnostic_group and file
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-17 16:37:12 +01:00
Antonio Scandurra
6685d5aa7d Implement MultiBuffer::save
This is still not integrated with `workspace::ItemView`.
2021-12-17 16:11:18 +01:00
Antonio Scandurra
7d2b74a93b Implement MultiBuffer::{is_dirty,has_conflict} 2021-12-17 15:33:09 +01:00
Antonio Scandurra
5f819b6edc Implement MultiBuffer::enclosing_bracket_ranges 2021-12-17 15:05:05 +01:00
Antonio Scandurra
c9cbc2fe1e Implement MultiBuffer::range_for_syntax_ancestor 2021-12-17 14:57:42 +01:00
Antonio Scandurra
a2ee38f37b Make MultiBuffer::is_parsing a test-only method 2021-12-17 14:57:24 +01:00
Antonio Scandurra
3914d1d072 Display filename on the first excerpt's header for a group 2021-12-17 13:49:21 +01:00
Antonio Scandurra
63f171200e Enhance diagnostic unit test and correctly display primary diagnostic
That is, if the diagnostic has more than one line we will display the
first line in the header and all the other message lines at the error
location.
2021-12-17 12:16:09 +01:00
Max Brunsfeld
528d64d3cc WIP - Improve project diagnostic context rendering 2021-12-16 18:34:29 -08:00
Max Brunsfeld
fb492a9fb8 Correctly incorporate editor settings into diagnostic header rendering 2021-12-16 16:36:33 -08:00
Max Brunsfeld
ae147a379d Don't terminate on an empty input chunk in ExcerptChunks 2021-12-16 16:05:28 -08:00
Max Brunsfeld
31eeffa5a7 Autoscroll after inserting blocks 2021-12-16 14:20:01 -08:00
Max Brunsfeld
9cd4e5ba04 Transfer focus from ProjectDiagnostics view to its editor 2021-12-16 14:14:22 -08:00
Max Brunsfeld
6444fcd442 Integrate MultiBuffer::buffer_rows into the display map 2021-12-16 13:53:32 -08:00
Max Brunsfeld
db33e4935a Implement MultiBuffer::buffer_rows 2021-12-16 12:17:47 -08:00
Max Brunsfeld
a293e9c0c5 Suppress unused field warnings 2021-12-16 11:17:06 -08:00
Max Brunsfeld
38df091b06 Fix up/down movement across excerpt headers
Implement these movements in terms of clipping, instead of with explicit loops
2021-12-16 11:16:48 -08:00
Max Brunsfeld
dcd05ef96b Resolve Anchor::min and ::max to valid positions
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-12-16 10:25:09 -08:00
Max Brunsfeld
80f3173fbd Always panic if invalid point is passed to {prev,next}_row_boundary
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2021-12-16 10:23:45 -08:00
Antonio Scandurra
0fc2db6d6e Account for folds when inserting/removing block decorations 2021-12-16 16:44:15 +01:00
Antonio Scandurra
7660159164 Test blocks in display map randomized tests
This highlighted some errors in the implementation.
2021-12-16 16:15:14 +01:00
Antonio Scandurra
de679cae78 Re-enable creating multiple blocks at once in BlockMap tests 2021-12-16 12:41:48 +01:00
Antonio Scandurra
abf96e6ad6 Fix movement tests in DisplayMap 2021-12-16 12:36:27 +01:00
Antonio Scandurra
64e2f6d506 Ensure BlockMap::clip_point always yield a valid buffer location 2021-12-16 12:29:37 +01:00
Antonio Scandurra
ec39c9d335 Allow specifying MAX_EXCERPTS via an env variable in random tests 2021-12-16 12:28:54 +01:00
Max Brunsfeld
3e2f684545 Fix prev_row_boundary when a wrap follows a fold
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 18:30:09 -08:00
Max Brunsfeld
4c22774694 Always clip buffer points when clipping display points
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 17:58:24 -08:00
Max Brunsfeld
f898dc6dae Guard against inverted ranges when building edits in unfold
The multibuffer lets you refer to offsets inside of headers,
so it's possible to create a fold that appears non-empty,
but which spans zero characters in the underlying buffers.

Fold ranges are biased inward: the start is biased right, and
the end is biased left.

Because of these two things, it's possible to create a fold
that becomes "inverted" when you insert text at that position.
2021-12-15 17:29:15 -08:00
Max Brunsfeld
e8570b5c26 Allow multibuffer to clip to the ends of excerpts, before trailing newlines 2021-12-15 17:04:57 -08:00
Max Brunsfeld
f8ef605cbd Update all MultiBuffer unit tests, removing expected trailing newline 2021-12-15 17:04:57 -08:00
Max Brunsfeld
f4115ddc3c 🎨 point_to_display_point & display_point_to_point 2021-12-15 15:45:02 -08:00
Max Brunsfeld
368b4447ff Clip buffer points in DisplayMap::{prev,next}_row_boundary 2021-12-15 15:41:38 -08:00
Max Brunsfeld
2930ea8fb0 Fix handling of excerpts surrounded by edits in MultiBuffer::edit 2021-12-15 12:12:39 -08:00
Max Brunsfeld
4bea16eb31 Ensure muiltibuffer anchors are contained within their excerpt ranges
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-12-15 10:52:27 -08:00
Max Brunsfeld
cec0c5912c Create multiple excerpts in random BlockMap test
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 10:21:11 -08:00
Antonio Scandurra
80abd84050 Create MultiBuffers with more than one fragment in more randomized tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-12-15 18:38:37 +01:00
Antonio Scandurra
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
Antonio Scandurra
4ab307f0a1 Re-enable multi-byte random character generation
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 17:51:11 +01:00
Antonio Scandurra
5118f27a90 Overhaul MultiBuffer::chunks
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 17:22:04 +01:00
Antonio Scandurra
bcdb4ffd88 Allow edits at the end of MultiBuffer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 16:45:01 +01:00
Antonio Scandurra
7bbaa1d930 Don't insert a newline after the last excerpt of a MultiBuffer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 16:39:09 +01:00
Antonio Scandurra
ae0fa75abe Start testing the integration of display layers with MultiBuffers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 16:05:26 +01:00
Antonio Scandurra
59121a238a Forward notifications from Buffer in MultiBuffer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 15:07:42 +01:00
Nathan Sobo
437145afbe Remove assertion and don't consume 0 bytes
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-12-15 06:52:37 -07:00
Nathan Sobo
fbba417f09 Implement MultiBuffer::bytes_in_range
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-12-15 06:49:10 -07:00
Antonio Scandurra
95137ecb2a WIP 2021-12-15 13:20:11 +01:00
Antonio Scandurra
e23965e7c9 Implement MultiBuffer::reversed_chars_at 2021-12-15 10:06:45 +01:00
Antonio Scandurra
9cbb680fb2 Fix panic on creation of a left-biased anchor at the end of MultiBuffer 2021-12-15 10:06:43 +01:00
Antonio Scandurra
7bcce23dc9 Fix compile error in server integration tests 2021-12-15 08:48:50 +01:00
Nathan Sobo
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
Nathan Sobo
e1a2897d53 Render basic diagnostic messages in project diagnostics view
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-14 17:00:57 -07:00
Nathan Sobo
ad05c0cc7a Implement MultiBufferSnapshot::excerpt_headers_in_range
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-14 16:24:48 -07:00
Max Brunsfeld
60e2c6bc52 Fix multibuffer anchors before the ends of excerpts 2021-12-14 13:37:05 -08:00
Max Brunsfeld
06e241117c Fix assertions in test for selection restoration after undo/redo
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-14 13:04:51 -08:00
Max Brunsfeld
e38c1814d5 Update selections on text insertion using anchors
The delta-based approach doesn't work for multi-excerpt buffers.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-14 12:15:26 -08:00
Max Brunsfeld
4ed96bb5a6 Fix assertion in multibuffer history test
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-14 11:47:22 -08:00
Max Brunsfeld
bf9daf1529 Allow left-biased anchors at the beginnings of excerpts
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-12-14 09:58:28 -08:00
Antonio Scandurra
358a6ff66c Implement MultiBufferSnapshot::contains_str_at 2021-12-14 17:51:14 +01: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
Antonio Scandurra
523cbe781b Return the transaction id after grouping in end_transaction_at
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-14 17:41:42 +01:00
Antonio Scandurra
119d44caf7 Remove test-only transaction_group_interval method from MultiBuffer 2021-12-14 14:19:04 +01:00
Antonio Scandurra
2d1ff8f606 Clip anchors created on MultiBuffer's trailing newlines or headers 2021-12-14 12:29:05 +01:00
Antonio Scandurra
1b67f19edc Implement MultiBuffer::set_active_selections 2021-12-14 12:13:19 +01:00
Antonio Scandurra
920daa8a8f Remove stray log statement 2021-12-14 12:01:19 +01:00
Antonio Scandurra
163ce95171 Implement MultiBufferSnapshot::remote_selections_in_range 2021-12-14 11:34:26 +01:00
Antonio Scandurra
174b37cdf0 Assume all excerpts in the multi buffer have the same language for now 2021-12-14 11:33:53 +01:00
Antonio Scandurra
04ffca95c6 Keep a separate diagnostic update count and parse count in MultiBuffer 2021-12-14 11:32:49 +01:00
Antonio Scandurra
9e15c57f91 Display a rudimentary project diagnostic view on alt-shift-d 2021-12-14 11:32:05 +01:00
Max Brunsfeld
4efdc53d9f WIP 2021-12-13 17:44:20 -08:00
Max Brunsfeld
0b1c27956b Add Project::open_buffer method 2021-12-13 17:44:15 -08:00
Max Brunsfeld
fe571f1d70 Store diagnostic summaries on worktrees 2021-12-13 16:36:53 -08:00
Max Brunsfeld
6ab795c629 Handle buffer deduping in the worktree instead of in workspace
Previously, buffers were only deduped by file if they were opened
through Workspace::open_entry
2021-12-13 16:35:46 -08:00
Max Brunsfeld
52b8e3d1a2 Get tests passing after diagnostic + selection changes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-13 11:34:56 -08:00
Max Brunsfeld
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 Scandurra
85674ba506 WIP
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-13 16:46:35 +01:00
Antonio Scandurra
6645e2820c First attempt at implementing MultiBuffer::edit_internal
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-13 15:43:26 +01:00
Antonio Scandurra
c984b39aaa Show remote collaborators' active selections 2021-12-13 11:38:38 +01:00
Antonio Scandurra
2adf11e204 Write a simple unit test for TreeMap and fix bug in remove 2021-12-13 11:20:10 +01:00
Nathan Sobo
cdbcbdfe6d Test undo/redo at editor layer, including selection restoration 2021-12-12 15:04:19 -07:00
Nathan Sobo
44cd0be068 Restore selections upon undo/redo of edits performed in the current editor 2021-12-12 14:12:03 -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
0639c8331c Relax TreeMap value bounds, fix warnings, simplify cmp 2021-12-10 23:35:24 -07:00
Nathan Sobo
49d1c9d1ba Introduce sum_tree::TreeMap<K, V>
I think this will be useful to avoid cloning HashMaps in certain cases such as snapshots.
2021-12-10 23:33:15 -07:00
Nathan Sobo
f5c775fcd1 WIP 2021-12-10 22:16:39 -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 Brunsfeld
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 Brunsfeld
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 Scandurra
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
Antonio Scandurra
7524974f19 Get everything compiling again
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-10 17:15:16 +01:00
Antonio Scandurra
da09247e5e WIP
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-10 16:14:12 +01:00
Antonio Scandurra
9c74deb9ec Finish removing anchor collections from MultiBuffer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-10 15:58:37 +01:00
Antonio Scandurra
d9da8effd4 Re-implement edits_since_in_range in terms of Locator
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-10 14:22:43 +01:00
Antonio Scandurra
c8d5e19492 Merge branch 'fragment-locators' into project-diagnostics 2021-12-10 14:01:17 +01:00
Antonio Scandurra
cb97b7cd1d Fix diagnostic unit test 2021-12-10 09:43:21 +01:00
Antonio Scandurra
eeba0993aa Optimize anchor comparison and take full advantage of fragment IDs 2021-12-10 09:16:58 +01:00
Max Brunsfeld
5e516f59c0 Merge branch 'fragment-locators' into HEAD 2021-12-09 14:49:04 -08:00
Max Brunsfeld
1ed1ec21dd Batch anchor resolution, avoid cloning fragment ids when seeking 2021-12-09 11:00:40 -08:00
Antonio Scandurra
e9c385e7a6 WIP 2021-12-09 18:27:54 +01:00
Antonio Scandurra
91a7bbbba2 Fix some of the diagnostic tests and make DiagnosticEntry generic
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-09 17:53:08 +01:00
Antonio Scandurra
65711b2256 Remove anchor collections
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-09 17:28:27 +01:00
Antonio Scandurra
67686dd1c2 Don't use an enum for anchors and model min/max more implicitly
This will make it easier to serialize an anchor.
2021-12-09 12:01:17 +01:00
Antonio Scandurra
cbe136c0cb Implement anchor resolution using locators 2021-12-09 11:18:01 +01:00
Antonio Scandurra
b7535dfba4 Store only clock::Local in InsertionFragment 2021-12-09 09:21:52 +01:00
Antonio Scandurra
dc81b5f57a Make remote edit randomized tests pass with locators 2021-12-09 09:15:19 +01:00
Antonio Scandurra
b4ebe179f9 Make local edit randomized tests pass with locators 2021-12-09 09:11:16 +01:00
Nathan Sobo
dd38eb1264 Start on maintaining an insertions tree
I'm correctly assigning fragment ids to all fragments in the fragments tree, but I have a randomized test failure when making sure that the insertions tree matches the state of the fragments tree.
2021-12-08 22:05:13 -07:00
Nathan Sobo
ec54010e3c Sketch in type-level changes to track insertion splits 2021-12-08 21:04:22 -07:00
Nathan Sobo
98f726974e WIP 2021-12-08 20:04:30 -07:00
Nathan Sobo
4ee404a0af Take a cx in MultiBuffer::start_transaction 2021-12-08 19:30:52 -07:00
Nathan Sobo
87d16c271e Get Editor compiling with MultiBuffer as its buffer
There's a bunch of unimplemented methods in MultiBuffer, but everything compiles.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-08 19:23:04 -07:00
Max Brunsfeld
daedf179b2 Implement Anchor, AnchorRangeMap, SelectionSet in multi_buffer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-08 12:56:09 -08:00
Max Brunsfeld
a7634ccd5f Rename ExcerptList to MultiBuffer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-08 10:07:15 -08:00
Max Brunsfeld
5f8e406c18 Fill out ExcerptList API
This restores the improvements that we had made on the `project-diagnostics-generic` branch.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-08 10:04:22 -08:00
Antonio Scandurra
a88cff4fa0 Remove lifetime parameter from TextDimension trait
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-12-08 09:45:57 -08:00
Max Brunsfeld
6a44a7448e Consolidate Edit types in editor crate 2021-12-08 09:33:55 -08:00
Max Brunsfeld
fa379885f1 Give more specific names to all snapshot and text iterator types 2021-12-08 09:24:00 -08:00
Max Brunsfeld
6d9bf802e2 Don't pass GH auth header when following redirects for release assets 2021-12-07 12:34:55 -08:00
Max Brunsfeld
ad33111a22 Fix assertion in excerpt unit test after fixing edits 2021-12-06 17:40:32 -08:00
Max Brunsfeld
39cc0cac93 Fix Subscription re-export after moving it into its own module 2021-12-06 17:40:17 -08:00
Max Brunsfeld
102926d171 Implement and randomized test excerpt list point translation and clipping 2021-12-06 17:39:31 -08:00
Max Brunsfeld
09c0c3a0e7 🎨 excerpt_list::Chunks::next 2021-12-06 16:28:44 -08:00
Max Brunsfeld
416033a01c Get random excerpts test passing w/ text in range, edits 2021-12-06 16:17:31 -08:00
Nathan Sobo
02f42f2877 WIP
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 14:51:23 -07:00
Nathan Sobo
88e3d87098 Get randomized test passing on basic excerpt list features
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 13:48:07 -07:00
Nathan Sobo
4578938ea1 Implement ExcerptList::subscribe
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 13:37:17 -07:00
Nathan Sobo
a02a29944c Get the basic ExcerptList unit test passing again
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 13:01:09 -07:00
Nathan Sobo
6965117dd8 Allow patches to be composed with edit iterators in addition to other Patches
This can avoid an extra allocation in some cases.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 13:00:51 -07:00
Nathan Sobo
cff610e1ec Rename FragmentList to ExcerptList
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 11:59:32 -07:00
Antonio Scandurra
42eba7268d Introduce Buffer::edits_since_in_range
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-12-06 19:48:45 +01:00
Antonio Scandurra
e37908cf3b Start on a simple randomized test for FragmentList 2021-12-06 16:08:17 +01:00
Antonio Scandurra
8354d1520d 🎨 2021-12-06 14:03:38 +01:00
Antonio Scandurra
45d6f5ab04 Start on maintaining edits in FragmentList 2021-12-06 12:10:25 +01:00
Antonio Scandurra
8f90d42723 Merge branch 'main' into project-diagnostics 2021-12-06 09:39:03 +01:00
Max Brunsfeld
b1ed9c88a4 Add tree-sitter-markdown, set up simple markdown higlighting 2021-12-05 21:37:31 -08:00
Max Brunsfeld
026c3476db Upgrade tree-sitter to 0.20.1 2021-12-05 21:37:08 -08:00
Antonio Scandurra
45d1690f6e Use 16-bit float to store path windings
Previously, we were using a normalized 8-bit unsigned integer which forced us
to represent each increment of the winding number as a fraction of the max
value (1 / 255) which we would then add up using additive alpha blending.

This had three major drawbacks:

- The max winding number could not be greater than 255.
- Adding up (1 / 255) several times could result in a loss of precision.
- Due to also computing anti-aliasing as a fractional winding number, we had to
  reduce the max winding number to 32. This was still not good enough because
  we would multiply a fractional value with `1 / 32`, thus introducing more and
  more loss of precision.

This commit changes the texture type to an `f16` which doesn't require the
division by 255 and enables greater precision in the computation of the
anti-aliased parts of a curve. Note how this also removes the limitation of 255
windings at most per curve. The tradeoff is paying twice as much memory for
storing the texture, but that seems totally valid to achieve rendering accuracy.

Note that this kind of texture should be compatible with WebGL2 once we start
working on a web version of Zed.
2021-12-05 11:17:26 +01:00
Nathan Sobo
0be897d5ac WIP: Edit one of the excerpted buffers and add an assertion
We'll need to detect edits on the child buffers and understand their impact on the tree.
2021-12-04 07:19:30 -07:00
Nathan Sobo
811696670a Start on a new FragmentList
Here I'm exploring a new approach to the project-wide diagnostics view that can exactly mirror the contents of cargo check. The `FragmentList` composes an arbitrary list of fragments from other buffers and presents them as if they were a single buffer.
2021-12-04 06:57:56 -07:00
Antonio Scandurra
3426d46b69 Clear pending keystrokes after dispatching an action
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-03 17:59:46 +01:00
Antonio Scandurra
0e93bc41dd In add_option_view, avoid bumping view's ref counts if view is None
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-03 17:52:39 +01:00
Nathan Sobo
5ae46709b0 Fix alignment of blocks adjacent to other blocks
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-01 17:58:44 -07:00
Nathan Sobo
ee693a8d2b Get all tests passing with new blocks API
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-01 17:52:34 -07:00
Nathan Sobo
512a10b037 Use new BlockMap API to render diagnostics
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-01 17:22:40 -07:00
Max Brunsfeld
0c714210ff Start work on generalizing the BlockMap to allow arbitrary elements
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-01 15:25:55 -08:00
Antonio Scandurra
e668ff8bcd Avoid allocating a Patch just to check if there are no edits
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-01 16:47:04 +01:00
Antonio Scandurra
733e0cb21b Use the new buffer subscription API to keep DisplayMap in sync
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-01 16:08:53 +01:00
Antonio Scandurra
3b536f153f Introduce text::Buffer::subscribe
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-01 15:55:05 +01:00
Antonio Scandurra
47c467dafc Bump FoldMap's version in FoldMap::sync (and not in DisplayMap) 2021-12-01 12:05:02 +01:00
Antonio Scandurra
b841b3eb79 Don't produce invalid intermediate edits in Patch::compose 2021-12-01 11:44:33 +01:00
Max Brunsfeld
faba276fdc WIP - maintain foldmap with Buffer::edits_since
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-30 17:23:02 -08:00
Max Brunsfeld
924e1578ea Use &Snapshot directly instead of impl Into<Content<'a>>
The text::Buffer and its snapshot already used the same representation
for their content, so we can just make Buffer deref to a Snapshot.
2021-11-30 13:32:11 -08:00
Nathan Sobo
1445ce10b5 Name the root file of every crate after the crate to ease navigation
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-30 12:46:39 -07:00
Nathan Sobo
748b1ba602 Fix warning
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-30 12:27:00 -07:00
Nathan Sobo
d3f28166cb Rename buffer crate to text and name its entrypoint after the crate
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-30 12:26:12 -07:00
Nathan Sobo
eacd2a45bb Bump versions in preparation for release 2021-11-30 09:43:51 -07:00
Nathan Sobo
0ed488d93b Avoid building up pending edits when soft wrapping is disabled
This was causing us to get slower over time as we stacked up hundreds of thousands of pending edits whenever soft wrap was disabled.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-30 08:28:29 -07:00
Antonio Scandurra
2449834868 Use display coordinates for the highlighted row in "go to line" 2021-11-30 11:40:53 +01:00
Nathan Sobo
a1412166f0 Fix randomized test failures by waiting for client_b to be added to worktree_a
We perform an async fetch of client_b's user data on worktree_a, which ends up holding a handle that prevents worktree_a from being released later in the test. By waiting for this fetch to finish before proceeding, we can be sure worktree_a actually gets released.

A more comprehensive fix would be some way to ensure we actually perform a release if an entity is fully dropped outside of an update cycle, but this fixes the issue for now.

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-29 16:48:09 -07:00
Max Brunsfeld
1a91aa8194 Introduce a collections crate w/ deterministic hashmap, hashset in tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-29 15:22:45 -08:00
Max Brunsfeld
5ec003530f Consolidate pending effects logic into MutableAppContext::update
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-29 14:16:19 -08:00
Max Brunsfeld
4cc1556ca4 Introduce weak_handle methods on ModelContext and ViewContext
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-29 14:13:22 -08:00
Max Brunsfeld
88e0fe6f88 Paint highlighted lines correctly when horizontally scrolled 2021-11-29 11:28:43 -08:00
Antonio Scandurra
1803bd77ef Fix test assertions 2021-11-29 18:15:03 +01:00
Antonio Scandurra
9d7039ed51 Embed a plain text grammar and override settings for that too 2021-11-29 18:01:51 +01:00
Antonio Scandurra
2c17ae9aa6 Introduce a new Grammar struct and allow it to be optional
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-29 17:38:59 +01:00
Antonio Scandurra
b9edde7b26 Make settings fields that can be overridden private
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-29 17:08:43 +01:00
Antonio Scandurra
cc78ae14d4 Add a sample markdown grammar to honor the new soft wrap override 2021-11-29 09:39:16 +01:00
Antonio Scandurra
93de2bcfed Allow overriding editor settings on a per-language basis 2021-11-29 09:39:13 +01:00
Nathan Sobo
815cc7ee91 Give avatar ribbons a rounded top 2021-11-28 14:04:31 -07:00
Nathan Sobo
fbc307cd5e Associate collaborator avatars with "ribbons" corresponding to their cursor color 2021-11-28 13:25:05 -07:00
Nathan Sobo
a5039cad65 Tweak avatar sizes in titlebar 2021-11-28 12:41:46 -07:00
Nathan Sobo
6ce76ca13e Render active worktree collaborator avatars in the titlebar 2021-11-28 12:28:10 -07:00
Nathan Sobo
4bd43e67ef Introduce a TestClient and associate it with a PeerId
This makes it easier to integration test peer interactions because now we know their PeerIds.
2021-11-27 12:33:25 -07:00
Nathan Sobo
b307a7e91d Populate the user data of worktree collaborators
This will make it possible for us to render their avatars. Previously we only had the user ids. During rendering, everything needs to be available synchronously. So now, whenever collaborators are added, we perform the async I/O to fetch their user data prior to adding them to the worktree.
2021-11-26 20:35:50 -07:00
Nathan Sobo
9930e92412 WIP: Give worktrees a reference to the UserStore
This will allow them to fetch user data when peers are added or removed. Still work to do though.
2021-11-26 19:12:12 -07:00
Nathan Sobo
21aba54dc3 Introduce a worktree::Collaborator struct that holds the user_id
We can use this to render avatars.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-26 11:28:30 -07:00
Nathan Sobo
d78d5712be Rename PeoplePanel to ContactsPanel
Yeah, it's true they're people, but this is a more specific way in which they're people.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-26 11:13:05 -07:00
Nathan Sobo
c8ad5b68e0 Rename collaborator_logins to authorized_logins
Again, this is about reserving the concept of a "collaborator" for actual collaborators on a worktree.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-26 11:08:34 -07:00
Nathan Sobo
cd2c3c3606 Rename Collaborators to Contacts
This will allow us to use the word "collaborator" to describe users that are actively collaborating on a worktree.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-26 10:59:41 -07:00
Nathan Sobo
9f29eeda03 Associate Peers with a user_id
This will help us render the collaborator avatars for the active worktree when we know its peers.
2021-11-26 10:22:34 -07:00
Nathan Sobo
f453928b44 Associate the project with an active worktree
This is similar to the active entry, but it can remain assigned even if there is no active entry and we can potentially manipulate it in other scenarios such as interaction with the project browser. This prepares the ground to show the collaborators for the active worktree.
2021-11-26 10:21:56 -07:00
Nathan Sobo
74cdd32c58
Merge pull request #257 from zed-industries/go-to-line-plus-mouse
Preserve selection when clicking on editor dismisses go-to-line dialog
2021-11-25 14:17:29 -07:00
Nathan Sobo
ad26362a82 Preserve selection when clicking on editor dismisses go-to-line dialog 2021-11-25 14:10:43 -07:00
Nathan Sobo
fc2ae42f4b Implement cmd-k cmd-d to replace selection with next 2021-11-25 13:39:08 -07:00
Nathan Sobo
d249618ee6 Improve range-based selection queries to only resolve the requested selections 2021-11-25 13:19:49 -07:00
Antonio Scandurra
09a53a0c64 WIP 2021-11-25 17:11:30 +01:00
Antonio Scandurra
2f78d93383 Make summaries_for_anchors/summaries_for_anchor_ranges more generic
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-25 17:03:06 +01:00
Antonio Scandurra
2f43ef67fd Allow a single start/end bias per AnchorRangeMap
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-25 16:53:10 +01:00
Antonio Scandurra
f42fd8e1bb Return Selections from Editor::selections_in_range
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-25 16:45:06 +01:00
Antonio Scandurra
861893b7b6 Autoscroll vertically to the newest selection on SelectNext
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-25 16:02:39 +01:00
Antonio Scandurra
10b3fae2c3 Implement SelectNext
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-25 15:44:06 +01:00
Antonio Scandurra
543ebb7e4e Adjust padding on sign in prompt in titlebar 2021-11-25 10:37:30 +01:00