Commit Graph
449 Commits
Author SHA1 Message Date
Max Brunsfeld ed323dbfd9 Fix crash when querying for enclosing brackets at EOF 2022-09-02 10:23:46 -07:00
Mikayla Maki 4e3db12e8e Finished terminal search 2022-09-01 13:45:46 -07:00
Max Brunsfeld 13cf937778 Merge pull request #1559 from zed-industries/language-injection
Add language injection support
2022-08-30 11:54:00 -07:00
Max Brunsfeld bebc706b8c Fix bugs in SyntaxMap::interpolate found by the randomized test 2022-08-29 16:52:58 -07:00
Max Brunsfeld 1e41f83ba9 Check invariants after interpolating tree in random syntax map test 2022-08-29 16:16:11 -07:00
Max Brunsfeld a4fd090f61 Start work on randomized test for SyntaxMap, fix discovered bugs 2022-08-25 17:49:39 -07:00
Max Brunsfeld 7f9477bf28 Update to latest tree-sitter commit
This is needed for https://github.com/tree-sitter/tree-sitter/pull/1845
2022-08-25 10:58:46 -07:00
Max Brunsfeld 8bee4958f2 Fix re-parsing when buffer's language has changed 2022-08-24 15:32:42 -07:00
Max Brunsfeld 67a565580e Fix test about auto-indent with no indent query 2022-08-24 15:29:07 -07:00
Max Brunsfeld 9c23ca0d98 Clean up some of buffer's syntax-related methods 2022-08-24 15:11:26 -07:00
Max Brunsfeld 373f434075 Fix out-of-range panic when requesting outline items at EOF 2022-08-24 15:10:53 -07:00
Max Brunsfeld dda5fe53c2 Update syntax map's interpolated version when a parse completes 2022-08-24 15:09:10 -07:00
Max Brunsfeld 80ac53d83d Use SyntaxMap in Buffer 2022-08-24 13:00:27 -07:00
Max Brunsfeld cce0d49f8a Add SyntaxMap methods for running queries and combining their results 2022-08-23 14:26:09 -07:00
Max Brunsfeld ff57772464 Fix case where layers were processed linearly when reparsing 2022-08-23 09:38:03 -07:00
Antonio Scandurra 89b54e5272 Move operation serialization off the main thread 2022-08-23 16:34:25 +02:00
Antonio Scandurra ce4bb4e715 Stream buffer ops in the background when creating buffer for peers 2022-08-23 16:05:56 +02:00
Antonio Scandurra 9aa646cc86 Simplify proto::Buffer to express its fields in terms of operations 2022-08-23 12:40:20 +02:00
Max Brunsfeld 566454a129 Fix more bugs in syntax map interpolation 2022-08-22 17:52:14 -07:00
Max Brunsfeld 63ad7c088b Test more editing patterns of SyntaxMap, fix bugs 2022-08-22 15:36:58 -07:00
Max Brunsfeld 21533f507a Restructure handling of changed regions when reparsing 2022-08-21 11:39:02 -07:00
Max Brunsfeld f99a5ce9c6 Fix off-by-one in handling edits, start on more edit unit tests 2022-08-21 11:37:17 -07:00
Max Brunsfeld 87ce26005e Start work on handling edits in the SyntaxMap 2022-08-21 11:37:10 -07:00
Max Brunsfeld 94eb0d6c55 Start work on a SyntaxMap data structure 2022-08-21 11:37:10 -07:00
Antonio Scandurra 2e7bfd19c1 Create buffers for remote collaborators out of band
Previously, we would use `Project::serialize_buffer_for_peer` and
`Project::deserialize_buffer` respectively in the host and in the
guest to create a new buffer or just send its ID if the host thought
the buffer had already been sent.

These methods would be called as part of other methods, such as
`Project::open_buffer_by_id` or `Project::open_buffer_for_symbol`.
However, if any of the tasks driving the futures that eventually
called `Project::deserialize_buffer` were dropped after the host
responded with the buffer state but (crucially) before the guest
deserialized it and registered it, there could be a situation where
the host thought the guest had the buffer (thus sending them just the
buffer id) and the guest would wait indefinitely.

Given how crucial this interaction is, this commit switches to creating
remote buffers for peers out of band. The host will push buffers to guests,
who will always refer to buffers via IDs and wait for the host to send them,
as opposed to including the buffer's payload as part of some other operation.
2022-08-17 11:55:36 +02:00
Antonio Scandurra d5a38f0bb1 Fix divergence bug in undo/redo
As part of #1405, we changed the way we performed undo and redo to
support combining transactions that were not temporally adjacent for
IME purposes.

