Commit Graph
144 Commits
Author SHA1 Message Date
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 509bc3db97 Add Buffer::anchored_edits_since method
This method returns the anchor range associated with each edit. The
anchor ranges allow you to determine how each edit interacts with
an existing anchor range that the edit has touched.
2022-08-29 16:51:31 -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
Antonio Scandurra 89b54e5272 Move operation serialization off the main thread 2022-08-23 16:34:25 +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
ForLoveOfCatsandMikayla fbea44bc5c One big cleanup pass of clippy lints
Co-authored-by: Mikayla <mikayla@zed.dev>
2022-08-10 16:51:01 -07:00
Max Brunsfeld 88efb420e4 Replaces lines_utf16 with a single u32 - last_line_len_utf16 2022-07-25 11:35:42 -07:00
Antonio Scandurra cb2dfa883e Introduce MultiBuffer::clip_offset_utf16 2022-07-25 15:06:04 +02:00
Antonio Scandurra 37c4f2bbf3 Introduce Rope::clip_offset_utf16 2022-07-25 15:02:45 +02: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 ffdedfe04d 🎨 2022-07-23 09:31:41 +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 Brunsfeld 9e716749e6 Combine adjacent ranges in 'edited_ranges_for_transaction' 2022-07-22 17:41:31 -07: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
Max BrunsfeldandAntonio Scandurra 48aff8d05d Move edited_ranges_for_transaction from BufferSnapshot to Buffer
Co-authored-by: Antonio Scandurra <antonio@zed.dev>
2022-07-22 11:24:14 -07:00
Antonio Scandurra dbe8a85af5 Treat NSTextInputClient ranges as UTF-16 2022-07-21 13:41:35 +02:00
Antonio Scandurra d103825bc6 Start indexing UTF-16 offsets
This is needed because cocoa will report ranges as UTF-16 indices.
2022-07-21 09:40:48 +02:00
K Simmons ed91cee43d working diagnostic popover. Also renamed GoToNextDiagnostic to GoToDiagnostic and adjusted it's action to jump to the popover's diagnostic if it is visible 2022-07-20 19:02:33 -07:00
Antonio ScandurraandMax Brunsfeld 6d573a2822 Normalize line endings when parsing completions
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-07-06 19:32:45 +02:00
Antonio Scandurra 0f77fd8b2d Replace lone carriage returns with newlines 2022-07-06 11:00:56 +02:00
Antonio Scandurra 862e11cc09 Don't slice midway through multi-byte char when detecting line ending 2022-07-06 10:21:30 +02:00
Max BrunsfeldandKeith Simmons e6c9549bbd Strip carriage returns from all text in text::Buffer
* Moving the logic from Rope to text::Buffer makes it easier
  to keep the Rope in sync with the fragment tree.
* Removing carriage return characters is lossier, but is much
  simpler than incrementally maintaining the invariant that
  there are no carriage returns followed by newlines. We may
  want to do something smarter in the future.

Co-authored-by: Keith Simmons <keith@zed.dev>
2022-07-05 17:25:09 -07:00
Max Brunsfeld 69ed736484 Change Buffer constructors to construct the History internally 2022-07-05 14:51:52 -07:00
Antonio Scandurra c24e1a36ca Replace \r and \r\n with \n when indexing text into the rope 2022-07-04 15:37:40 +02:00
Antonio Scandurra 42064f76b0 Don't compute fingerprint for every text summary 2022-06-17 15:15:27 +02:00
Antonio Scandurra 5ad9e9e6c8 Determine Buffer::is_dirty based on the rope's fingerprint 2022-06-17 12:38:25 +02:00
Antonio Scandurra 4d65ad3543 Introduce a new fingerprint field to TextSummary
This is calculated in `Rope` and uses the `bromberg_sl2` homomorphic
hash function to determine the fingerprint of a single chunk and
compose each chunk fingerprint into a single fingerprint for the entire
rope that is equivalent to hashing all the rope's bytes at once.
2022-06-17 12:12:37 +02:00
Max Brunsfeld 60335c5d1c Add support for hard tabs
* Add a `hard_tabs` setting that causes indentation to be performed
  using a tab instead of multiple spaces.
* Change Buffer's indentation-related APIs to return an `IndentSize`
  struct with a length and a kind, instead of just a single u32.
* Use hard tabs by default in Go.
2022-06-08 18:30:10 -07:00
Keith Simmons 36fa835664 Enable copy and paste in vim mode 2022-05-26 17:02:05 -07:00
Antonio Scandurra 71dfc5d915 Clear redo stack when pushing remote transaction or ending a local one 2022-05-22 10:33:26 +02:00
Keith Simmons cdbad9aee4 Initial visual mode 2022-05-10 11:12:28 -07:00
Keith Simmons 94b6f4beb5 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 47d4f42467 Consolidate edit and edit_batched functions 2022-04-28 16:52:04 -07:00
Max BrunsfeldandKeith Simmons 76e4c4d0f1 Remove Option from Buffer edit APIs
Previously, buffer edits represented empty strings as None
variants of an Option. Now, the edit logic just explicitly
checks for empty strings.

Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-27 18:00:13 -07:00
Keith Simmons 5051769dd3 Building, but failing test WIP 2022-04-27 17:25:38 -07:00
Antonio ScandurraandNathan Sobo e22b136a50 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
Antonio Scandurra a51b05d3ff Fix divergence bug when peer reconnects reusing a prior replica id
We forgot to observe the footprint of the reconnecting replica's prior
undos into the local clock. This could cause the replica to generate
edits with a version strictly smaller than what other peers may have
observed. As such, those peers would think they had already seen those
edits and skip them.
2022-04-11 13:17:47 +02:00
Max Brunsfeld c190735d28 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 cd4adebc0e Fix common_prefix_at panic when needle contains multibyte chars
Also, make the prefix matching case-insensitive, since this is the
typical behavior with autocomplete.
2022-04-01 14:52:38 -07:00
Keith Simmons bad4e01909 Add test for common_prefix_at and rewrite it to be more readable and
pass the new test cases
2022-03-31 01:09:58 -07:00
Max BrunsfeldandKeith Simmons 8450d218cd Start work on interpreting 'label/insertText' completions
These completions don't supply a range that should be overwritten, so
the client needs to infer it via substring matching.

Co-authored-by: Keith Simmons <keith@zed.dev>
2022-03-30 17:47:25 -07:00
Antonio Scandurra f75734351c Introduce MultiBuffer::symbols_containing 2022-03-29 15:08:37 +02:00
Nathan Sobo b0e20a4715 Merge pull request #682 from zed-industries/vim-hjkl
Vim hjkl
2022-03-26 07:11:46 -06:00
Keith SimmonsandNathan Sobo 4a4982d518 Add initial vim mode mode switching
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-25 20:10:37 -07:00
Antonio ScandurraandNathan Sobo 8aa34653a9 Rename Patch::transform_old to Patch::old_to_new
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-25 14:57:40 +01:00
Antonio Scandurra 5c3e450318 Introduce Patch::transform_old 2022-03-25 14:28:38 +01:00
Keith SimmonsandNathan Sobo 1eacdcf00a Remove result from anchor cmp functions
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-24 11:48:31 -07:00
e0d394eaf6 Change language::anchor::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
dcb6b335e7 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