Commit Graph
94 Commits
Author SHA1 Message Date
Antonio ScandurraandNathan Sobo 45ecd8e0a6 Always use square brackets in marked_text_ranges
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-28 17:11:35 +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 1a29180185 Fixed issue with enabling and disabling vim mode dynamically
Also added indoc and marked text utility to vim tests to improve readability
2022-03-25 20:10:52 -07:00
Keith SimmonsandNathan Sobo 0aaf270650 Add clip_to_line_end to display_map/snapshot and set it to ensure vim positioning in normal mode
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-25 20:10:52 -07:00
Nathan Sobo 2c232d585a Merge branch 'main' into unfold-on-select-match 2022-03-24 14:13:27 -06:00
ab631cf6c3 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
Antonio Scandurra 4f50da759a Allow customizing whether FoldMap::unfold treats ranges as inclusive 2022-03-24 17:14:41 +01:00
Max BrunsfeldandKeith Simmons ff4bdb3114 Fix incorrect highlighting when an empty range is highlighted via the DisplayMap
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-23 18:20:55 -07:00
Keith Simmons df751867a1 Remove results from movement function return values, and move editor test utilities to test file 2022-03-22 10:55:03 -07:00
Nathan Sobo f70f4c7729 Improve DisplayPoint Debug impl 2022-03-21 21:07:56 -06:00
Antonio Scandurra fbf7cdf4f2 Make all HighlightStyle properties optional
Previously, some of those properties such the font weight, style and color
would be mandatory: when the theme didn't specify them, Zed would use a default
value during deserialization. This meant that those default properties would
unconditionally override the base text style, causing a rendering bug when
combining syntax highlights with diagnostic styles.

This commit fixes that by making `HighlightStyle`s more additive: each property
can be set independently and only the properties that theme specifies get
overridden in the base text style.
2022-03-15 10:39:43 +01:00
Nathan Sobo c35a96c425 On rename, replace background highlights with transparent text highlights 2022-03-11 15:54:17 -07:00
Nathan Sobo 951fd1ab36 Merge branch 'main' into select-on-rename 2022-03-11 15:30:07 -07:00
Nathan Sobo e6b1fea117 WIP 2022-03-10 11:32:14 -07:00
Nathan Sobo ac1eb19f83 Start on text highlight support 2022-03-09 20:51:35 -07:00
Nathan Sobo 49e38e6e00 Eliminate ToFoldPoint trait
Just make it a method on FoldMap
2022-03-09 20:49:18 -07:00
Antonio Scandurra 466db69780 Pass a reference to TestAppContext in tests
This allows us to drop the context *after* we ran all futures to
completion and that's crucial otherwise we'll never drop entities
and/or flush effects.
2022-03-01 12:01:02 +01:00
64098247cb Allow languages to be registered at any time
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-22 10:35:20 -08:00
Max Brunsfeld 5b4c0d64bc Get tests passing and project diagnostics view working w/ new excerpt headers 2022-02-09 13:51:52 -08:00
Antonio Scandurra 0e1318dfe4 WIP: Make editor crate compile again
Tests are still failing though.
2022-02-09 11:09:11 +01:00
Antonio Scandurra ab26a175a4 Opt into language-aware features when getting buffer chunks
We use chunks a lot to transform points and sync the various display maps,
and always querying tree-sitter or the LSP diagnostics in those cases is
unnecessarily expensive.
2022-02-03 11:21:30 +01:00
Max Brunsfeld 88adddb324 Remove theme parameters from buffer/display map's chunks methods
Change Chunks to contain highlight ids instead of actual highlight
styles. Retrieve the actual highlight style from the theme in the
editor element layer.