We introduced a bug with that release that caused divergence
when performing undo: the bug was caused by only changing the visibility
of fragments whose insertion id was contained in the undo operation. However,
an undo operation also affects deletions which we were mistakenly not
considering. Randomized tests caught this but I guess we didn't run enough
of them.
2022-08-17 11:30:04 +02:00
K Simmons 3dce18540e clippy fixes for focus change 2022-08-10 16:51:01 -07:00
ForLoveOfCatsandMikayla fbea44bc5c One big cleanup pass of clippy lints
Co-authored-by: Mikayla <mikayla@zed.dev>
2022-08-10 16:51:01 -07:00
Julia 1e78c24e45 Merge pull request #1451 from zed-industries/tab-auto-indent
Auto-indent on tab for cursors left of the suggested indent level
2022-08-02 15:52:12 -04:00
Antonio Scandurra 84b1a2722e Compute diffs based on characters rather than lines
Previously, a change on a given line would cause that whole line to be
replaced. In turn, this caused anchors on that line to go to the start
of that line because they would lie inside of a deleted region after applying
the diff.

By switching to a character-wise diff, we perform smaller edits to the buffer
which stabilizes anchor positions.
2022-08-02 16:52:37 +02:00
Max BrunsfeldandJulia Risley 8505231e9a Start work on auto-indenting lines on tab
Co-authored-by: Julia Risley <floc@unpromptedtirade.com>
2022-08-01 16:47:59 -07:00
Max Brunsfeld 2c732526a9 Fix mistakes in editor auto-indent test 2022-08-01 11:02:29 -07:00
Max Brunsfeld 75c349243c 🎨 Rename and simplify some autoindent stuff 2022-07-28 22:40:30 -07:00
Max Brunsfeld 357c9d53a9 Record start columns when writing to the clipboard from Zed 2022-07-28 22:13:32 -07:00
Max Brunsfeld 345e33fa98 Start work on adjusting pasted text based on old start column 2022-07-28 17:29:42 -07:00
Max BrunsfeldandMikayla Maki 669d716519 Introduce AutoindentMode parameter to Buffer::edit
This controls whether or not we preserve the relative indentation
of inserted text blocks.

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2022-07-28 14:03:31 -07:00
Max BrunsfeldandMikayla Maki 48610f5819 Remove indent_size parameter from Buffer::edit_with_autoindent
Instead, compute the indent size by reading the settings inside that method.

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2022-07-28 13:00:05 -07:00
Max Brunsfeld d349ca1f4e Fix error in autoindent range calculation 2022-07-28 11:51:03 -07:00
Max Brunsfeld 1a1b7810b7 Restructure autoindent to preserve relative indentation of inserted text 2022-07-26 17:43:43 -07:00
Max Brunsfeld 0232aba028 🎨 compute_autoindents 2022-07-26 17:09:30 -07:00
Max Brunsfeld 07f1486c13 Improve calculation of which lines are new when auto-indenting 2022-07-26 17:09:30 -07:00
Antonio Scandurra 47fce17ff8 Merge branch 'main' into ime-support-2 2022-07-25 10:47:49 +02:00
Antonio Scandurra daff3fc7f6 Coalesce IME compositions into a single edit 2022-07-25 09:53:51 +02:00
Antonio Scandurra db5f26474b Allow grouping local transactions even if remote peer edits in between 2022-07-23 09:27:21 +02:00
Max BrunsfeldandAntonio Scandurra 51868f445b Remove versioned offset ranges from transactions and undo operations
Now, instead of using these versioned offset ranges, we locate the
fragments associated with a transaction using the transaction's
edit ids. To make this possible, buffers now store a new map called
`insertion_slices`, which lets you look up the ranges of insertions
that were affected by a given edit.

Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2022-07-22 17:28:55 -07:00
K Simmons f14c30511d add test coverage for diagnostic popover 2022-07-20 19:02:33 -07:00
Antonio Scandurra 44459a3c7e Merge pull request #1385 from zed-industries/fix-lifetime-error
Fix spurious borrow checker error
2022-07-18 12:22:54 +02:00
Antonio Scandurra 9de9d517fd Differentiate among tabs with the same name
This commit introduces a new, optional `Item::tab_description` method
that lets implementers define a description for the tab with a certain
`detail`. When two or more tabs match the same description, we will
increase the `detail` until tabs don't match anymore or increasing the
`detail` doesn't disambiguate tabs any further.

As soon as we find a valid `detail` that disambiguates tabs enough, we
will pass it to `Item::tab_content`. In `Editor`, this is implemented by
showing more and more of the path's suffix as `detail` is increased.
2022-07-14 11:54:11 +02:00
Max Brunsfeld fad4365565 Fix association of 'json' lsp language id with JSON language 2022-07-12 15:43:59 -07:00
Antonio Scandurra 810a5d5318 Merge pull request #1252 from zed-industries/plugin
Language Server WebAssembly Plugin Integration (Part 2)
2022-07-12 11:04:20 +02:00