Skip to content

Commit

Permalink
Merge pull request #3022 from ehuss/rust-analyzer
Browse files Browse the repository at this point in the history
Add rust-analyzer proxy.
  • Loading branch information
kinnison authored Aug 27, 2022
2 parents b109e60 + 0bfe623 commit 8f6b536
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
7 changes: 5 additions & 2 deletions doc/src/concepts/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ toolchains. The following is an overview of the different components:
* `rust-docs` — This is a local copy of the [Rust documentation]. Use the
`rustup doc` command to open the documentation in a web browser. Run `rustup
doc --help` for more options.
* `rls` — [RLS] is a language server that provides support for editors and
IDEs.
* `rust-analyzer`[rust-analyzer] is a language server that provides support
for editors and IDEs.
* `rls`[RLS] is a language server that is deprecated and has been replaced
by rust-analyzer.
* `clippy` — [Clippy] is a lint tool that provides extra checks for common
mistakes and stylistic choices.
* `miri` — [Miri] is an experimental Rust interpreter, which can be used for
Expand Down Expand Up @@ -76,6 +78,7 @@ details.
[build-std]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#build-std
[miri]: https://github.com/rust-lang/miri/
[RLS]: https://github.com/rust-lang/rls
[rust-analyzer]: https://rust-analyzer.github.io/
[rustdoc]: https://doc.rust-lang.org/rustdoc/
[cargo]: https://doc.rust-lang.org/cargo/
[clippy]: https://github.com/rust-lang/rust-clippy
Expand Down
2 changes: 1 addition & 1 deletion doc/src/concepts/profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ available at this time are `minimal`, `default`, and `complete`:
`rustup`. This should never be used, as it includes *every* component ever
included in the metadata and thus will almost always fail. If you are
looking for a way to install devtools such as `miri` or IDE integration
tools (`rls`), you should use the `default` profile and
tools (`rust-analyzer`), you should use the `default` profile and
install the needed additional components manually, either by using `rustup
component add` or by using `-c` when installing the toolchain.

Expand Down
4 changes: 3 additions & 1 deletion doc/src/concepts/proxies.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ The list of proxies is currently static in `rustup` and is as follows:

- `rust-lldb`, `rust-gdb`, and `rust-gdbgui` are simple wrappers around the `lldb`, `gdb`, and `gdbgui` debuggers respectively. The wrappers enable some pretty-printing of Rust values and add some convenience features to the debuggers by means of their scripting interfaces.

- `rls` is part of the Rust IDE integration tooling. It implements the language-server protocol to permit IDEs and editors such as Visual Studio Code, ViM, or Emacs, access to the semantics of the Rust code you are editing. It comes from the `rls` component.
- `rust-analyzer` is part of the Rust IDE integration tooling. It implements the language-server protocol to permit IDEs and editors such as Visual Studio Code, ViM, or Emacs, access to the semantics of the Rust code you are editing. It comes from the `rust-analyzer` component.

- `cargo-clippy` and `clippy-driver` are related to the `clippy` linting tool which provides extra checks for common mistakes and stylistic choices and it comes from the `clippy` component.

- `cargo-miri` is an experimental interpreter for Rust's mid-level intermediate representation (MIR) and it comes from the `miri` component.

- `rls` is a deprecated IDE tool that has been replaced by `rust-analyzer`. It comes from the `rls` component.
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub static TOOLS: &[&str] = &[
// Tools which are commonly installed by Cargo as well as rustup. We take a bit
// more care with these to ensure we don't overwrite the user's previous
// installation.
pub static DUP_TOOLS: &[&str] = &["rustfmt", "cargo-fmt"];
pub static DUP_TOOLS: &[&str] = &["rust-analyzer", "rustfmt", "cargo-fmt"];

// If the given name is one of the tools we proxy.
pub fn is_proxyable_tools(tool: &str) -> Result<()> {
Expand Down Expand Up @@ -110,12 +110,12 @@ mod tests {
for tool in DUP_TOOLS {
assert!(is_proxyable_tools(tool).is_ok());
}
let message = &"unknown proxy name: 'unknown-tool'; valid proxy names are 'rustc', \
'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', 'rls', 'cargo-clippy', \
'clippy-driver', 'cargo-miri', 'rustfmt', 'cargo-fmt'";
assert!(is_proxyable_tools("unknown-tool")
.unwrap_err()
.to_string()
.eq(message));
let message = "unknown proxy name: 'unknown-tool'; valid proxy names are 'rustc', \
'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', 'rls', \
'cargo-clippy', 'clippy-driver', 'cargo-miri', 'rust-analyzer', 'rustfmt', 'cargo-fmt'";
assert_eq!(
is_proxyable_tools("unknown-tool").unwrap_err().to_string(),
message
);
}
}
5 changes: 4 additions & 1 deletion tests/cli-misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,10 @@ fn rustup_failed_path_search() {
expect_err(
config,
broken,
"unknown proxy name: 'fake_proxy'; valid proxy names are 'rustc', 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', 'rls', 'cargo-clippy', 'clippy-driver', 'cargo-miri', 'rustfmt', 'cargo-fmt'",
"unknown proxy name: 'fake_proxy'; valid proxy names are \
'rustc', 'rustdoc', 'cargo', 'rust-lldb', 'rust-gdb', 'rust-gdbgui', \
'rls', 'cargo-clippy', 'clippy-driver', 'cargo-miri', \
'rust-analyzer', 'rustfmt', 'cargo-fmt'",
);

// Hardlink will be automatically cleaned up by test setup code
Expand Down

0 comments on commit 8f6b536

Please sign in to comment.