This is to set us up to perform syntax highlighting in other code
paths where the theme is not available.
2022-02-02 16:33:04 -08:00
Max Brunsfeld f43dcd6763 Move logic for starting language servers to the project 2022-01-19 14:05:06 -08:00
Antonio Scandurra 0742640b39 Correctly report line boundaries when a map contains both folds and wraps
This fixes the randomized test failures that were occurring on main.
2022-01-10 11:26:48 +01:00
Nathan SoboandAntonio Scandurra d7a78e14ac Allow disk-based diagnostic progress begin/end events to interleave
When multiple saves occur, we can have multiple start events followed by multiple end events. We don't want to update our project diagnostics view until all pending progress is finished.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-06 09:32:08 -07:00
Nathan Sobo 6d6a82655a Create blocks with anchors to allow a bias to be specified
This allows us to respect the bias on anchors we use to create excerpt headers so that they always remain above any content inserted at the start of an excerpt.
2021-12-30 01:03:19 -08:00
Max Brunsfeld 137fbd0088 Update editor element to use new {next,prev}_line_boundary methods
Since these methods take buffer points instead of display points, this adjusts
the logic for retrieving the visible selections, so that they are initially returned
in terms of buffer points.
2021-12-28 13:47:09 -08:00
Nathan Sobo 7f786ca8a6 WIP: Start moving toward a simpler interface for detecting prev/next line boundaries 2021-12-27 22:11:05 -08:00
Nathan Sobo 89bbfb8154 wip 2021-12-27 21:14:23 -08:00
Nathan Sobo 835af35839 Simplify prev/next_row_boundary methods
We added clipping of points against the buffer when excerpt headers were in the buffer, but now that they're just blocks, I think we can avoid the potential to panic in these methods by going back to not clipping.
2021-12-27 15:46:19 -08:00
Max Brunsfeld a86ba57983 Add Editor::remove_blocks 2021-12-22 17:30:14 -08:00
Max Brunsfeld 13ecd16685 Index max buffer row on MultiBuffer 2021-12-21 12:36:46 -08:00
Antonio Scandurra 91c786a8db WIP: Insert blocks in BlockMap for MultiBuffer headers 2021-12-21 17:38:03 +01:00
Antonio Scandurra 8534a9cc41 Don't insert headers in MultiBuffer
This lays the groundwork to insert headers in the block map instead.
2021-12-21 16:38:18 +01:00
Max BrunsfeldandAntonio Scandurra 80f3173fbd Always panic if invalid point is passed to {prev,next}_row_boundary
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2021-12-16 10:23:45 -08:00
Antonio Scandurra 7660159164 Test blocks in display map randomized tests
This highlighted some errors in the implementation.
2021-12-16 16:15:14 +01:00
Antonio Scandurra abf96e6ad6 Fix movement tests in DisplayMap 2021-12-16 12:36:27 +01:00
Antonio Scandurra ec39c9d335 Allow specifying MAX_EXCERPTS via an env variable in random tests 2021-12-16 12:28:54 +01:00
Max BrunsfeldandNathan Sobo 3e2f684545 Fix prev_row_boundary when a wrap follows a fold
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 18:30:09 -08:00
Max Brunsfeld f4115ddc3c 🎨 point_to_display_point & display_point_to_point 2021-12-15 15:45:02 -08:00
Max Brunsfeld 368b4447ff Clip buffer points in DisplayMap::{prev,next}_row_boundary 2021-12-15 15:41:38 -08:00
80abd84050 Create MultiBuffers with more than one fragment in more randomized tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-12-15 18:38:37 +01:00
Nathan SoboandMax Brunsfeld 6c5b27af1d Group diagnostics by primary
Render primary message above the excerpt and supporting messages as block decorations with a `Below` disposition. This is still super rough.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-14 18:26:42 -07:00
Nathan SoboandMax Brunsfeld e1a2897d53 Render basic diagnostic messages in project diagnostics view
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-14 17:00:57 -07:00
Nathan Sobo c8b43e3078 Move multi_buffer to editor crate 2021-12-10 17:37:53 -07:00
Max Brunsfeld a758bd4f8d Fill in some missing methods on MultiBuffer, MultiBufferSnapshot 2021-12-10 14:27:04 -08:00
Antonio ScandurraandNathan Sobo 7524974f19 Get everything compiling again
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-10 17:15:16 +01:00
Nathan SoboandMax Brunsfeld 87d16c271e Get Editor compiling with MultiBuffer as its buffer
There's a bunch of unimplemented methods in MultiBuffer, but everything compiles.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-08 19:23:04 -07:00
Max Brunsfeld fa379885f1 Give more specific names to all snapshot and text iterator types 2021-12-08 09:24:00 -08:00
Nathan Sobo 811696670a Start on a new FragmentList
Here I'm exploring a new approach to the project-wide diagnostics view that can exactly mirror the contents of cargo check. The `FragmentList` composes an arbitrary list of fragments from other buffers and presents them as if they were a single buffer.
2021-12-04 06:57:56 -07:00