Commit Graph
74 Commits
Author SHA1 Message Date
Max Brunsfeld 16c6400145 Rename context parameters to cx in fold_map.rs 2021-05-28 15:08:38 -07:00
Max BrunsfeldandNathan Sobo 139bcb8304 Rename foo/mod.rs files too foo.rs
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-28 14:41:58 -07:00
Max BrunsfeldandNathan Sobo 8b7a314474 Implement bracket matching using queries
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-28 13:09:57 -07:00
Antonio Scandurra 23d1d91414 Implement select_larger_syntax_node for buffer 2021-05-28 13:25:09 +02:00
Antonio Scandurra 07aeb32ef4 Punt on auto-indentation for now 2021-05-28 10:17:10 +02:00
Max BrunsfeldandNathan Sobo 7bea3fd2fe Start on a query-based autoindent system
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-26 17:23:53 -07:00
Antonio Scandurra 04c7989720 Extract a LanguageConfig and load it from language-dir/config.toml 2021-05-26 10:27:14 +02:00
Max BrunsfeldandNathan Sobo 5d2ac3f4e4 Use new Tree-sitter captures API
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-25 16:02:43 -07:00
Antonio Scandurra 43ddb6f640 WIP: Push failing test for DisplayMap::highlighted_chunks_at 2021-05-25 17:20:46 +02:00
Antonio Scandurra 2e7593dd79 💄 2021-05-25 14:20:53 +02:00
Antonio Scandurra aeb68867da Move highlighted_text_in_range from Buffer to buffer::Snapshot 2021-05-25 11:51:29 +02:00
Max Brunsfeld 8340958b33 Convert query capture indices to style ids
* Introduce a Theme struct as a new part of the app's settings
* Store on each Language a ThemeMap, which converts the capture ids
  from that language's highlight query into StyleIds, which identify
  styles in the current Theme.
* Update `highlighted_chunks` methods to provide StyleIds instead of
  capture ids.
