rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.05k stars 1.56k forks source link

Announcements: Client Changes #4604

Open matklad opened 4 years ago

matklad commented 4 years ago

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.

DropDemBits commented 10 months ago

15876 allows a single TextDocumentEdit to have multiple SnippetTextEdits.

adstep commented 9 months ago

15979 adds commands for running selected tests

nemethf commented 7 months ago

There's a recent change introducing the "Unindexed Project" notification. I think @davidbarsky forgot to mention it here. However, it is not clear to me what are the linkedProjects and how should the client determine the owner. Can you, David, explain this feature in more details? Thank you.

HKalbasi commented 6 months ago

16662 adds a set of lsp extension for supporting the vscode test explorer. If your client has a similar feature for exploring tests, you may find it useful. There are probably some problems around the lsp extension, or it may be too overfitted to the vscode, please raise an issue in those cases.

Veykril commented 6 months ago

https://github.com/rust-lang/rust-analyzer/pull/16773 puts the test explorer behind a testExplorer capability, note that the lsp extension is likely to still change

nemethf commented 5 months ago

16840 by @Wilfred is a pending PR that allows rust-project.json to include arbitrary shell commands for runnables

nemethf commented 4 months ago

Although lsp-extensions.md hasn't been updated, commit 18ca22a98e6a6a1a42717fe95c2d7535dc73c70e extended ServerStatusParams with a new field called workspaceInfo.

Veykril commented 3 months ago

Although lsp-extensions.md hasn't been updated, commit 18ca22a extended ServerStatusParams with a new field called workspaceInfo.

https://github.com/rust-lang/rust-analyzer/pull/17287 removes this again as it feels out of place for the status notification. (I didn't post about it here when adding it because I was mainly experimenting, should've made that clear from the start)

nemethf commented 3 months ago

Commit ef59b49f7e69ba237e1985270f423d3e104d5247 by @roife extended the args of Runnable with an optional cwd field for the cargo kind. It seems cwd sould be used instead of workspaceRoot when it is present.

On the other hand, the log of commit a55e8bf09cdfc25066b77823cc98976a51af8a8b has this sentence: "When the kind of runnable is bin", but according to the docs, kind can only be cargo.

roife commented 3 months ago

On the other hand, the log of commit a55e8bf has this sentence: "When the kind of runnable is bin", but according to the docs, kind can only be cargo.

There was some ambiguity regarding the term kind due to my previous lack of clarity. In this context, kind refers to ide::Runnable.kind, which is of type RunnableKind (can be Test, Bin, Bench, etc.), is used internally within r-a.

The kind you mentioned refers to rust_analyzer::lsp_ext::Runnable.kind, which is of type rust_analyzer::lsp_ext::RunnableKind (and can only be cargo), is used for responses sent to the client.

davidbarsky commented 3 months ago

https://github.com/rust-lang/rust-analyzer/pull/16840 added runnable support to rust-project.json. I'll create a PR to update the manual, but the newly added rustdocs on project_json.rs will are a reasonable starting point for the new behavior.

Veykril commented 2 months ago

https://github.com/rust-lang/rust-analyzer/pull/17547 changes the runnable payload, notably it now has an environment field for env vars to be set, always sents a cwd working directory that a client should honor, gets rid of cargoExtraArgs and bakes that into cargoArgs (as there is no need for the client to do this) and drops the expectTest field in favor of the env var field.

joshka commented 1 month ago

17587 adds a rust-analyzer.rename command that triggers the editor.action.rename. This allows extract symbols assists to cause the editor to prompt the user to rename the newly extracted symbol in place.

Veykril commented 1 month ago

Heads up, https://github.com/rust-lang/rust-analyzer/pull/17647 changes two command names. This is unfortunately a breaking change but the previous names were accidentally plainly copied from VSCode whereas they should've been more rust-analyzer specific

joshka commented 1 month ago

Heads up, #17647 changes two command names. This is unfortunately a breaking change but the previous names were accidentally plainly copied from VSCode whereas they should've been more rust-analyzer specific

To save the extra click (and make this thread searchable for changes in the future):

The commands editor.action.triggerParameterHints and editor.action.rename are now renamed to rust-analyzer.triggerParameterHints and rust-analyzer.rename