Commit Graph

129 Commits

Author SHA1 Message Date
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
Antonio Scandurra
a6d0caf557 Don't seek FilterCursor upon creation
This lets us use `next` or `prev` to decide whether to park the cursor
at the first or last filtered item.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:13:23 +01:00
Antonio Scandurra
45ce503afd Start on implementing filtering support for Cursor::prev 2022-03-15 15:13:23 +01:00
Nathan Sobo
5407f25c94 Don't reuse excerpt ids in MultiBuffer
This prevents anchors from swapping their ordering, which was causing issues in FoldMap.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-11 08:50:50 -07:00
Nathan Sobo
134496ce8f Remove dead code
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-11 08:24:42 -07:00
Antonio Scandurra
317a1bb07b Remove language servers from buffers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-08 15:16:07 -08:00
Max Brunsfeld
28bacabc4e Move Network test helper from util crate into text crate
This way, `util` does not depend on `clock`.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-04 13:54:07 -08:00
Antonio Scandurra
46da80d726 Use LSP range formatting when document formatting is not available 2022-03-04 10:13:17 +01:00
Antonio Scandurra
dc5a09b3f7
Merge pull request #525 from zed-industries/preserve-worktrees
Grow worktrees monotonically when sharing and move most messages to the background
2022-03-04 09:48:18 +01:00
Max Brunsfeld
05df1dfae9 Disable doctests for all libraries
We don't use them, and they add a lot of noise to the test output
when running all tests in the workspace.
2022-03-03 16:15:56 -08:00
Antonio Scandurra
556d9cc53f Correctly defer undo operations when messages arrive out of order
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-03 18:07:59 +01:00
Antonio Scandurra
14d26eeedc Move several buffer-related messages to the background 2022-03-03 12:18:19 +01:00
Antonio Scandurra
0bf944e038 Use Project::search in ProjectFind and show search results 2022-02-25 10:32:45 +01:00
Antonio Scandurra
cf7cc83f85 Simplify undo_to_transaction and redo_to_transaction
We don't need to mutate the history anymore now that we render pending renames
with a block decoration.
2022-02-19 10:52:21 +01:00
Antonio Scandurra
f9723ae16b Undo temporary edits before performing rename or canceling it
Also, wire up remote renames.
2022-02-18 11:41:47 +01:00