Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rust-analyzer proxy. #3022

Merged
merged 2 commits into from
Aug 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
15 changes: 8 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub static TOOLS: &[&str] = &[
"rust-gdb",
"rust-gdbgui",
"rls",
"rust-analyzer",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be in DUP_TOOLS? That way it won't override a rust-analyzer someone directly installed in .cargo/bin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I went ahead and moved it. I did not realize that the rust-analyzer documentation recommended using cargo install.

Copy link
Member

@lnicola lnicola Jul 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not cargo install, but we have an x.py-like helper for source builds, cargo xtask install, which installs it under ~/.cargo/bin.

"cargo-clippy",
"clippy-driver",
"cargo-miri",
Expand Down Expand Up @@ -110,12 +111,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', 'rust-analyzer', \
'cargo-clippy', 'clippy-driver', 'cargo-miri', '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', 'rust-analyzer', 'cargo-clippy', 'clippy-driver', 'cargo-miri', \
'rustfmt', 'cargo-fmt'",
);

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