Commit graph

1794 commits

Author SHA1 Message Date
Antonio Scandurra
60abc5f090 Take ToOffset instead of anchors in intersecting_point_ranges
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-26 17:04:12 +02:00
Antonio Scandurra
e8a2885721 Introduce Content::anchor_range_multimap 2021-10-26 14:28:02 +02:00
Antonio Scandurra
5dc47c625e Fix compilation errors 2021-10-26 14:27:00 +02:00
Max Brunsfeld
64445c7d1c Start work on AnchorRangeMultimap
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-25 21:42:55 -07:00
Max Brunsfeld
50c77daa0b Start work on a test for worktree handling LSP diagnostics 2021-10-25 21:42:55 -07:00
Max Brunsfeld
c3ff489fee Handle initialize request internally in fake lsp server
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-25 18:04:27 -07:00
Max Brunsfeld
6384950d56 Merge remote-tracking branch 'origin/main' into lsp 2021-10-25 16:24:08 -07:00
Max Brunsfeld
b49a268031 Add a fake lsp server
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-25 15:28:40 -07:00
Antonio Scandurra
2d6d10f920 Log unhandled notifications in LanguageServer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-10-25 19:46:33 +02:00
Antonio Scandurra
580bad2042 Get a basic end-to-end test for rust-analyzer integration working
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-10-25 18:11:52 +02:00
Antonio Scandurra
9759f9e947 Uncomment script/bundle lines
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-25 17:35:45 +02:00
Nathan Sobo
ab4f90a20a Get language and project compiling 2021-10-25 09:26:36 -06:00
Antonio Scandurra
7105589904 Don't send notifications or requests until LSP is initialized 2021-10-25 12:29:28 +02:00
Antonio Scandurra
59ed535cdf Implement a more robust way of locating rust-analyzer
When bundled, we will retrieve it out of the `Resources` folder.
Locally, we're expected to run `script/download-rust-analyzer` and
put `vendor/bin` in our $PATH.
2021-10-25 11:02:35 +02:00
Nathan Sobo
60a8e74430 Get buffer compiling with new SelectionSets based on AnchorRangeMap
One test is failing however.
2021-10-22 14:12:16 -06:00
Nathan Sobo
6ba4af3e26 WIP: Start converting SelectionSet to use AnchorRangeMap 2021-10-22 13:19:19 -06:00
Nathan Sobo
3ae5ba09fd Implement TryFrom<proto::SelectionSet> on SelectionSet
More prep work for changing the selection set representation.
2021-10-22 12:46:02 -06:00
Nathan Sobo
401bdf0ba1 Simplify protocol messages related to selection sets
This prepares the way to switch to using AnchorRangeMaps to store and transmit selection sets.
2021-10-22 12:35:29 -06:00
Nathan Sobo
087ff28d0d Move SelectionSet and Into impl to selection module 2021-10-22 09:56:47 +02:00
Antonio Scandurra
715faaaceb WIP 2021-10-21 19:27:10 +02:00
Antonio Scandurra
2c6aeaed7c 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
559774d6ac
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
Max Brunsfeld
282195b13e 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
Max Brunsfeld
eb9d7c8660 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
eea0f35d38 Rename TextBuffer back to Buffer 2021-10-21 11:12:19 +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
76774d6a3c
Merge pull request #205 from zed-industries/autoindent
Autoindent
2021-10-19 14:23:04 +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
Nate Butler
2286a94185 Make light collab cursor not yellow for Nathan ;) 2021-10-17 18:28:05 +02:00
Nathan Sobo
561857fdf2 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
47372e7342 Move selections explicitly when applying autoindents 2021-10-11 15:27:38 -07:00
Max Brunsfeld
63e775eb4c Add unit tests for selective indentation adjustment 2021-10-11 13:02:01 -07:00
Max Brunsfeld
6dc9d3ac19 Move buffer tests into their own file 2021-10-11 12:18:31 -07:00
Max Brunsfeld
53f1078119 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 Scandurra
28ffd750ce 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
7f5d454b2d Fix creation of anchors for the inserted portion of an edit 2021-10-11 13:08:50 +02:00
Antonio Scandurra
b43c78053b Always use seek_forward when resolving anchors 2021-10-11 09:37:21 +02:00
Nathan Sobo
6531df2368 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 Brunsfeld
e78a5642fa 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 Sobo
b85ae89b7e 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 Sobo
810315e04c 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 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
Antonio Scandurra
c60bc00c9e 💄
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-08 17:43:19 +02:00
Antonio Scandurra
f66b52239e Cancel out outdents and indents referring to the previous row 2021-10-08 12:52:48 +02:00
Antonio Scandurra
18e5d75fd3 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
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
Max Brunsfeld
c0a75abcd2 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