Merge #1867
1867: tweak installation process r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
9dd1dcf5ac
@ -23,9 +23,10 @@ useful IDE experience and some people use it as a daily driver.
|
|||||||
To build rust-analyzer, you need:
|
To build rust-analyzer, you need:
|
||||||
|
|
||||||
* latest stable rust for language server itself
|
* latest stable rust for language server itself
|
||||||
* latest stable npm and VS Code for VS Code extension (`code` should be in path)
|
* latest stable npm and VS Code for VS Code extension
|
||||||
|
|
||||||
For setup for other editors, see [./docs/user](./docs/user).
|
To quickly install rust-analyzer with VS Code extension with standard setup
|
||||||
|
(`code` and `cargo` in `$PATH`, etc), use this:
|
||||||
|
|
||||||
```
|
```
|
||||||
# clone the repo
|
# clone the repo
|
||||||
@ -37,6 +38,9 @@ $ cargo install-ra
|
|||||||
# alternatively, install only the server. Binary name is `ra_lsp_server`.
|
# alternatively, install only the server. Binary name is `ra_lsp_server`.
|
||||||
$ cargo install-ra --server
|
$ cargo install-ra --server
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For non-standard setup of VS Code and other editors, see [./docs/user](./docs/user).
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
If you want to **contribute** to rust-analyzer or just curious about how things work
|
If you want to **contribute** to rust-analyzer or just curious about how things work
|
||||||
|
@ -79,13 +79,13 @@ pub fn project_root() -> PathBuf {
|
|||||||
Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(2).unwrap().to_path_buf()
|
Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(2).unwrap().to_path_buf()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Cmd {
|
pub struct Cmd<'a> {
|
||||||
pub unix: &'static str,
|
pub unix: &'a str,
|
||||||
pub windows: &'static str,
|
pub windows: &'a str,
|
||||||
pub work_dir: &'static str,
|
pub work_dir: &'a str,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Cmd {
|
impl Cmd<'_> {
|
||||||
pub fn run(self) -> Result<()> {
|
pub fn run(self) -> Result<()> {
|
||||||
if cfg!(windows) {
|
if cfg!(windows) {
|
||||||
run(self.windows, self.work_dir)
|
run(self.windows, self.work_dir)
|
||||||
|
@ -167,27 +167,34 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> {
|
|||||||
}
|
}
|
||||||
.run()?;
|
.run()?;
|
||||||
|
|
||||||
let code_in_path = Cmd {
|
let code_binary = ["code", "code-insiders"].iter().find(|bin| {
|
||||||
unix: r"code --version",
|
Cmd {
|
||||||
windows: r"cmd.exe /c code.cmd --version",
|
unix: &format!("{} --version", bin),
|
||||||
|
windows: &format!("cmd.exe /c {}.cmd --version", bin),
|
||||||
work_dir: "./editors/code",
|
work_dir: "./editors/code",
|
||||||
}
|
}
|
||||||
.run()
|
.run()
|
||||||
.is_ok();
|
.is_ok()
|
||||||
if !code_in_path {
|
});
|
||||||
Err("Can't execute `code --version`. Perhaps it is not in $PATH?")?;
|
|
||||||
}
|
let code_binary = match code_binary {
|
||||||
|
Some(it) => it,
|
||||||
|
None => Err("Can't execute `code --version`. Perhaps it is not in $PATH?")?,
|
||||||
|
};
|
||||||
|
|
||||||
Cmd {
|
Cmd {
|
||||||
unix: r"code --install-extension ./ra-lsp-0.0.1.vsix --force",
|
unix: &format!(r"{} --install-extension ./ra-lsp-0.0.1.vsix --force", code_binary),
|
||||||
windows: r"cmd.exe /c code.cmd --install-extension ./ra-lsp-0.0.1.vsix --force",
|
windows: &format!(
|
||||||
|
r"cmd.exe /c {}.cmd --install-extension ./ra-lsp-0.0.1.vsix --force",
|
||||||
|
code_binary
|
||||||
|
),
|
||||||
work_dir: "./editors/code",
|
work_dir: "./editors/code",
|
||||||
}
|
}
|
||||||
.run()?;
|
.run()?;
|
||||||
|
|
||||||
let output = Cmd {
|
let output = Cmd {
|
||||||
unix: r"code --list-extensions",
|
unix: &format!(r"{} --list-extensions", code_binary),
|
||||||
windows: r"cmd.exe /c code.cmd --list-extensions",
|
windows: &format!(r"cmd.exe /c {}.cmd --list-extensions", code_binary),
|
||||||
work_dir: ".",
|
work_dir: ".",
|
||||||
}
|
}
|
||||||
.run_with_output()?;
|
.run_with_output()?;
|
||||||
|
Loading…
Reference in New Issue
Block a user