ForLoveOfCats
8ba2f77148
One big cleanup pass of clippy lints
...
Co-authored-by: Mikayla <mikayla@zed.dev>
2022-08-10 16:51:01 -07:00
ForLoveOfCats
5149c15329
Add "go to type definition" action
2022-07-29 11:41:08 -04:00
Isaac Clayton
6585daccf9
Further unpropogate async
2022-07-07 16:16:58 +02:00
Isaac Clayton
7dd3114a7a
Start switching JSON LSP adapter to plugin (take 2)
2022-07-07 15:16:59 +02:00
Keith Simmons
ebe733a393
Restart language server using original root path rather than the path of the buffer restarted from
2022-06-30 19:11:21 -07:00
Keith Simmons
db05e32389
Prevent creating extra language server instances if there already exists one for that workspace
2022-06-30 16:46:26 -07:00
Antonio Scandurra
ca1d0a6e59
Ignore tokens that were not created via WorkDoneProgressCreate
...
With the new version of rust-analyzer, we were seeing stray `WorkDoneProgress::End`
messages that create an imbalance in the `pending_diagnostic_updates` that never
resolves. This was causing the diagnostic status bar item to never update because
we wouldn't emit `DiskBasedDiagnosticsStarted` nor `DiskBasedDiagnosticsFinished`.
This commit fixes the above situation by only acknowledging progress report for tokens
that have explicitly been created via the `WorkDoneProgressCreate` request, as stated
by the protocol.
In addition to that, we are replacing the `pending_diagnostic_updates: isize` with
a `has_pending_diagnostic_updates: bool`. We added it at some point to prevent a similar
issue where we would observe begin/end reports in a seemingly random order, which would cause
us to permanently display a `checking...` message in the status bar. I believe this commit
fixes that as well because the `isize` was just a less general solution for the same
underlying issue. As the protocol states: "the token provided in the create request should
only be used once (e.g. only one begin, many report and one end notification should be sent
to it)."
2022-06-28 10:08:43 +02:00
Max Brunsfeld
11f73bfa4e
Integrate pyright language server
2022-06-22 16:58:19 -07:00
Max Brunsfeld
e9d19457d6
Add failing test for replication of lsp statuses
...
Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-06-21 11:27:08 -07:00
Keith Simmons
b014352740
Syntax highlighting working. Getting started on markdown support
2022-06-07 11:54:33 -07:00
Max Brunsfeld
724affc442
Upgrade deps to avoid multiple versions of transitive deps
...
* env_logger
* prost-build
* bindgen
2022-06-02 17:38:33 -07:00
Antonio Scandurra
339069b1d3
Cap MessageStream
buffer size to 1MB
...
We temporarily let it grow when the message size exceed the limit,
but restore the buffer's capacity shortly after. This ensures that,
for each connection in its entire lifetime, we only ever use 1MB.
2022-05-31 11:16:32 +02:00
Max Brunsfeld
3dee656490
Avoid panic when language server is dropped before being initialized in tests
...
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-05-09 18:05:10 -07:00
Antonio Scandurra
f91fdd2ba0
Return None
when prepare rename is not available on language server
2022-04-22 15:43:23 +02:00
Nathan Sobo
7e5a3f9f6b
Introduce structured logging
...
We're enabling the log crate feature everywhere, but only using it on the server for now.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-04-08 10:06:51 -06:00
Nathan Sobo
80d55fd3d8
Don't starve UI thread when rapidly receiving LSP messages
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-04-07 08:30:42 -06:00
Max Brunsfeld
56523b5775
Allow applying code actions that use commands
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-04-01 10:16:26 -07:00
Max Brunsfeld
e987a8ba63
Let fake and real LanguageServer access AsyncAppContext in handler callbacks
...
Also, reimplement FakeLanguageServer by wrapping LanguageServer, instead of
duplicating its functionality differently.
2022-03-31 21:57:00 -07:00
Max Brunsfeld
c280c85ce7
Hard-code LSP formatting options for now
...
This is needed for auto-formatting to work properly in TypeScript and JSON
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-30 17:08:40 -07:00
Keith Simmons
32d2e5952c
Test language server restart works as expected
...
Co-authored-by: Max Brunsfeld <max@zed.dev>
2022-03-30 13:08:36 -07:00
Keith Simmons
6d91fd078c
Add restart-lsp keybinding
2022-03-29 17:24:23 -07:00
Antonio Scandurra
03752f913d
Fix warnings
2022-03-28 11:05:55 +02:00
Antonio Scandurra
cbd266052d
Allow returning futures in fake language server request handlers
2022-03-28 10:44:32 +02:00
Max Brunsfeld
20fed599b2
Start work on relaying settings to language servers
2022-03-11 17:36:27 -08:00
Max Brunsfeld
2103eec463
Allow registering handlers for typed LSP requests
2022-03-11 13:19:10 -08:00
Max Brunsfeld
862ec01e7d
Add API for handling custom requests from the language server
2022-03-11 11:44:02 -08:00
Max Brunsfeld
6091caee8e
Merge branch 'main' into settings-file
2022-03-11 10:04:17 -08:00
Max Brunsfeld
9a6819b899
For single-file worktrees start LSP with parent dir as CWD
2022-03-10 16:06:12 -08:00
Antonio Scandurra
45fb470f4d
Display language server name in status bar
2022-03-10 16:48:43 +01:00
Antonio Scandurra
7546ede288
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
4cb4b99c56
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
d8ef3a5d61
Support formatting in fake LSP capabilities
2022-03-04 11:24:18 +01:00
Max Brunsfeld
19658139b1
Avoid infinite loop when a language server fails to start
2022-03-03 18:13:38 -08:00
Max Brunsfeld
05df1dfae9
Disable doctests for all libraries
...
We don't use them, and they add a lot of noise to the test output
when running all tests in the workspace.
2022-03-03 16:15:56 -08:00
Max Brunsfeld
78d96a05fc
Make fake language servers have full capabilities
2022-03-03 15:42:29 -08:00
Max Brunsfeld
9999862016
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 Brunsfeld
0582c557e3
Add JSON language server
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-03 13:29:25 -08:00
Antonio Scandurra
141e0559a5
Fix warnings
2022-03-02 12:45:49 +01:00
Max Brunsfeld
95b2f4fb16
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
f2f1a52c7e
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
74469a46ba
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
466db69780
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 Brunsfeld
9a97588f79
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
d929819c33
Fix warning
2022-02-24 09:52:25 +01:00
Antonio Scandurra
9e173564e9
Pass an AsyncAppContext
to fake language server request handlers
2022-02-23 16:14:36 +01:00
Antonio Scandurra
277d86bd29
Remove unused method
2022-02-21 17:31:43 +01:00
Antonio Scandurra
af0ce62d3b
Remove rust-analyzer smoke test
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-21 17:28:55 +01:00
Antonio Scandurra
30e4ea1a4c
Fix warnings
2022-02-17 17:26:03 +01:00
Antonio Scandurra
303e8e1688
Wait for version before returning code actions
2022-02-17 14:46:26 +01:00
Max Brunsfeld
41ba980c9b
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 Brunsfeld
90f31bb123
Allow FakeLanguageServer handlers to handle multiple requests
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-16 16:19:27 -08:00
Max Brunsfeld
c4dff12d69
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
8d6504826c
Reduce logging in lsp tests
2022-02-11 16:37:50 -08:00
Max Brunsfeld
01664d494c
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 Scandurra
2fcdcac080
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
3d9c39d0eb
Silence warnings
2022-02-09 13:00:09 -08:00
Max Brunsfeld
8b1fb9a2cc
Fix unused import warnings
2022-02-08 16:27:33 -08:00
Max Brunsfeld
6731d92f60
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
e0fe8b5a7c
Merge branch 'main' into assists
2022-02-08 12:41:57 -08:00
Max Brunsfeld
b0ed58add3
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
982e90539d
WIP: Start on applying code actions
2022-02-07 12:20:03 +01:00
Max Brunsfeld
83d4fe8e3a
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
91e5c2dfac
Broadcast completion triggers to remote participants
2022-02-02 14:07:41 +01:00
Antonio Scandurra
d873786710
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 Brunsfeld
1d1f8df180
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 Scandurra
1e96fc98e7
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
be7f5340d0
Adjust hover assertion in lsp test after bumping rust-analyzer
2022-01-28 12:11:26 -08:00
Max Brunsfeld
0e55f0ccaa
Use Rust 2021 edition in all crates
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-26 12:50:31 -08:00
Antonio Scandurra
11a83d01c2
Advertise link capability in LSP
2022-01-20 12:10:01 +01:00
Antonio Scandurra
e7f1398f3a
💄
2022-01-14 10:20:04 +01:00
Antonio Scandurra
310def2923
Implement Buffer::format
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 18:01:20 +01:00
Nathan Sobo
d7a78e14ac
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
ad1db117e6
Re-enable cargo check for rust-analyzer
2022-01-04 18:26:16 +01:00
Antonio Scandurra
7b453beebc
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 Sobo
1445ce10b5
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 Brunsfeld
8d3f42de52
Start language servers based on buffers' languages
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-02 17:41:01 -07:00
Nathan Sobo
2c57703ad6
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
882c8ce696
Avoid error during deserialization if the result
field isn't there
2021-11-02 14:58:00 +01:00
Max Brunsfeld
1aee7bdb1d
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 Scandurra
6212ebad9b
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
Antonio Scandurra
78c158e1a4
Support only UTF-8 for now when communicating with language server
2021-10-29 12:02:42 +02:00
Antonio Scandurra
50afb2d65f
Remove stray println! statements in the LSP I/O code
2021-10-28 14:07:14 +02:00
Max Brunsfeld
7d5425e142
Move lsp configuration into language crate
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-10-26 12:17:51 -07:00
Antonio Scandurra
0674e76864
WIP
2021-10-26 19:42:40 +02: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
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
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
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