Commit Graph

243 Commits

Author SHA1 Message Date
Antonio Scandurra
27c90f12f6 Merge remote-tracking branch 'origin/main' into ai-refactoring 2023-08-25 13:37:32 +02:00
Antonio Scandurra
c1bd035875 Rework inline assistant 2023-08-25 11:39:27 +02:00
Antonio Scandurra
71a5964c18 Rename merge_transaction_into to merge_transactions 2023-08-24 14:26:42 +02:00
Max Brunsfeld
1d08f44e70
Snapshot channel notes buffers when everyone leaves
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-08-23 18:37:01 -07:00
Antonio Scandurra
e4f49746e1 Group modal assistant edits into the same transaction
Co-Authored-By: Kyle Caverly <kyle@zed.dev>
2023-08-23 17:09:15 +02:00
Kirill Bulatov
ae54e1d224 Remove excessive hint update queries
* Filter out queries for outdated buffers just before hint tasks spawn:
  multicared edits might empit standalone events simultaneously
* Only spawn inlay update tasks for visible buffers with corresponding
  language
* Do not spawn tasks for local projects' buffers without LSP servers
2023-06-30 22:03:21 +03:00
Nathan Sobo
8c298a9da5 Rename SumTree::push_tree to ::append 2023-06-19 19:49:33 -06:00
Joseph Lyons
7c60f636d5 Fix typos 2023-06-02 22:02:19 -04:00
Piotr Osiewicz
345fad3e9d
editor: add select previous command (#2556)
Added a `select previous` command to complement `select next`.
Release Notes:

- Added "Select previous" editor command, mirroring `Select next`.
Ticket number: Z-366
2023-06-02 17:32:34 +02:00
Mikayla Maki
bbb68c523c
Refactored apart the forward and the backwards iterator for diff hunks 2023-05-19 18:09:47 -07:00
Mikayla Maki
43e301eeef
refine batched anchor conversions
co-authored-by: max <max@zed.dev>
2023-05-19 16:52:57 -07:00
Julia
7e06062bdb Store history base text as rope
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-05-04 12:32:31 -04:00
Max Brunsfeld
ebbe52e6b0 🎨 Specify more dependencies at the workspace level 2023-04-24 17:41:55 -07:00
Max Brunsfeld
32c57bcd22 Store buffer's diagnostic sets in a smallvec 2023-04-20 08:58:41 -07:00
Max Brunsfeld
bd7d50f339 Fix 'invalid insertion' panic when following
Wait for the necessary buffer operations to arrive before attempting to
set selections and scroll top.
2023-04-18 16:13:18 -07:00
Max Brunsfeld
25e3c4e586 Fix leak when project is unshared while LSP handler waits for edits 2023-04-10 17:03:58 -07:00
Max Brunsfeld
2d63ed3ca4 Merge branch 'main' into randomized-tests-operation-script 2023-04-05 17:10:20 -07:00
Mikayla Maki
b585470518 Invalidate copilot suggestion on backspaces
Restore an observation on initialization

co-authored-by: antonio <antonio@zed.dev>
2023-04-05 08:48:39 -07:00
Max Brunsfeld
c960277349 Merge branch 'main' into randomized-tests-operation-script 2023-04-03 13:09:25 -07:00
Antonio Scandurra
5f579a4287 Fix prefix/suffix calculation when determining copilot suggestion
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2023-03-31 18:05:07 +02:00
Max Brunsfeld
cbeb6e692d Move postage crate version specification to workspace Cargo.toml 2023-03-21 11:26:13 -07:00
Max Brunsfeld
9c25d37dfc Merge branch 'main' into randomized-tests-operation-script
In randomized integration test, incorporate random updates of existing
files into the test's new structure.
2023-01-24 12:39:24 -08:00
Mikayla Maki
d060114f00 Added complete scripts for generating third party license files 2023-01-23 12:47:12 -08:00
Max Brunsfeld
56080771e6 Add test for avoiding indent adjustment inside newly-created errors 2023-01-20 17:02:38 -08:00
Max Brunsfeld
f243633f3e Set up flow for mutating clients via explicit operation values 2023-01-06 15:32:11 -08:00
Nathan Sobo
273988b8d5 Set transaction group interval to ZERO by default in tests
We were seeing non-deterministic behavior in randomized tests when
generating backtraces took enough time to cause transactions to group
in some cases, but not group in others.

Tests will need to explicitly opt into grouping if they want it by
setting the interval explicitly. We have tests in the text module that
currently test the history grouping explicitly, but I'm not sure
it's needed elsewhere.
2022-12-27 16:47:28 -07:00
Max Brunsfeld
6120d6488b Start work on following in multi-buffers 2022-11-29 14:50:43 -08:00
Max Brunsfeld
f71145bb32 Add a layer of indirection between excerpt ids and locators 2022-11-28 14:18:49 -08:00
Julia
525d84e5bf Remove spurious lifetimes
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-11-23 13:52:39 -05:00
Julia
55ca085d7d Consistency in prefix/suffix/signature of UTF16 point to point conversion
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-11-23 13:52:18 -05:00
Julia
e51cbf67ab Fixup compile errors 2022-11-22 02:49:47 -05:00
Julia
1c84e77c37 Start adding concept of Unclipped text coordinates
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-11-21 15:48:25 -05:00
Julia
436c89650a Rename clamped -> clipped 2022-11-21 15:23:00 -05:00
Julia
074e3cfbd6 Clamp UTF-16 to point conversions 2022-11-21 14:25:01 -05:00
Julia
bb32599ded Clamp for all UTF-16 to offset conversions which used to use ToOffset 2022-11-21 14:25:01 -05:00
Julia
f9cbed5a1f Clamp UTF-16 coordinate while performing LSP edits rather than panicing 2022-11-21 11:48:13 -05:00
Max Brunsfeld
6cdf4e98fc Re-export basic text types from text and language crates
Also avoid production dependencies on fs and rope in collab
2022-10-12 15:48:19 -07:00
Mikayla Maki
0beb97547e Finished refactoring out fs and rope 2022-10-11 15:25:54 -07:00
Mikayla Maki
0a8e2f6bb0 Moved fs to it's own crate, build failing due to cyclic dependency on rope 2022-10-11 13:03:36 -07:00
Julia
ce7f6dd082 Start a test for remote git data updating
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-09-30 15:51:32 -04:00
Julia
1c5d15b85e Use sumtree instead of iterator linear search for diff hunks in range
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-30 13:32:54 -04:00
Julia
61ff24edc8 Move cloneable diff state into new snapshot type
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-09-29 13:16:02 -04:00
Julia
a86e93d46f Checkpoint on incremental diff sumtree shenanigans 2022-09-29 13:16:02 -04:00
Antonio Scandurra
f54c1f05c5 💄 2022-09-28 11:27:07 +02:00
Antonio Scandurra
e17627b07d Use a SumTree as the backing storage of UndoMap
This makes it cheap to clone and avoids slowdowns when there the undo
history is long.
2022-09-28 11:24:45 +02:00
Max Brunsfeld
d4bbf21650
Merge pull request #1559 from zed-industries/language-injection
Add language injection support
2022-08-30 11:54:00 -07:00
Max Brunsfeld
74fd348d22 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
1f12186e3c 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
f0d35ccc50 Move operation serialization off the main thread 2022-08-23 16:34:25 +02:00
Antonio Scandurra
ab236a6008 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
ForLoveOfCats
8ba2f77148 One big cleanup pass of clippy lints
Co-authored-by: Mikayla <mikayla@zed.dev>
2022-08-10 16:51:01 -07:00
Max Brunsfeld
4c8d9384b1 Replaces lines_utf16 with a single u32 - last_line_len_utf16 2022-07-25 11:35:42 -07:00
Antonio Scandurra
47e8bd5f4f Introduce MultiBuffer::clip_offset_utf16 2022-07-25 15:06:04 +02:00
Antonio Scandurra
c46be992e0 Introduce Rope::clip_offset_utf16 2022-07-25 15:02:45 +02:00
Antonio Scandurra
ca3e73106c Merge branch 'main' into ime-support-2 2022-07-25 10:47:49 +02:00
Antonio Scandurra
d3567e381c Coalesce IME compositions into a single edit 2022-07-25 09:53:51 +02:00
Antonio Scandurra
555e705ccb 🎨 2022-07-23 09:31:41 +02:00
Antonio Scandurra
0fc7308932 Allow grouping local transactions even if remote peer edits in between 2022-07-23 09:27:21 +02:00
Max Brunsfeld
79f960b69e Combine adjacent ranges in 'edited_ranges_for_transaction' 2022-07-22 17:41:31 -07:00
Max Brunsfeld
7c3421e041 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 Brunsfeld
65fd943509 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
b02681ee8a Treat NSTextInputClient ranges as UTF-16 2022-07-21 13:41:35 +02:00
Antonio Scandurra
32662b6b92 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
95952f0c66 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 Scandurra
2c1906d710 Normalize line endings when parsing completions
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-07-06 19:32:45 +02:00
Antonio Scandurra
13c9b1778b Replace lone carriage returns with newlines 2022-07-06 11:00:56 +02:00
Antonio Scandurra
113eb9b94f Don't slice midway through multi-byte char when detecting line ending 2022-07-06 10:21:30 +02:00
Max Brunsfeld
7e9beaf4bb 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
116fa92e84 Change Buffer constructors to construct the History internally 2022-07-05 14:51:52 -07:00
Antonio Scandurra
f9bad2d81d Replace \r and \r\n with \n when indexing text into the rope 2022-07-04 15:37:40 +02:00
Antonio Scandurra
4f215a77cd Don't compute fingerprint for every text summary 2022-06-17 15:15:27 +02:00
Antonio Scandurra
6f7a893ec9 Determine Buffer::is_dirty based on the rope's fingerprint 2022-06-17 12:38:25 +02:00
Antonio Scandurra
c31a233aad 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
f62fd3cddd 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
Max Brunsfeld
724affc442 Upgrade deps to avoid multiple versions of transitive deps
* env_logger
* prost-build
* bindgen
2022-06-02 17:38:33 -07:00
Keith Simmons
082036161f Enable copy and paste in vim mode 2022-05-26 17:02:05 -07:00
Antonio Scandurra
03dc7c8eb0 Clear redo stack when pushing remote transaction or ending a local one 2022-05-22 10:33:26 +02:00
Keith Simmons
37c921f972 Initial visual mode 2022-05-10 11:12:28 -07:00
Keith Simmons
d4bef67cf2
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
b4b61b4bbc Consolidate edit and edit_batched functions 2022-04-28 16:52:04 -07:00
Max Brunsfeld
e05793b52a 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
04fc1d5982 Building, but failing test WIP 2022-04-27 17:25:38 -07:00
Antonio Scandurra
cde5a45318 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
f9e0899e58 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
Nathan Sobo
7e5a3f9f6b Introduce structured logging
We're enabling the log crate feature everywhere, but only using it on the server for now.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-04-08 10:06:51 -06:00
Max Brunsfeld
79bd8642e6
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
5090e6f146 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
9385690b98 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 Brunsfeld
263e3d8176 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
099250c691 Introduce MultiBuffer::symbols_containing 2022-03-29 15:08:37 +02:00
Nathan Sobo
d4436277ee
Merge pull request #682 from zed-industries/vim-hjkl
Vim hjkl
2022-03-26 07:11:46 -06:00
Keith Simmons
bb9b36dccd Add initial vim mode mode switching
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-25 20:10:37 -07:00
Antonio Scandurra
7a6fe73440 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
eefaa86750 Introduce Patch::transform_old 2022-03-25 14:28:38 +01:00
Keith Simmons
92c7b5d6ef Remove result from anchor cmp functions
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-24 11:48:31 -07:00
Keith Simmons
ab631cf6c3 Change language::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
Keith Simmons
f6805eb802 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
Antonio Scandurra
004f98cc6d
Merge pull request #661 from zed-industries/follow
Introduce basic following experience
2022-03-23 15:17:44 +01:00
Keith Simmons
6a1c197c1b Add editor selection utilities
Also improved test that was failing during above to use marker text approach as a drive by
2022-03-22 16:08:22 -07:00
Antonio Scandurra
f0b7bd6e17 Serialize initial follow state in leader and reflect it in follower 2022-03-18 10:22:13 +01:00