Commit Graph
39175 Commits
Author SHA1 Message Date
Antonio Scandurra 21ebc7e859 WIP 2021-10-21 19:27:10 +02:00
f6b1cc5830 Start on integrating rust-analyzer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-10-21 16:26:37 +02:00
Max Brunsfeld c85de841c9 Merge pull request #213 from zed-industries/language-buffer
Extract Buffer's language-aware behavior into a new `language` crate
2021-10-21 13:22:04 +02:00
6d8aa9f7d8 Assign new file handles on buffers when their files change on disk
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-21 13:08:54 +02:00
8d2d3c0750 Update buffer's saved mtime when file is reloaded after on-disk change
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-21 12:05:44 +02:00
Max Brunsfeld 7a3a9575e2 Rename TextBuffer back to Buffer 2021-10-21 11:12:19 +02:00
Max Brunsfeld 3f96f0aa6f Remove unnecessary dependencies in buffer and language crates 2021-10-21 09:40:50 +02:00
Max Brunsfeld 34cda9fe9b Extract a language crate 2021-10-20 22:51:40 +02:00
Max Brunsfeld a0d4443c38 Re-enable randomized concurrent edits test 2021-10-20 21:44:26 +02:00
b84f5e3940 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 7e90519ffc Merge pull request #205 from zed-industries/autoindent
Autoindent
2021-10-19 14:23:04 +02:00
230307ce59 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
Nate Butler 0192dea583 Make light collab cursor not yellow for Nathan ;) 2021-10-17 18:28:05 +02:00
Nathan Sobo 1a48b3e5e6 Restore all active selections when undoing/redoing autoindent
In the unlikely event that we're handling autoindent requests from multiple editors, we undo/redo selections from both editors. This is somewhat imperfect but probably good enough and easier than performing auto-indents on a per-editor basis.
2021-10-11 17:22:18 -06:00
Max Brunsfeld 1d24ca172f Move selections explicitly when applying autoindents 2021-10-11 15:27:38 -07:00
Max Brunsfeld 83db3ac840 Add unit tests for selective indentation adjustment 2021-10-11 13:02:01 -07:00
Max Brunsfeld 991d42724a Move buffer tests into their own file 2021-10-11 12:18:31 -07:00
Max BrunsfeldandNathan Sobo 71ed81bc93 Ensure that autoindent task yields frequently to respect cancellation
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-11 11:25:15 -07:00
Antonio ScandurraandNathan Sobo f8188c8519 WIP: Determine autoindents asynchronously
We still need to insert yield points in `compute_autoindents`.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-11 18:00:48 +02:00
Antonio Scandurra 864ebc7c31 Fix creation of anchors for the inserted portion of an edit 2021-10-11 13:08:50 +02:00
Antonio Scandurra 6471d88238 Always use seek_forward when resolving anchors 2021-10-11 09:37:21 +02:00
Nathan Sobo a4223aab87 Improve auto-indenting of inserted lines
Still not working totally correctly with our new approach, but getting closer.
2021-10-08 22:07:01 -06:00
Max BrunsfeldandNathan Sobo 149fc28019 Start on new way of comparing old and new indent suggestions
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-08 16:54:27 -07:00
Nathan SoboandAntonio Scandurra b72f13af66 Extend Rust where clauses past their final newline for indentation
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-10-08 10:32:15 -06:00
Nathan SoboandAntonio Scandurra 5b09707cb0 Don't request auto-indent if there is no language assigned on the buffer
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-10-08 10:25:16 -06:00
Nathan SoboandAntonio Scandurra e9bcc7779d Unconditionally preserve indentation when inserting newlines
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-10-08 10:25:00 -06:00
Antonio ScandurraandNathan Sobo 4c6c4d5750 💄
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-08 17:43:19 +02:00
Antonio Scandurra db8cac6536 Cancel out outdents and indents referring to the previous row 2021-10-08 12:52:48 +02:00
Antonio Scandurra 66a833c337 Bias the start of an autoindent request towards the right for new text
When a newline is inserted, this prevents the request from including
the line on which the newline got inserted.
2021-10-08 12:15:21 +02:00
Max Brunsfeld 470fa86a60 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
Max BrunsfeldandNathan Sobo 0053182229 Preserve indentation for lines that are both indented and outdented
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-07 13:55:59 -07:00
Max Brunsfeld bc1a6ff075 Remove no-longer-used dirty field on buffer::SyntaxTree
This became unnecessary when we reworked our reparsing logic
to block from 1ms on each parse.
2021-10-07 12:46:08 -07:00
Max Brunsfeld 8bb2a5f35a Fix collection of row ranges in Buffer::perform_autoindent 2021-10-07 12:43:26 -07:00
Max BrunsfeldandAntonio Scandurra 3202d11680 Implement selective auto-indent by comparing old and new suggestions
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-10-07 10:46:40 -07:00
Antonio ScandurraandMax Brunsfeld f1aa471d38 WIP
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-10-07 19:09:14 +02:00
Antonio ScandurraandNathan Sobo 0d6f728b81 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
Antonio ScandurraandNathan Sobo b4337b0c2f Don't push empty transactions onto the undo stack
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-07 16:06:55 +02:00
Max Brunsfeld a21a1b483b Add more rust indent nodes 2021-10-06 22:16:30 -07:00
Max Brunsfeld 9a954bc1d6 Generalize strategy for processing indentation ranges
* Take into account the ranges' start and end columns, not just the rows
* Generalize the approach to dedenting
2021-10-06 22:16:18 -07:00
Max BrunsfeldandNathan Sobo 4525cbc448 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
Max Brunsfeld aeb6d79ecf Merge pull request #203 from zed-industries/autoclose-pairs
Autoclose pairs
2021-10-06 11:17:41 -07:00
10f07a81a7 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 ScandurraandNathan Sobo 0acdd804f8 Start on autoclosing pairs
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-06 16:34:57 +02:00
Max Brunsfeld 22eeeb4690 Make the fields of buffer::Language private 2021-10-05 14:19:33 -07:00
Max Brunsfeld 5c8d1d1fb6 Add Cargo.toml features to fix compilation of individual crates 2021-10-05 14:18:04 -07:00
Max Brunsfeld a9a32bcb23 Merge pull request #202 from zed-industries/crates
Break project into crates to improve incremental compilation time
2021-10-05 10:54:15 -07:00
Max Brunsfeld 9232abbaf4 Fix path to zed crate in script/bundle 2021-10-05 10:46:59 -07:00
14e9b03c52 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 f3583120de Use the same test::run_test function for async gpui::tests 2021-10-05 18:04:22 +02:00
Antonio ScandurraandNathan Sobo 5aeb48a234 Minimize code generation for synchronous gpui::test macro
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-05 17:47:46 +02:00