Commit Graph

2438 Commits

Author SHA1 Message Date
Antonio Scandurra
6f5ca6064b Use anchor_after in randomized tests to match BlockMap 2021-11-19 18:04:31 +01:00
Antonio Scandurra
c844fcdc09 Invalidate active diagnostic when its primary range collapses
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-19 16:46:54 +01:00
Antonio Scandurra
b0afc80678 Ignore diagnostics with empty ranges
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-19 16:30:26 +01:00
Antonio Scandurra
a023950f28 Remove unused group_range field
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-19 16:17:50 +01:00
Antonio Scandurra
8e74cc178e Invalidate active diagnostics when they are removed
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-19 16:15:22 +01:00
Antonio Scandurra
61d8848b31 Make BlockMap::sync private
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-19 15:44:19 +01:00
Antonio Scandurra
dfbfa86548 WIP 2021-11-19 15:31:33 +01:00
Antonio Scandurra
2664dad2bc Allow styling of invalid diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-19 14:35:00 +01:00
Antonio Scandurra
8d5e3fb159 Allow styling of the gutter for block lines 2021-11-19 11:30:01 +01:00
Max Brunsfeld
8d1a4a6a24 Start work on allowing blocks to be styled 2021-11-18 18:16:35 -08:00
Max Brunsfeld
c04151f999 Bind ShowNextDiagnostic to f8 2021-11-18 14:24:03 -08:00
Max Brunsfeld
6aa346dec8 Fix switched input + output rows in BlockSnapshot::buffer_rows 2021-11-18 12:41:58 -08:00
Max Brunsfeld
bef09696f6 Align block text with the anchor's column
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 12:17:22 -08:00
Antonio Scandurra
1a8b23e118 Color diagnostic messages based on their severity
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 17:47:10 +01:00
Antonio Scandurra
f39942863b Dismiss active diagnostics when hitting escape
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 16:57:05 +01:00
Antonio Scandurra
5094380c83 Enhance keyboard navigation when showing next diagnostic
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 16:55:18 +01:00
Antonio Scandurra
643545e91e When showing the next diagnostic, advance to the next *primary* one
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 16:04:16 +01:00
Antonio Scandurra
0e51365770 In a diagnostic group, mark the highest-severity diagnostic as primary
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 15:53:00 +01:00
Antonio Scandurra
401b59be5c Refactor retrieving oldest and newest selection
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 15:18:35 +01:00
Antonio Scandurra
0a6293bcda Support highlighting in blocks
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 14:08:21 +01:00
Antonio Scandurra
0f1eb3dd2e Skip block lines when moving up and down
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-18 13:45:06 +01:00
Antonio Scandurra
856768a43c Remove aggressive logging from WrapMap update code paths 2021-11-18 11:13:40 +01:00
Antonio Scandurra
08e0444ee4 Use char count instead of byte count to determine longest row 2021-11-18 11:01:12 +01:00
Antonio Scandurra
b80887dabe Don't insert blocks within multi-byte characters in randomized test 2021-11-18 10:54:25 +01:00
Antonio Scandurra
572e571927 Test longest row only when tabs are not present or the tab size is 1
This is because the longest row calculation is best-effort at the moment,
since this information is not indexed in the `TabMap`.
2021-11-18 10:54:22 +01:00
Antonio Scandurra
5a9dea5299 Ensure TabMap works correctly when there are folds 2021-11-18 10:37:04 +01:00
Antonio Scandurra
84d257470a Fix empty range edge case in FoldMap 2021-11-18 10:33:31 +01:00
Antonio Scandurra
4967a8d5ef Trim expanded tabs if they overshoot the provided range 2021-11-18 09:52:42 +01:00
Antonio Scandurra
b10c82c015 Stop at range.end when computing text summary for range in TabMap 2021-11-18 09:52:05 +01:00
Nathan Sobo
213aa36e1c WIP: Track down bugs with longest_row on wrap map
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-17 19:45:56 -07:00
Nathan Sobo
c5956a0363 Start at the end of the last transform when catching up to edits during wrapping
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-17 19:44:17 -07:00
Max Brunsfeld
8230dd9a3b WIP - BlockSnapshot::longest_row 2021-11-17 16:00:52 -08:00
Max Brunsfeld
cb18131432 Represent scroll position correctly when scrolled mid-block
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-17 14:56:55 -08:00
Max Brunsfeld
707ffe8ff3 Implement BlockSnapshot::line_len, use it in DisplayMap
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-17 14:56:05 -08:00
Max Brunsfeld
00b5cc472e Fix BlockSnapshot::chunks when starting in a block
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-17 14:54:47 -08:00
Max Brunsfeld
1c3bf90a8a Reimplement BlockSnapshot::{clip_point,to_block_point,max_point}
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-17 12:54:14 -08:00
Antonio Scandurra
e60500dd7c Re-enable soft-wrapping in randomized tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-17 19:46:43 +01:00
Antonio Scandurra
88d0c04444 Implement BlockSnapshot::buffer_rows
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-17 19:45:06 +01:00
Antonio Scandurra
198f6694b7 Use options to represent soft-wrapped buffer rows
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-17 19:30:40 +01:00
Antonio Scandurra
d9283efbe6 Make BlockMap 1d
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-17 19:26:57 +01:00
Nathan Sobo
18354c5e04 Hack in show next diagnostic command
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-16 16:51:38 -08:00
Nathan Sobo
52a4c15c14 Eliminate non-highlighted chunks APIs
Now we only have a single code path for chunks across all layers, but highlighting is optional and controlled by a flag.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-16 16:51:38 -08:00
Nathan Sobo
7dd9b9539e WIP 2021-11-16 13:19:04 -07:00
Nathan Sobo
092689ed56 WIP
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-16 13:10:06 -07:00
Nathan Sobo
880b3f087f Insert empty isomorphic transforms on empty lines
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-16 12:14:00 -07:00
Antonio Scandurra
d25ec39a23 Rework BufferRows iterator to pass the randomized tests
...without booleans.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-16 18:18:47 +01:00
Antonio Scandurra
712616d167 Start on a randomized test for BlockMap::buffer_rows 2021-11-16 15:35:35 +01:00
Max Brunsfeld
1cc7615d06 Implement basic version of BlockMap::buffer_rows
Passed 1 simple test

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-15 17:41:13 -08:00
Max Brunsfeld
76ee44748e Fix minor bug in BlockMap::clip_point
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-15 16:25:51 -08:00
Nathan Sobo
7d1ba6455b Implement BlockMapWriter::remove
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-15 17:09:26 -07:00
Nathan Sobo
7b12c1c9e0 Enable soft wrap in randomized test of BlockMap
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-15 16:59:02 -07:00
Nathan Sobo
862b988d56 Position blocks above/below buffer lines, even when the anchored line is soft-wrapped
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-15 16:45:51 -07:00
Max Brunsfeld
2cb8b0fcd3 wip 2021-11-15 15:04:53 -08:00
Max Brunsfeld
3bd4542bce Remove bias parameter when converting display points to buffer points
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-15 14:36:03 -08:00
Max Brunsfeld
213b94afd4 Remove bias parameter from to_display_point
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-15 14:21:55 -08:00
Max Brunsfeld
0a704b8d67 Fix infinite loop in BlockMap::highlighted_chunks
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-15 14:18:45 -08:00
Max Brunsfeld
b4bc7906d2 Propagate wrap edits to block map when folding / unfolding
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-15 14:18:24 -08:00
Max Brunsfeld
d2f4d37af8 Get BlockMap randomized test passing w/o soft wraps
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-15 13:36:40 -08:00
Max Brunsfeld
3498e92d1c Get BlockMap unit test passing 2021-11-15 12:39:40 -08:00
Antonio Scandurra
763ab4d5f1 WIP 2021-11-15 19:52:48 +01:00
Antonio Scandurra
53872a6024 WIP 2021-11-15 19:38:06 +01:00
Antonio Scandurra
314c97715d WIP 2021-11-15 18:01:30 +01:00
Antonio Scandurra
131979dff0 WIP 2021-11-15 17:54:28 +01:00
Antonio Scandurra
34f85b5690 WIP 2021-11-15 17:15:30 +01:00
Antonio Scandurra
cebab56c94 Make BlockMap randomized test pass in low-complexity cases
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-15 16:47:30 +01:00
Antonio Scandurra
296944e34d Make BlockMap unit test pass with 2d coordinates
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-15 16:30:58 +01:00
Nathan Sobo
3154ccbafe WIP 2021-11-14 16:24:40 -07:00
Nathan Sobo
e644c0876e WIP: Start moving BlockMap to a 2d indexing scheme 2021-11-14 08:29:41 -07:00
Nathan Sobo
5832153712 Hack: Synthesize a newline before blocks below the last line of the buffer 2021-11-14 07:43:35 -07:00
Nathan Sobo
b6e6dafca7 Account for trailing below blocks in BlockSnapshot::max_point 2021-11-13 19:50:42 -07:00
Nathan Sobo
d6bc05cad0 Fix BlockMap unit test by skipping below blocks when advancing transforms 2021-11-13 18:19:21 -07:00
Nathan Sobo
c9cbeafc05 Start on BlockSnapshot::clip_point
Not sure it works yet. Ran into another failure in the unit tests.
2021-11-13 17:44:09 -07:00
Max Brunsfeld
364fab7b5f wip - wiring up blockmap into displaymap 2021-11-12 17:29:09 -08:00
Max Brunsfeld
c278503166 Make block insertion work in simple cases
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-12 16:40:01 -08:00
Max Brunsfeld
2e61a586b6 Fix compile errors 2021-11-12 13:55:47 -08:00
Nathan Sobo
e605a5ead2 Sketch an initial implementation for block_map::HighlightedChunks
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-12 14:51:25 -07:00
Max Brunsfeld
6f97a9be3b wip 2021-11-12 12:09:35 -08:00
Max Brunsfeld
227c612dac BlockMap WIP 2021-11-12 11:49:48 -08:00
Antonio Scandurra
c8e47a8c63 Start on a randomized test for BlockMap
This is currently passing and ensures we maintain the input coordinate
space correctly.

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-12 19:01:39 +01:00
Antonio Scandurra
d721c2ba4b Remove redundant code path in Patch::compose 2021-11-12 17:24:25 +01:00
Antonio Scandurra
3f11b8af56 Maintain row edits since last sync in WrapMap 2021-11-12 17:05:49 +01:00
Antonio Scandurra
4e32fabfdc Add text manipulation facilities to Rope for test purposes 2021-11-12 17:02:51 +01:00
Antonio Scandurra
fe786f3366 Init env_logger in the editor crate for tests only 2021-11-12 17:01:57 +01:00
Antonio Scandurra
b9c459e800 Use log::info instead of println in patch randomized tests 2021-11-12 17:00:44 +01:00
Antonio Scandurra
b2aab0c773 🎨 2021-11-12 16:31:01 +01:00
Antonio Scandurra
f49c9db423 Make Patch::compose work 2021-11-12 15:07:28 +01:00
Antonio Scandurra
6e882bcd02 Avoid composing edits together for now 2021-11-12 09:01:15 +01:00
Nathan Sobo
068aa1adb3 WIP 2021-11-12 00:20:39 -07:00
Nathan Sobo
47ad9baebc wip 2021-11-12 00:03:47 -07:00
Nathan Sobo
84d789b8ac WIP 2021-11-11 23:28:45 -07:00
Max Brunsfeld
0159019850 Simplify assertions in randomized patch test, fix some patch bugs 2021-11-11 18:28:07 -08:00
Max Brunsfeld
1f2eb9ddbc Add patch unit tests, get composition working for ops <= 3
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-11 17:36:30 -08:00
Antonio Scandurra
d75f415b25 WIP 2021-11-11 19:49:01 +01:00
Antonio Scandurra
4fecab6d4b WIP 2021-11-11 19:42:55 +01:00
Antonio Scandurra
e0897cd019 WIP 2021-11-11 18:13:35 +01:00
Antonio Scandurra
a939535d95 WIP
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-11 16:52:14 +01:00
Antonio Scandurra
59bbe43a46 WIP
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-11 16:00:52 +01:00
Antonio Scandurra
b2caf9e905 WIP: Start on BlockMap
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-11 15:04:39 +01:00
Antonio Scandurra
7dcf30c954 WIP 2021-11-11 15:04:31 +01:00
Nathan Sobo
118f137f18 WIP: Rework injection map to be focused solely on block injections 2021-11-10 20:49:06 -07:00
Nathan Sobo
0fff7d9166 WIP: Probably the wrong direction 2021-11-10 17:44:56 -07:00
Nathan Sobo
62ec105bff WIP 2021-11-10 14:00:51 -07:00
Antonio Scandurra
941d935c4a End pending selection when starting a transaction
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-03 19:15:54 +01:00
Antonio Scandurra
c07d794249 Avoid ending the pending selection until updating selections
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-03 19:07:06 +01:00
Antonio Scandurra
9dc3c74260 Make resolving selections generic
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-03 17:51:57 +01:00
Antonio Scandurra
a26b066788 Introduce a status bar and add the cursor position to it
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-03 17:27:51 +01:00
Antonio Scandurra
258b89bb70 Request autoscroll when undoing/redoing 2021-11-03 09:44:23 +01:00
Antonio Scandurra
6e5ec2a00d Take a &clock::Global instead of cloning in edits_since 2021-11-01 10:48:20 +01:00
Antonio Scandurra
6212ebad9b Communicate with language servers in terms of UTF-16 coordinates
This required indexing UTF-16 positions in `Rope`. We tried opting
into the UTF-8 experimental support but it didn't seem to work
correctly and the standard is UTF-16 anyway.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-29 18:33:23 +02:00
Max Brunsfeld
e1556893f7 Merge branch 'anchor-map-selections' into lsp 2021-10-28 17:08:06 -07:00
Max Brunsfeld
a1e576343e Rename AnchorRangeSet::to_point_ranges -> point_ranges 2021-10-28 16:32:49 -07:00
Max Brunsfeld
efc85d1b75 Get the Editor crate compiling 2021-10-28 15:42:24 -07:00
Antonio Scandurra
9c74be3bf2 Start fixing compilation errors on Editor
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-10-28 19:36:43 +02:00
Antonio Scandurra
bc076c1cc1 Update display map snapshots when diagnostics are updated
This is similar to what we do when we receive new parse trees from
tree-sitter.
2021-10-27 12:42:16 +02:00
Max Brunsfeld
c539069cbb Include diagnostic info in HighlightedChunks iterator
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-26 17:57:50 -07:00
Max Brunsfeld
5bfbeb55c0 Simplify buffer constructor methods
Don't expose the `buffer::History` to callers of `language::Buffer`
2021-10-26 14:26:47 -07:00
Max Brunsfeld
4069db4959 Allow underlines to have different color than the text
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-26 12:46:46 -07:00
Antonio Scandurra
0674e76864 WIP 2021-10-26 19:42:40 +02:00
Antonio Scandurra
e8a2885721 Introduce Content::anchor_range_multimap 2021-10-26 14:28:02 +02:00
Max Brunsfeld
37eae2ba67 Remove unnecessary dependencies in buffer and language crates 2021-10-21 09:40:50 +02:00
Max Brunsfeld
81a85e9c79 Extract a language crate 2021-10-20 22:51:40 +02:00
Max Brunsfeld
cdb268e656 Re-enable randomized concurrent edits test 2021-10-20 21:44:26 +02:00
Max Brunsfeld
30e2e2014d Extract a TextBuffer from Buffer, which has no tree or file
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-20 00:10:57 +02:00
Nathan Sobo
5558d553bb Insert an extra newline between brackets
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-10-19 13:17:16 +02:00
Nathan Sobo
b4680144c5 Unconditionally preserve indentation when inserting newlines
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-10-08 10:25:00 -06:00
Max Brunsfeld
451f0e7adb Replace Buffer::request_autoindent API with ::edit_with_autoindent
When computing the "previous autoindent suggestion", we can't just
use the old tree and the current text. We need to find out what the
suggestion would have been before we made any changes.
2021-10-07 17:55:23 -07:00
Antonio Scandurra
2018537bb8 Introduce a Tab action to indent line or insert soft tabs
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-07 17:31:58 +02:00
Max Brunsfeld
b83b4ad7c7 Start work on a Buffer API for requesting autoindent on the next parse
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-06 16:09:30 -07:00
Antonio Scandurra
724272931a Skip autoclosed pairs
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-10-06 19:04:55 +02:00
Antonio Scandurra
05d7e9c4e7 Start on autoclosing pairs
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-06 16:34:57 +02:00
Max Brunsfeld
3cb7ba0f57 Make the fields of buffer::Language private 2021-10-05 14:19:33 -07:00
Antonio Scandurra
f70e3878b6 Flip the dependency between editor and theme
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-10-05 19:21:13 +02:00
Antonio Scandurra
9c7ef39da6 Minimize code generation for synchronous gpui::test macro
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-05 17:47:46 +02:00
Antonio Scandurra
499616d769 Move workspace module into its own crate 2021-10-05 13:49:10 +02:00
Antonio Scandurra
36594ecf1d Use edition = 2018 instead of 2021 for the editor crate 2021-10-05 10:16:13 +02:00
Max Brunsfeld
94209d2b6d Rename rpc_client -> client
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-04 17:14:21 -07:00
Max Brunsfeld
75cf2488db List path dependencies first in all Cargo.toml files
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-04 15:36:52 -07:00
Max Brunsfeld
1d97f08901 Move editor into its own crate
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-04 15:23:10 -07:00