2021-05-24 16:44:14 -07:00
Antonio Scandurra bc8d2b2f1d 💄 2021-05-24 17:14:17 +02:00
Antonio Scandurra d063ebdf9b Correctly store current chunk offset in fold_map::HighlightedChunks 2021-05-24 16:52:01 +02:00
Antonio Scandurra 4b8805bad2 Add DisplayMap::highlighted_chunks_at(row)
Note that this API doesn't take a DisplayPoint: it could but it
makes things a bit harder on the implementation side and we don't
really need it anyway, as text is laid out on a line-by-line basis
anyway.
2021-05-24 16:46:11 +02:00
Antonio Scandurra 4ddf10967e Introduce fold_map::HighlightedChunks 2021-05-24 15:39:22 +02:00
Antonio Scandurra 4ada5e0666 Rename rope::ChunksIter to rope::Chunks
This is consistent with how we name the other chunk iterators.
2021-05-24 15:05:11 +02:00
Antonio Scandurra 3a576f0b65 Don't clone visible_text for splicing edits into the parse tree 2021-05-22 12:34:35 +02:00
Max Brunsfeld 46e6b2cff4 Start maintaining a syntax tree on buffers 2021-05-22 12:34:35 +02:00
Antonio ScandurraandNathan Sobo b42f5142f7 Rename rightmost_{row,chars} to longest_{row,chars}
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-20 16:32:09 +02:00
Antonio Scandurra 6a0757ebf9 Don't store rightmost row/char-column as a Point 2021-05-20 12:52:58 +02:00
Antonio Scandurra ed57ffe5fa Replace rightmost_point with righmost_row 2021-05-20 12:47:08 +02:00
Antonio Scandurra 96538354b3 Express rightmost_point in terms of chars as opposed to bytes 2021-05-20 12:47:08 +02:00
Max Brunsfeld a2c36fcdb7 Fix bugs and add tests for move_{up,down} 2021-05-20 12:47:08 +02:00
Max BrunsfeldandAntonio Scandurra 510f20411a Get cursor movement working with byte columns
Introduce `clip_point` and `clip_offset` methods on `Rope`, `Buffer`, and `FoldMap`.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-05-20 12:47:08 +02:00
Max Brunsfeld f3db0dcff6 Start work on making row/columnwise movement work w/ byte columns 2021-05-20 12:47:08 +02:00
Max BrunsfeldandNathan Sobo 6621b9b552 Expand tabs correctly with multibyte characters
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-20 12:47:08 +02:00
Max Brunsfeld c62a679e12 Use chunk-wise DisplayMap iteration when laying out lines 2021-05-20 12:47:08 +02:00
Max Brunsfeld a9583d0074 Introduce FoldMapSnapshot::chunks_at, use it in FoldMap::text
Get the FoldMap randomized tests passing. This also required adding
a test-only FoldMap::prev_char_boundary method.
2021-05-20 12:47:08 +02:00
Max Brunsfeld b3d2a70834 Don't return Results from position methods in FoldMap and DisplayMap 2021-05-20 12:47:08 +02:00
Max Brunsfeld 72b98ad688 Get buffer tests passing after switching to byte coordinates 2021-05-20 12:47:08 +02:00
Max Brunsfeld e860cacb9f Get randomized tests passing in the presence of multibyte chars 2021-05-14 17:45:16 -07:00
Antonio ScandurraandNathan Sobo 2cdf315d95 WIP: Replace ropey with our own Rope
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-14 18:30:47 +02:00
Max BrunsfeldandNathan Sobo 9aeb35bfab Get tests passing using a slow rightmost_point impl
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-13 11:54:29 -07:00
Antonio ScandurraandMax Brunsfeld 7b98fb33dd WIP: Get the type checker passing...
...but not the borrow checker!

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-05-13 19:24:03 +02:00
Antonio ScandurraandNathan Sobo 0e9441e5cd WIP
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-13 18:35:48 +02:00
Antonio Scandurra 1c2b381f74 Use gpui::test macro for synchronous tests in zed 2021-05-12 17:18:23 +02:00
Max Brunsfeld e32b6bc8f8 Merge branch 'master' into new-file 2021-05-07 10:10:20 -07:00
Antonio Scandurra 1c2f549c82 Don't report folds that touch the endpoints of the given range
Fold ranges are exclusive, exactly like the query ranges. So if the end
of a fold coincides with the start of the query range, we shouldn't
report that fold. Analogously, if the start of a fold coincides with the
end of the query range, that fold shouldn't be reported.
2021-05-07 14:30:40 +02:00
Antonio Scandurra 6a2fe38d94 Verify FoldMap::unfold in randomized test 2021-05-07 09:39:55 +02:00
Antonio ScandurraandNathan Sobo 6890a3d9fa Batch fold insertion
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-06 19:50:51 +02:00
Antonio ScandurraandNathan Sobo 2c1e4cae19 Merge FoldRange into Fold
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-06 19:36:19 +02:00
Antonio ScandurraandNathan Sobo e8179f7e3e Always provide a context to sum tree's methods
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-06 19:29:38 +02:00
Antonio ScandurraandNathan Sobo 65e92ac2f2 Ignore empty folds in FoldMap::fold
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-06 18:53:09 +02:00
Antonio Scandurra 178705f8f9 Add FoldMap::folds_in_range to randomized test and fix issues it found 2021-05-06 18:49:41 +02:00
Max Brunsfeld 490fb485fd Merge branch 'master' into new-file 2021-05-06 09:19:16 -07:00
Antonio Scandurra 652fc9e4ec Remove add_summary_with_ctx and always require a ctx in add_summary 2021-05-06 16:57:47 +02:00
Antonio Scandurra 901525bf77 Implement FoldMap's folds using a SumTree
This required passing a `Context` object to `Summary` and introducing a
new `SeekDimension` trait that allows comparing two dimensions and pass
an additional context object.
2021-05-06 16:20:23 +02:00
Antonio Scandurra 7fb7a6adfc Add a Summary trait in preparation of passing a context struct 2021-05-06 09:32:14 +02:00
Max Brunsfeld bf28aba1a7 Restore Buffer::file field and workspace::Item trait 2021-05-05 18:08:18 -07:00