rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Announcements: Client Changes

Open matklad opened this issue 5 years ago • 61 comments

This issue exists to announce changes which might affect rust-analyzer plugins for different editors. If you maintain such a plugin, consider subscribing to this issue.

All our protocol extensions are documented at lsp-extensions.md. I'll try to remember to leave a comment on this issue if I modify that file.

matklad avatar May 25 '20 09:05 matklad

After https://github.com/rust-analyzer/rust-analyzer/pull/4632, all our current extensions are documented. There were a bunch of minor changes here and there. Most notably some requests were moved from rust-analyzer/foo to experimental/foo, in hope that this might be useful for other servers, and to mark the extensions we intend to upstream to the protocol itself.

Notably, inlay hints and runnables are are still unchanged: i want to upstream these two as well, but I am not too happy with their current state, and I don't have time to polish them right now. So i opted for documenting them as is, and cleaning up later.

matklad avatar May 27 '20 10:05 matklad

https://github.com/rust-analyzer/rust-analyzer/pull/4688 documents our initilizationOptions.

matklad avatar Jun 01 '20 15:06 matklad

#4710 changes API for runnables. The idea is that it's the client who is reponsible for running stuff, to make it possible to, eg, inject debugger support or other custom tools. So, rust-analzyer provides a more abstract representation of a cargo command, to make it easier for the client to make sense of it.

matklad avatar Jun 03 '20 07:06 matklad

#4717 adds API for lazily computing code action edits.

matklad avatar Jun 05 '20 09:06 matklad

#5188 adds status notification.

matklad avatar Jul 02 '20 13:07 matklad

adds "memory usage" command: https://github.com/rust-analyzer/rust-analyzer/pull/5244

matklad avatar Jul 07 '20 10:07 matklad

https://github.com/rust-analyzer/rust-analyzer/pull/4972 will switch to gzipping release artifacts.

matklad avatar Jul 07 '20 10:07 matklad

rust-analyzer is available via rustup.

15:04:42|~/projects/rust-analyzer/editors/code|master✓
λ rustup component add --toolchain nightly rust-analyzer-preview
info: component 'rust-analyzer-preview' for target 'x86_64-unknown-linux-gnu' is up to date

15:04:46|~/projects/rust-analyzer/editors/code|master✓
λ rustup run nightly rust-analyzer --version
rust-analyzer f5a4a4b

The "officially recommended" binary at the moment is still the one from releases in this repo, but rustup one should be fine as well.

matklad avatar Jul 08 '20 13:07 matklad

https://github.com/rust-analyzer/rust-analyzer/pull/5782

matklad avatar Aug 17 '20 14:08 matklad

https://github.com/rust-analyzer/rust-analyzer/pull/5930 adapts the latest changes of the semantic tokens

matklad avatar Sep 02 '20 15:09 matklad

Flexible runnables configuration:

  • https://github.com/rust-analyzer/rust-analyzer/pull/6253
  • https://github.com/rust-analyzer/rust-analyzer/pull/5954

matklad avatar Oct 17 '20 22:10 matklad

I am adding a rust-analyzer action for #6462, and will be changing the hash.

p3achyjr avatar Nov 10 '20 01:11 p3achyjr

https://github.com/rust-analyzer/rust-analyzer/pull/6521 removes our custom support for code action resolving in favor of one provided by LSP 1.16.

matklad avatar Nov 10 '20 17:11 matklad

#6761 adds a rust-analyzer --print-config-schema command which prints JSON-schema for the configuration for rust-analyzer, in the style of package.json. This should allow non-VS Code clients to show better auto-complete & docs for user config, and should also help to ensure that the defaults are the same between vscode and other editors.

matklad avatar Dec 08 '20 18:12 matklad

In #6996 we want to stop releasing uncompressed binaries. Clients that can automatically install the LSP server binary should download the .gz file instead.

We've also changed the naming convention to include the platform tuple:

  • instead of rust-analyzer-windows.exe, use rust-analyzer-x86_64-pc-windows-msvc.gz
  • instead of rust-analyzer-linux, use rust-analyzer-x86_64-unknown-linux-gnu.gz
  • instead of rust-analyzer-mac, use rust-analyzer-x86_64-apple-darwin.gz

