Commit Graph
194 Commits
Author SHA1 Message Date
Keith Simmons dcc3f6731f highlight both brackets, only when empty selection, and add test 2022-07-05 15:19:05 -07:00
Keith Simmons 5c67560264 Use NonZeroU32 to ensure settings tabsize cannot be zero 2022-06-23 12:55:38 -07: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
Keith Simmons 5f1e3a5933 Rework hover delay, respect editor font size, and enable hover in multibuffers 2022-06-09 17:03:44 -07:00
Max Brunsfeld 2e11995a75 Merge pull request #1155 from zed-industries/golang
Add Go support
2022-06-09 14:18:37 -07: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
Antonio Scandurra 6b02cce095 Expose a unique key: usize in ExcerptBoundary 2022-06-08 15:02:52 +02:00
Antonio Scandurra 6a4995357b Introduce an optional primary field to ExcerptRange 2022-06-08 12:23:12 +02:00
Antonio Scandurra cbbdef5434 Extract an ExcerptRange containing a context field in multi_buffer
This lays the groundwork for adding an optional `primary` field that can
be supplied to provide the "jump to" feature.
2022-06-08 12:13:04 +02:00
Antonio Scandurra dc056176f2 Make Buffer::edit and MultiBuffer::edit resilient to inverted ranges
Previously, we would accept edits containing out-of-order ranges. When
generating such ranges in our randomized tests, many invariants started
breaking causing e.g. undo/redo to misbehave and operation application
to panic.

In theory, we should never pass inverted ranges, but this commit changes
the above functions to swap the start and the end when that occurs to avoid
breaking the entire system and panicking.
2022-06-06 15:22:36 +02:00
Keith Simmons be8bfa9592 WIP line mode operations 2022-05-26 17:02:05 -07:00
Max Brunsfeld d14224a54d Merge pull request #1027 from zed-industries/missing-menu-commands
Add missing File menu commands, improve handling of unsaved multibuffers
2022-05-23 21:29:32 -07:00
Max Brunsfeld 259d76aa40 Start work on handling multibuffers properly when closing unsaved buffers 2022-05-22 16:48:33 -07:00
Antonio Scandurra 1fb594a0ac Clear multi-buffer redo stack when pushing transaction onto undo stack 2022-05-22 10:44:32 +02:00
Antonio Scandurra 65d11f89f4 Bump FoldSnapshot version if excerpt gets edited outside of its bounds
This will cause layers above `FoldMap` to grab a fresh snapshot of the `FoldMap`
and, as a result, of the underlying `MultiBufferSnapshot`. It is a necessary change
because, even though the coordinate space is not affected, a buffer edit taking place
*before* an excerpt range could cause the excerpt buffer rows to change, e.g. if
lines were added or removed. This manifested itself in a randomized test.
2022-05-18 10:13:18 +02:00
Keith Simmons b03abdb6df Reduce accessibility of multibuffer read to reduce risk of borrowing snapshot and buffer refcells twice 2022-05-13 16:58:30 -07:00
Keith Simmons 1ba3b210c3 Fix multiple cursors inserting repeated text in multibuffers 2022-05-10 13:32:27 -07:00
Keith Simmons b2c1230fea Convert common edit strings to Arc<str> and simplify duplicate line 2022-04-29 14:57:20 -07:00
Keith Simmons 47d4f42467 Consolidate edit and edit_batched functions 2022-04-28 16:52:04 -07:00
Keith Simmons 5051769dd3 Building, but failing test WIP 2022-04-27 17:25:38 -07:00
Max Brunsfeld b00373f24c Update breadcrumbs when multibuffers' excerpts change 2022-04-06 17:12:36 -07:00
Keith SimmonsandMax Brunsfeld 33a33439de Use language specific tabsize in editor commands
Co-authored-by: Max Brunsfeld <max@zed.dev>
2022-04-06 15:10:29 -07:00
Max BrunsfeldandKeith Simmons e7039c123d Avoid maintaining indent size as state on buffers
Indent size is still hard-coded, but it's now controlled by the
editor and not the buffer.

Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-06 10:22:29 -07:00
Antonio Scandurra f252da61a6 Show full path for file worktrees or when there is more than 1 worktree 2022-04-02 16:10:10 +02:00
Antonio Scandurra f75734351c Introduce MultiBuffer::symbols_containing 2022-03-29 15:08:37 +02: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
Antonio Scandurra 2f1b1abbb8 Merge pull request #661 from zed-industries/follow
Introduce basic following experience
2022-03-23 15:17:44 +01:00
Nathan SoboandKeith Simmons ce4280c12f Remove CharKind::Newline
This is just a character, and so it seems clearer to refer to it specifically when we want to know if a character is a newline. There was only one case where we relied on Newline being different from Whitespace, and we special-cased that instance. Changing this actually makes us match the behavior of VS Code when double-clicking runs of multiple newlines.

/cc @as-cii

Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-21 15:17:32 -06:00
Max BrunsfeldandAntonio Scandurra 70e323e4dc Start work on updating editors's scroll positions when following
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-18 12:56:20 -07:00
Antonio ScandurraandNathan Sobo f37b22212f Implement shift-f8 to go to previous diagnostic
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:13:23 +01:00
Antonio Scandurra c2c68cbfe9 Start on implementing filtering support for Cursor::prev 2022-03-15 15:13:23 +01:00
Antonio Scandurra e1405addd2 Add more assertions to investigate #503 in the future 2022-03-14 16:53:39 +01:00
Antonio ScandurraandNathan Sobo 68191e9ba7 Ensure there's at least one selection in Editor::set_selections
This commit introduces an assertion that will cause Zed to panic as
soon as the invariant gets violated. This will be useful to investigate
issue #503.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-14 16:17:14 +01:00
Nathan Sobo ea7f2b309d Merge remote-tracking branch 'origin/main' into select-on-rename 2022-03-12 10:10:23 -07:00
Antonio Scandurra c3ac7e639b Account for all excerpts ever inserted when determining new excerpt ID 2022-03-12 17:50:09 +01:00
Nathan Sobo 2c6d8e9d65 Merge branch 'main' into select-on-rename 2022-03-11 15:30:07 -07:00
Antonio Scandurra f74035bd29 💄 2022-03-11 17:13:28 +01:00
Antonio Scandurra 1a5f0456e6 Assume the anchor is valid if we can find an excerpt that contains it 2022-03-11 17:08:12 +01:00
Nathan SoboandAntonio Scandurra c598628f94 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
Antonio Scandurra 092abbe39b Respect excerpt's range when comparing two anchors both belonging to it 2022-03-11 12:42:22 +01:00
Nathan Sobo 1e76d109a3 WIP 2022-03-10 11:32:14 -07:00
Antonio Scandurra 518662da6d Delete till previous tabstop when backspacing within indent column 2022-03-10 10:28:24 +01:00
111d5305ea 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
Antonio Scandurra c311f59dca 🎨 2022-02-26 14:31:36 +01:00
Antonio ScandurraandNathan Sobo 15852294ea Don't share query editor state after project find has been split
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-25 18:10:48 +01:00
Antonio Scandurra 531fab9035 Always sync before clearing or removing excerpts from MultiBuffer
We don't have any test that proves this is needed but seems good nonetheless.
2022-02-25 15:36:43 +01:00
Antonio Scandurra 7522fa71a4 Gracefully handle passing an empty set of ranges to push_excerpts 2022-02-25 15:36:16 +01:00
Antonio ScandurraandNathan Sobo 240e42d2ff Refine project find's UX
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-25 15:27:34 +01:00