Commit Graph
1594 Commits
Author SHA1 Message Date
Max BrunsfeldandNathan Sobo 90e4622ec7 Allow multiple fake language servers to be started for a given project
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 16:10:36 -08:00
Max BrunsfeldandNathan Sobo f508b135e1 Include the desired version in a SaveBuffer RPC request
When handling this messages on the host, wait until the desired
version has been observed before performing the save.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-14 17:51:26 -08:00
Antonio Scandurra 22800b4f88 Use selection instead of just the cursor when fetching code actions 2022-02-14 14:13:36 +01:00
Antonio Scandurra 4e8b470bc6 Remove stray log statements 2022-02-12 12:32:57 +01:00
Max Brunsfeld 66ce2519e7 Remove Buffer::apply_lsp_edits
Always use `edits_from_lsp`.
2022-02-11 16:22:19 -08:00
Antonio Scandurra e035758ba9 Move Buffer::format to Project::format 2022-02-11 12:07:46 +01:00
Max Brunsfeld 78e10785b0 Finish implementing Buffer::edits_from_lsp 2022-02-10 18:01:18 -08:00
Max BrunsfeldandAntonio Scandurra 11f6061fbb Start work on applying LSP edits via a diff
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-10 11:14:06 -08:00
Nathan SoboandAntonio Scandurra e8ed237265 Undo subsequent edits when undoing in multi-buffer
When undoing in the multi-buffer, don't preserve edits that occurred outside the multi-buffer after the edit being undone.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-10 09:04:53 -07:00
Antonio Scandurra 92e91cbf1f WIP: Make editor crate compile again
Tests are still failing though.
2022-02-09 11:09:11 +01:00
Max Brunsfeld a0aeddfc57 Fix unused import warnings 2022-02-08 16:27:33 -08:00
Max BrunsfeldandNathan Sobo c477ca9308 Give the editor a handle to the project, not a weak handle to the workspace
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-08 15:48:44 -08:00
Max Brunsfeld 08061504d4 Consolidate logic for completion alongside code actions in Project
This way, completions are dealt with more consistently with code actions,
and the logic is not spread across so many places. The `language::File`
trait and the multibuffer no longer need to deal with completions. Completions
are no longer generic over an anchor type.
2022-02-08 14:24:45 -08:00
Max Brunsfeld e3e21f9b4c Consolidate all code actions logic into Project 2022-02-08 13:17:57 -08:00
Max Brunsfeld 1e18742c9d Merge branch 'main' into assists 2022-02-08 12:41:57 -08:00
Max Brunsfeld 3e32be935b Apply lsp edits in reverse order
This fixes the handling of multiple edits on the same line.
2022-02-08 12:41:30 -08:00
Antonio Scandurra 3cef9bd440 Set file in test_diagnostics to excercise language server 2022-02-08 20:09:53 +01:00
Antonio ScandurraandNathan Sobo 9e40fdc3fc Make transactions serializable to enable edits on behalf of other users
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-08 19:48:21 +01:00
Antonio Scandurra cf043af1ff Serialize buffer in terms of operations rather than state
This is required because, after joining, we want to be able to refer
to operations that have happened prior to joining, which are not
captured by the state. There is probably a way of reconstructing operations
from the state, but that seems unnecessary and we've already talked about
wanting to have the server store operations rather than state once we start
persisting worktrees.
2022-02-08 14:59:46 +01:00
Antonio Scandurra 943fb46052 Apply code actions remotely 2022-02-08 12:18:14 +01:00
Antonio Scandurra caa286888f Send DidCloseTextDocument when dropping buffer
Closes https://github.com/zed-industries/zed/issues/434
2022-02-08 10:02:26 +01:00
Max BrunsfeldandNathan Sobo 656fee96e6 Use a pool of databases to speed up integration tests
Also, use env_logger consistently in the tests for each crate.
Only initiallize the logger at all if some RUST_LOG env var is set.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 15:00:00 -08:00
Antonio Scandurra fa0c1d7923 Apply edits received from LSP code actions and open all touched buffers 2022-02-07 18:48:45 +01:00
Antonio ScandurraandNathan Sobo 4544cf7b81 Tolerate language servers reporting non-monotonic buffer versions
This isn't perfect but we'll retain up to 10 old versions just in case there
are race conditions in the language server. We haven't seen this in the wild
but we're concerned about diagnostic reporting racing with code action
resolution.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 16:29:05 +01:00
Antonio Scandurra 1ae79902e9 WIP: Start on applying code actions 2022-02-07 12:20:03 +01:00
Nathan Sobo 71f21f608e Move rendering and select prev/next into ContextMenu enum
This prepares the way to have a code actions context menu.
2022-02-05 10:19:43 -07:00
Max BrunsfeldandNathan Sobo c0e51a467e Start work on code actions
Just print out the returned code actions for now

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-04 17:45:00 -08:00
Max BrunsfeldandNathan Sobo e47c404bdd Add a ToPointUtf16 trait in text and multibuffer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-04 17:35:37 -08:00
Max BrunsfeldandNathan Sobo 3f48573245 Adjust assertion to reflect rust grammar upgrade
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-04 13:31:41 -08:00
Max BrunsfeldandAntonio Scandurra 0c57fd75be Refine behavior of select_larger_syntax_node
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2022-02-04 13:19:00 -08:00
Max Brunsfeld e4e708a8bc Add integration test for getting and resolving completions 2022-02-03 15:24:16 -08:00
Antonio Scandurra 6293058b27 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
Antonio Scandurra fcd9cfde27 Syntax highlight even when the label doesn't contain a detail 2022-02-03 09:57:04 +01:00
Max Brunsfeld 8d1a1c61dd Start work on syntax highlighting completions 2022-02-02 18:14:30 -08:00
Max Brunsfeld 0c273d6603 Fix hang in editor completion unit test 2022-02-02 17:09:36 -08:00
Max Brunsfeld 17cb388fe2 Introduce Language::highlight_text method 2022-02-02 17:01:48 -08:00
Max Brunsfeld 90404114e3 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
0b7628d3c9 Improve formatting of function autocompletion labels in Rust
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-02 18:43:55 +01:00
Antonio ScandurraandNathan Sobo 70a6a78b15 Don't apply completion's edit when it wouldn't change the buffer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-02 18:00:30 +01:00
Antonio Scandurra b221c19b8e Wait for additional edits before pushing transaction in remote buffer 2022-02-02 17:01:23 +01:00
Antonio Scandurra b75f0e3ff3 Apply additional edits for completion when the buffer is remote 2022-02-02 16:29:13 +01:00
Antonio Scandurra a68c127491 Broadcast completion triggers to remote participants 2022-02-02 14:07:41 +01:00
Antonio Scandurra 76884e3b0f Start on requesting completions for remote buffers 2022-02-02 12:22:47 +01:00
Max Brunsfeld 067eb8740c Start work on handling snippet completions 2022-02-01 15:35:02 -08:00
Max Brunsfeld 0323952bfb 🎨 Return an option task from confirm_completion 2022-02-01 14:27:01 -08:00
Antonio ScandurraandNathan Sobo e354b91d22 Apply additional edits when confirming a completion
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-01 17:38:11 +01:00
Antonio ScandurraandNathan Sobo f6b3a840a4 Fix warnings in language::FakeFile
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-01 16:59:03 +01:00
Antonio ScandurraandNathan Sobo e150081fa1 Filter and sort suggestions in autocomplete
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-01 15:11:20 +01:00
Nathan Sobo 3897447af2 Make the anchor range inclusive on completions
This will help us to correctly interpolate the replacement range when we confirm before receiving new completions after typing with a completion open.
2022-01-31 18:26:26 -07:00
Max BrunsfeldandNathan Sobo 267b719dbc Trigger completion when typing words or trigger characters
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 17:07:24 -08:00