Commit Graph

456 Commits

Author SHA1 Message Date
Max Brunsfeld
fee7657fd7 Merge branch 'main' into polish-project-diagnostics 2022-01-05 20:38:20 -08:00
Max Brunsfeld
f9f75e98f8 Fix Locator::from_index
Enhance language::tests::test_random_collaborators so that it checks buffer invariants.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-05 17:58:24 -08:00
Max Brunsfeld
e5faaeb2f2 Fix Global::gt and rename it to changed_since
A false negative return value of `gt` was preventing guests' multibuffers from
syncing correctly.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-05 17:36:12 -08:00
Max Brunsfeld
8728d3292d Merge branch 'main' into polish-project-diagnostics
Also fix false failure in ModelHandle::condition when parking is not forbidden.
2022-01-05 10:53:18 -08:00
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
b2f0c78924 Merge branch 'main' into polish-project-diagnostics
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-01-04 18:35:28 +01:00
Antonio Scandurra
ad1db117e6 Re-enable cargo check for rust-analyzer 2022-01-04 18:26:16 +01:00
Antonio Scandurra
508b9dc024 Rip out "diagnostic providers" 2022-01-04 16:32:17 +01: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 Brunsfeld
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 Brunsfeld
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 Scandurra
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
Nathan Sobo
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
Antonio Scandurra
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 Scandurra
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
04d577e326 Fix context line handline in project diagnostic view 2021-12-21 11:46:47 -08:00
Max Brunsfeld
528d64d3cc WIP - Improve project diagnostic context rendering 2021-12-16 18:34:29 -08: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
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
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 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
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 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
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
Max Brunsfeld
5e516f59c0 Merge branch 'fragment-locators' into HEAD 2021-12-09 14:49:04 -08: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
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
Max Brunsfeld
fa379885f1 Give more specific names to all snapshot and text iterator types 2021-12-08 09:24:00 -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
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
026c3476db Upgrade tree-sitter to 0.20.1 2021-12-05 21:37:08 -08: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
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
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
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
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
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
Max Brunsfeld
f0db748ba1 Implement toggle-comments 2021-11-23 14:13:28 -08:00
Nathan Sobo
2f39dee28b Use uniform biases in AnchorMap, AnchorRangeMap
Specifying a different bias for every point makes the interface feel pretty unwieldy and we don't really use it.
2021-11-22 15:30:46 -07:00
Max Brunsfeld
612b4404a9 Fix the bias of deserialized selection sets
Fixes #224

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-22 14:14:48 -08:00
Antonio Scandurra
b25c3eb740 Switch to a dense representation for clock::Global
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-22 17:20:43 +01:00
Antonio Scandurra
5094380c83 Enhance keyboard navigation when showing next diagnostic
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 16:55:18 +01:00
Antonio Scandurra
0e51365770 In a diagnostic group, mark the highest-severity diagnostic as primary
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 15:53:00 +01:00
Antonio Scandurra
0a6293bcda Support highlighting in blocks
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 14:08:21 +01:00
Nathan Sobo
52a4c15c14 Eliminate non-highlighted chunks APIs
Now we only have a single code path for chunks across all layers, but highlighting is optional and controlled by a flag.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-16 16:51:38 -08:00
Max Brunsfeld
8b1b35913a Fix group_ids assertions in diagnostics test
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-15 14:18:58 -08:00
Antonio Scandurra
4e32fabfdc Add text manipulation facilities to Rope for test purposes 2021-11-12 17:02:51 +01:00
Antonio Scandurra
2f4d8932dc Allow querying a diagnostic group by its id
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-04 15:16:59 +01:00
Antonio Scandurra
78bbb83448 Assign diagnostics a group_id based on their related_information
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-04 14:52:34 +01:00
Nathan Sobo
2d6285a6e1 Start on a test for grouped diagnostics 2021-11-03 18:47:18 -06:00
Max Brunsfeld
baf636a4a4 Extend empty diagnostic ranges at the ends of lines 2021-11-03 13:49:39 -07:00
Max Brunsfeld
8b5089c759 In the status bar, show the diagnostic under the cursor 2021-11-03 12:33:16 -07:00
Antonio Scandurra
c07d794249 Avoid ending the pending selection until updating selections
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-03 19:07:06 +01:00
Antonio Scandurra
9dc3c74260 Make resolving selections generic
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-03 17:51:57 +01:00
Antonio Scandurra
20a77f4c5e Fix test for disk-based diagnostics 2021-11-03 09:39:15 +01:00
Max Brunsfeld
8d3f42de52 Start language servers based on buffers' languages
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-02 17:41:01 -07:00
Max Brunsfeld
89392cd23d Avoid using worktree handle in File's path methods
This avoids a circular model update that was happening
when trying to retrieve the absolute path from a buffer's
file while applying remote operations.
2021-11-02 14:33:55 -07:00
Max Brunsfeld
1995bd89a6 Deserialize buffer's diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-02 12:29:03 -07:00
Max Brunsfeld
61e06487b7 Avoid circular model update when sending diagnostics operations 2021-11-01 17:14:22 -07:00
Max Brunsfeld
0e62ddbb65 Replicate diagnostics to remote buffers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-01 15:28:37 -07:00
Max Brunsfeld
40c861c249 Move protobuf logic from buffer crate to language crate
This will enable us to add operations that only pertain to the language crate.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-01 14:05:19 -07:00
Max Brunsfeld
78d97a3db2 Use Diagnostic struct in buffer's diagnostics multimap 2021-11-01 12:59:01 -07:00
Max Brunsfeld
1aee7bdb1d Delay quit until language servers are gracefully shut down
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-01 11:57:31 -07:00
Antonio Scandurra
6e5ec2a00d Take a &clock::Global instead of cloning in edits_since 2021-11-01 10:48:20 +01:00
Antonio Scandurra
f59be5fecf Always notify when receiving buffer operations
We had changed it to only emit a notification when the buffer was
actually edited, but we also want to notify when we receive non-edit
operations, such as a selection update.
2021-11-01 10:06:23 +01:00
Antonio Scandurra
b571eae4f3 Extend empty diagnostic ranges by one character
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-29 19:09:19 +02:00
Antonio Scandurra
6212ebad9b Communicate with language servers in terms of UTF-16 coordinates
This required indexing UTF-16 positions in `Rope`. We tried opting
into the UTF-8 experimental support but it didn't seem to work
correctly and the standard is UTF-16 anyway.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-29 18:33:23 +02:00
Antonio Scandurra
9c1b01521a Avoid unnecessary conversion to offsets in diagnostics_in_range 2021-10-29 14:41:41 +02:00
Max Brunsfeld
e1556893f7 Merge branch 'anchor-map-selections' into lsp 2021-10-28 17:08:06 -07:00
Max Brunsfeld
a1e576343e Rename AnchorRangeSet::to_point_ranges -> point_ranges 2021-10-28 16:32:49 -07:00
Max Brunsfeld
9bc08e446b Fix unit test for on-disk-changes to not rely on selection bias 2021-10-28 16:17:07 -07:00
Antonio Scandurra
ce8741977b Clip points coming from language server
This avoids panicking in Zed if the points they give us are invalid.

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-10-28 19:02:26 +02:00
Antonio Scandurra
d12387b753 Ensure start endpoints always come before end endpoints
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-10-28 18:26:32 +02:00
Antonio Scandurra
ee78d6f17b Express multi-cursor edits using the new coordinate space
The language server expects that ranges further in the list of edits
account for the impact of prior changes in the edit list.
2021-10-28 13:40:55 +02:00
Antonio Scandurra
7091e0c567 Add a unit test for disk-based diagnostics 2021-10-28 11:37:24 +02:00
Antonio Scandurra
ac76706aa7 Sort LSP diagnostics by (start, end) 2021-10-28 11:36:33 +02:00
Nathan Sobo
9977248926 Adjust disk-based diagnostics based on edits since the last save
Still need to add tests... not sure if this is right yet.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-10-27 18:58:07 -06:00
Antonio Scandurra
bc076c1cc1 Update display map snapshots when diagnostics are updated
This is similar to what we do when we receive new parse trees from
tree-sitter.
2021-10-27 12:42:16 +02:00
Antonio Scandurra
a7a73a5b0b Fix bug in to_full_offset when Anchor::version != Content::version 2021-10-27 11:56:04 +02:00
Max Brunsfeld
c539069cbb Include diagnostic info in HighlightedChunks iterator
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-26 17:57:50 -07:00
Max Brunsfeld
ef4fc42d93 Allow retrieving a buffer's diagnostics 2021-10-26 15:46:08 -07:00
Max Brunsfeld
5bfbeb55c0 Simplify buffer constructor methods
Don't expose the `buffer::History` to callers of `language::Buffer`
2021-10-26 14:26:47 -07:00
Max Brunsfeld
7d5425e142 Move lsp configuration into language crate
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-26 12:17:51 -07:00
Max Brunsfeld
de8218314c Notify language server when saving a buffer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-26 11:45:59 -07:00
Antonio Scandurra
0674e76864 WIP 2021-10-26 19:42:40 +02:00
Nathan Sobo
ab4f90a20a Get language and project compiling 2021-10-25 09:26:36 -06:00
Max Brunsfeld
282195b13e Assign new file handles on buffers when their files change on disk
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-21 13:08:54 +02:00
Max Brunsfeld
eb9d7c8660 Update buffer's saved mtime when file is reloaded after on-disk change
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-21 12:05:44 +02:00
Max Brunsfeld
eea0f35d38 Rename TextBuffer back to Buffer 2021-10-21 11:12:19 +02:00
Max Brunsfeld
37eae2ba67 Remove unnecessary dependencies in buffer and language crates 2021-10-21 09:40:50 +02:00
Max Brunsfeld
81a85e9c79 Extract a language crate 2021-10-20 22:51:40 +02:00