Go to file
bors 3c89945e78 Auto merge of #14098 - pascalkuthe:did_change_workspace_folder, r=Veykril
Support DidChangeWorkspaceFolders notifications

This PR enables the `WorkspaceFoldersServerCapabilities` capability for rust-analyzer and implemented support for the associated [`DidChangeWorkspaceFolders`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_didChangeWorkspaceFolders) notification to allow clients to update the list of `workspaceFolders` sent during initialization.

## Motivation

This allows clients which lazily autodiscover their workspace roots (like the [helix editor](https://github.com/helix-editor/helix) once [my PR](https://github.com/helix-editor/helix/pull/5748) lands) avoid spawning multiple instances of RA. Right now such clients are forced to either:

* greedily discover all LSP roots in the workspace (precludes the ability to respond to new workspace roots)
* spawn multiple instance of rust-analyzer (one for each root)
* restart rust-analyzer whenever a new workspace is added

Some example use-cases are shown [here](https://github.com/helix-editor/helix/pull/5748#issuecomment-1421012523).

This PR will also improve support for VSCode (and Atom) multi workspaces.

## Implementation

The implementation was fairly straightforward as `rust-analyzer` already supports dynamically reloading workspaces, for example on configuration changes. Furthermore, rust-analyzer also already supports auto-discovering internal workspace from the `workspaceFolders` key in the initialization request. Therefore, the necessary logic just needed to be moved to a central place and reused.
2023-02-08 09:14:01 +00:00
.cargo Add CARGO_WORKSPACE_DIR env var in .cargo/config.toml 2022-07-19 13:02:16 +02:00
.github Auto merge of #14010 - silvergasp:ci, r=lnicola 2023-02-03 11:15:54 +00:00
.vscode ⬆️ rust-analyzer 2022-08-16 11:24:50 +03:00
assets
bench_data avoid a &str to String conversion 2022-08-17 04:58:26 +09:00
crates Auto merge of #14098 - pascalkuthe:did_change_workspace_folder, r=Veykril 2023-02-08 09:14:01 +00:00
docs Support sysroot library source being defined inside the workspace 2023-02-06 12:07:33 +01:00
editors/code Auto merge of #14090 - MariaSolOs:regions, r=Veykril 2023-02-06 14:37:39 +00:00
lib simplify is_exit check 2023-01-31 11:01:01 +00:00
xtask Bump zip 2023-02-01 19:24:32 +02:00
.editorconfig
.git-blame-ignore-revs
.gitattributes Fix .gitattributes for test_data 2022-07-24 14:05:35 +02:00
.gitignore
Cargo.lock reuse fetching target data layout from rustc function 2023-02-06 23:48:20 +03:30
Cargo.toml Auto merge of #13969 - Veykril:workspace.dependencies, r=Veykril 2023-01-17 10:29:27 +00:00
LICENSE-APACHE
LICENSE-MIT
PRIVACY.md
README.md ⬆️ rust-analyzer 2022-08-09 07:23:57 +03:00
rustfmt.toml
triagebot.toml ⬆️ rust-analyzer 2022-11-09 21:49:10 +02:00

rust-analyzer logo

rust-analyzer is a modular compiler frontend for the Rust language. It is a part of a larger rls-2.0 effort to create excellent IDE support for Rust.

Quick Start

https://rust-analyzer.github.io/manual.html#installation

Documentation

If you want to contribute to rust-analyzer or are just curious about how things work under the hood, check the ./docs/dev folder.

If you want to use rust-analyzer's language server with your editor of choice, check the manual folder. It also contains some tips & tricks to help you be more productive when using rust-analyzer.

Security and Privacy

See the corresponding sections of the manual.

Communication

For usage and troubleshooting requests, please use "IDEs and Editors" category of the Rust forum:

https://users.rust-lang.org/c/ide/14

For questions about development and implementation, join rust-analyzer working group on Zulip:

https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer

License

rust-analyzer is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.