Commit Graph
312 Commits
Author SHA1 Message Date
Antonio Scandurra 7498e16311 Display language server name in status bar 2022-03-10 16:48:43 +01:00
Antonio Scandurra 180c7dabff Split language server initialization from construction
This gives clients a chance to register to notifications.
2022-03-09 12:31:21 +01:00
Max Brunsfeld bfc721db27 Assign buffer's completion triggers from LSP capabilities
Also, make LanguageServer::new() async. The future resolves
once the server is initialized.
2022-03-08 17:41:52 -08:00
Antonio Scandurra aa62426ee8 Support formatting in fake LSP capabilities 2022-03-04 11:24:18 +01:00
Max Brunsfeld ee589d9cf7 Avoid infinite loop when a language server fails to start 2022-03-03 18:13:38 -08:00
Max Brunsfeld 5072109d9d Make fake language servers have full capabilities 2022-03-03 15:42:29 -08:00
Max BrunsfeldandNathan Sobo 5868120184 Enable formatting feature of JSON language server
The feature doesn't work yet because the JSON language server
only supports *range* formatting, not document formatting.
We need to adjust our code to inspect the server's capabilities
and send range formatting requests instead when needed.

We're going to hold off on doing this right now, because it
will create merge conflicts with the `preserve-worktrees`
branch (#525)

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-03 14:16:58 -08:00
Max BrunsfeldandNathan Sobo b5800767f1 Add JSON language server
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-03 13:29:25 -08:00
Antonio Scandurra acb9d5158a Fix warnings 2022-03-02 12:45:49 +01:00
Max BrunsfeldandNathan Sobo 0b1ef30f94 Fix remaining language server hangs on shutdown
* Use fork of async-pipe library that handles closed pipes correctly.
* Clear response handlers map when terminating output task, so as
  to wake any pending request futures.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-01 15:54:59 -08:00
Max Brunsfeld 42166fbd55 Prevent hangs in lsp requests made while server is shutting down
* Avoid postage::oneshot, since receiver is not woken when sender is dropped.
* Clear the response channels when an IO task exits.
2022-03-01 13:36:49 -08:00
Max Brunsfeld 1f98014888 Clean up tasks properly when dropping a FakeLanguageServer
* Make sure the fake's IO tasks are stopped
* Ensure that the fake's stdout is closed, so that the corresponding language
  server's IO tasks are woken up and halted.
2022-03-01 13:26:59 -08:00
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
Max BrunsfeldandAntonio Scandurra 868e66f385 Eliminate RwLock around LanguageServer's outbound message channel
We observed a deadlock when quitting zed. The main thread was attempting
to acquire a write lock to this outbound message sender. We weren't able
to understand exactly how this occurred, but we removed the use of a
lock there, so this shouldn't happen anymore.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-02-25 10:04:57 -08:00
Antonio Scandurra 8ee20849d1 Fix warning 2022-02-24 09:52:25 +01:00
Antonio Scandurra 919a280fab Pass an AsyncAppContext to fake language server request handlers 2022-02-23 16:14:36 +01:00
Antonio Scandurra d30399e056 Remove unused method 2022-02-21 17:31:43 +01:00
Antonio ScandurraandNathan Sobo 6149e8c4cb Remove rust-analyzer smoke test
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-21 17:28:55 +01:00
Antonio Scandurra c0d1e77c21 Fix warnings 2022-02-17 17:26:03 +01:00
Antonio Scandurra 0b5c6ea0fd Wait for version before returning code actions 2022-02-17 14:46:26 +01: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 f3e70f32ac Allow FakeLanguageServer handlers to handle multiple requests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 16:19:27 -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 Brunsfeld 7c1cc69cd3 Reduce logging in lsp tests 2022-02-11 16:37:50 -08:00
c574e7eba7 Restructure fake language server to setup request handlers in advance
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 15:08:56 -08:00
Antonio ScandurraandNathan Sobo 85cdfddb31 Fetch code actions on cursor movement instead of on-demand
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 14:41:19 +01:00
Max Brunsfeld 0be3b9e3be Silence warnings 2022-02-09 13:00:09 -08: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 1e18742c9d Merge branch 'main' into assists 2022-02-08 12:41:57 -08:00
Max BrunsfeldandNathan Sobo c60eabc117 Run multiple iterations of all integration tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-07 15:11:41 -08:00
Antonio Scandurra 1ae79902e9 WIP: Start on applying code actions 2022-02-07 12:20:03 +01: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
Antonio Scandurra a68c127491 Broadcast completion triggers to remote participants 2022-02-02 14:07:41 +01:00
5b996f341f Advertise snippet_support capability to LSP
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-01 18:20:47 +01: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
Antonio ScandurraandNathan Sobo faae7097d4 Advertise additionalTextEdits resolution capability to language servers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 19:09:29 +01:00
Max Brunsfeld e5a75adb41 Adjust hover assertion in lsp test after bumping rust-analyzer 2022-01-28 12:11:26 -08:00
Antonio Scandurra 9e52506098 Advertise link capability in LSP 2022-01-20 12:10:01 +01:00
Antonio Scandurra c6d5033861 💄 2022-01-14 10:20:04 +01:00
Antonio ScandurraandNathan Sobo f883ffb4f2 Implement Buffer::format
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 18:01:20 +01:00
Nathan SoboandAntonio Scandurra 80e5915179 Allow disk-based diagnostic progress begin/end events to interleave
When multiple saves occur, we can have multiple start events followed by multiple end events. We don't want to update our project diagnostics view until all pending progress is finished.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-06 09:32:08 -07:00
Antonio Scandurra 46c53aa313 Re-enable cargo check for rust-analyzer 2022-01-04 18:26:16 +01:00
fdf93932dc WIP: Use cargo check for on-disk diagnostics
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-12-23 18:35:50 +01:00
Nathan SoboandMax Brunsfeld 93322a4858 Name the root file of every crate after the crate to ease navigation
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-30 12:46:39 -07:00
Max BrunsfeldandNathan Sobo 837244e938 Start language servers based on buffers' languages
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-02 17:41:01 -07:00
e1e2240199 Explicitly shut down language servers when quitting the app
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-02 13:16:25 -06:00
Antonio Scandurra cfef953537 Avoid error during deserialization if the result field isn't there 2021-11-02 14:58:00 +01:00
a217f62a7d Delay quit until language servers are gracefully shut down
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-01 11:57:31 -07:00
Antonio ScandurraandNathan Sobo 8a5bee616d Communicate with language servers in terms of UTF-16 coordinates
This required indexing UTF-16 positions in `Rope`. We tried opting
into the UTF-8 experimental support but it didn't seem to work
correctly and the standard is UTF-16 anyway.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-29 18:33:23 +02:00