This allows us to support new platforms more easily, speeds up downloads and avoids wasting disk space.

lnicola avatar Dec 24 '20 13:12 lnicola

#7068 adds a command to show our HIR representation of a function.

lnicola avatar Jan 05 '21 09:01 lnicola

#7412 adds a new readyPartial in status notification :

export type Status = "loading" | "ready" | "readyPartial" | "invalid" | "needsReload";

edwin0cheng avatar Jan 28 '21 17:01 edwin0cheng

#7625 adds a "copy runnable command line" command.

lnicola avatar Feb 10 '21 11:02 lnicola

It is now possible to use ut8 coordinate space for positions and ranges: https://github.com/rust-analyzer/rust-analyzer/pull/7657

matklad avatar Feb 17 '21 10:02 matklad

#8054 adds a new request to move functions, statements, etc up and down.

matklad avatar Mar 22 '21 13:03 matklad

Side note: There's a missing n in the title, it should be "Announcements".

jplatte avatar Mar 29 '21 12:03 jplatte

https://github.com/rust-analyzer/rust-analyzer/pull/8355 replaces rust-analyzer specific rust-analyzer/status with a more general experimental/serverStatus. close upstream issue: https://github.com/microsoft/language-server-protocol/issues/511

matklad avatar Apr 06 '21 12:04 matklad

For the record, here the new status is documented as requiring serverStatus capability, when in rust-analyzer only reacted to serverStatusNotification.

Is that a typo in the docs or a bug in #8355?

bstaletic avatar Apr 08 '21 16:04 bstaletic

@matklad ping re bstaletic's question. Would like a clarification on what was the intention there, please.

theli-ua avatar Apr 13 '21 20:04 theli-ua

Bug in the spec!

matklad avatar Apr 13 '21 21:04 matklad

Pushed the fix and clarified the docs in https://github.com/rust-analyzer/rust-analyzer/pull/8580. @bstaletic I see that you are using the status to check is this a good occasion to bother the server with requests. I guess you can do that, but its not really necessary. In VS Code client, we just always send the requests, without checking if the server is ready.

The status notification is used solely to draw an entry in the modline for the user: https://github.com/rust-analyzer/rust-analyzer/blob/master/editors/code/src/ctx.ts#L69-L91

matklad avatar Apr 19 '21 15:04 matklad

#7698 and #8877 extend workspace/symbol to allow for filtering, such as "give me all types in my project" or "give me all types and functions in my project and its dependencies". I feel that we might want to iterate a bit on what exactly the filtering parameter looks like, but, if we do that we'll add new capability.

matklad avatar May 19 '21 10:05 matklad

#8926 drops the uncompressed release artifacts and those that don't contain the target name:

  • rust-analyzer-linux
  • rust-analyzer-linux.gz
  • rust-analyzer-mac
  • rust-analyzer-mac.gz
  • rust-analyzer-windows.exe
  • rust-analyzer-windows.gz

lnicola avatar May 22 '21 18:05 lnicola

With https://github.com/rust-analyzer/rust-analyzer/pull/9693, it's now possible to pass a Range in the Hover request, and not just a position.

matklad avatar Jul 28 '21 11:07 matklad

https://github.com/rust-analyzer/rust-analyzer/pull/9732 add client capabilities for curstom client-side rust-analyzre commands. So, heads up, action required: if your client implements any of

                "rust-analyzer.runSingle",
                "rust-analyzer.debugSingle",
                "rust-analyzer.showReferences",
                "rust-analyzer.gotoLocation",
                "editor.action.triggerParameterHints",

Then add

"experimental": {
  "commands": {
    "commands": [ "rust-analyzer.runSingle", "rust-analyzer.debugSingle", "rust-analyzer.showReferences", "rust-analyzer.gotoLocation", "editor.action.triggerParameterHints"]
  }
}

to the capabilities. Note the nested commands/commands. This feels stupid, but is intentional -- it mirrors the capability for server commands, and allows us to add more fields to the cap in a backwrad compatible way

matklad avatar Jul 30 '21 16:07 matklad