Commit Graph
265 Commits
Author SHA1 Message Date
Antonio Scandurra 79568c471a 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
Nathan Sobo 08409a57ed Allow a new search to be created with cmd-enter
This replaces the `cmd-alt-shift-F` binding to open a new search. Instead, you can preserve the existing search results by entering a query and then hitting `cmd-enter` instead of `enter`. This opens a new project find view and restores the previous view to whatever query it was previously displaying. It's a bit strange, but I don't want to rely on splitting as the only way of creating multiple sets of search results.
2022-02-26 13:23:05 -07:00
Antonio Scandurra f2d7451ca2 Use Project::search in ProjectFind and show search results 2022-02-25 10:32:45 +01:00
Antonio Scandurra 919a280fab Pass an AsyncAppContext to fake language server request handlers 2022-02-23 16:14:36 +01:00
b43945d6c6 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
Antonio ScandurraandNathan Sobo 447cc969f1 Don't serialize the full LSP symbol when collaborating
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-22 18:08:43 +01:00
Antonio Scandurra 0fc1d67784 Rename CompletionLabel to CodeLabel and add Project::symbols
This only works locally for now and we haven't implemented the
`RustLsp::label_for_symbol` method yet.
2022-02-22 10:01:08 +01:00
Nathan Sobo 6ce19ad1a2 Log an error instead of panicking when there's no LSP download dir 2022-02-21 17:44:00 -07:00
Max BrunsfeldandNathan Sobo bdb3c462f4 Assign language server download directory on startup
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-21 16:23:38 -08:00
Max BrunsfeldandNathan Sobo 79a0d152a3 Show more information in lsp status bar item
* Distinguish between checking for updates and downloading
* Show dismissable error message when downloading failed and there
  is no cached server.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-21 16:11:51 -08:00
Max BrunsfeldandNathan Sobo c9a4d76f2d Download language servers on-demand
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-21 13:54:52 -08:00
Antonio ScandurraandNathan Sobo ec875ff474 Show message indicating when we're downloading language servers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-21 17:25:52 +01:00
Antonio Scandurra 5967d87885 Download rust-analyzer from GitHub 2022-02-21 16:15:54 +01:00
Antonio Scandurra 6a7a19039c Introduce LspPostProcessor::download_language_server 2022-02-21 09:46:18 +01:00
Antonio Scandurra ede6adbe76 Make language server initialization asynchronous 2022-02-21 09:39:28 +01:00
Antonio Scandurra 1980656679 Revert "WIP: avoid code-signing rust-analyzer to prevent proc macro errors"
This reverts commit a7160ed278.
2022-02-21 08:13:05 +01:00
Antonio Scandurra a7160ed278 WIP: avoid code-signing rust-analyzer to prevent proc macro errors
If this works, I think we should set the permissions asynchronously,
maybe as part of starting the language server, so that we avoid doing
synchronous I/O.
2022-02-20 12:14:43 +01:00
Antonio Scandurra c0d1e77c21 Fix warnings 2022-02-17 17:26:03 +01:00
Antonio Scandurra fac5959ac2 Wait for version before returning completions 2022-02-17 11:41:19 +01:00
Max BrunsfeldandNathan Sobo 258542b74a Remove unnecessary waiting when handling save RPC requests
Add saving to the randomized integration test

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 17:47:21 -08:00
Max BrunsfeldandNathan Sobo 529e18978e Remove unnecessary waiting during completion RPC requests
Also, add completion requests to the randomized collaboration integration test,
to demonstrate that this is valid.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 17:23:16 -08:00
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