Rename VS Code extension to rust-analyzer

This commit is contained in:
Aleksey Kladov 2020-01-08 17:21:18 +01:00
parent a05970da46
commit bd7aa5db14
6 changed files with 34 additions and 17 deletions

View file

@ -44,7 +44,7 @@ $ cargo xtask install
The automatic installation is expected to *just work* for common cases, if it
doesn't, report bugs!
**Note** [#1831](https://github.com/rust-analyzer/rust-analyzer/issues/1831): If you are using the popular
**Note** [#1831](https://github.com/rust-analyzer/rust-analyzer/issues/1831): If you are using the popular
[Vim emulation plugin](https://github.com/VSCodeVim/Vim), you will likely
need to turn off the `rust-analyzer.enableEnhancedTyping` setting.
@ -58,7 +58,7 @@ $ cargo install --path ./crates/ra_lsp_server/ --force --locked
$ cd ./editors/code
$ npm install
$ ./node_modules/vsce/out/vsce package
$ code --install-extension ./ra-lsp-0.0.1.vsix
$ code --install-extension ./rust-analyzer-0.1.0.vsix
```
It's better to remove existing Rust plugins to avoid interference.
@ -83,7 +83,7 @@ manually install the `.vsix` package:
3. Open the Extensions View (`View > Extensions`, keyboard shortcut: `Ctrl+Shift+X`).
4. From the top-right kebab menu (`···`) select `Install from VSIX...`
5. Inside the `rust-analyzer` directory find the `editors/code` subdirectory and choose
the `ra-lsp-0.0.1.vsix` file.
the `rust-analyzer-0.1.0.vsix` file.
6. Restart Visual Studio Code and re-establish the connection to the remote host.
In case of errors please make sure that `~/.cargo/bin` is in your `PATH` on the remote

View file

@ -2,3 +2,4 @@
!out/main.js
!package.json
!package-lock.json
!icon.png

BIN
editors/code/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View file

@ -1,6 +1,6 @@
{
"name": "ra-lsp",
"version": "0.0.1",
"name": "rust-analyzer",
"version": "0.1.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View file

@ -1,10 +1,11 @@
{
"name": "ra-lsp",
"displayName": "ra-lsp",
"name": "rust-analyzer",
"displayName": "rust-analyzer",
"description": "An alternative rust language server to the RLS",
"preview": true,
"private": true,
"version": "0.0.1",
"icon": "icon.png",
"version": "0.1.0",
"publisher": "matklad",
"repository": {
"url": "https://github.com/matklad/rust-analyzer/"

View file

@ -107,29 +107,44 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> {
};
Cmd {
unix: &format!(r"{} --install-extension ./ra-lsp-0.0.1.vsix --force", code_binary),
unix: &format!(r"{} --install-extension ./rust-analyzer-0.1.0.vsix --force", code_binary),
windows: &format!(
r"cmd.exe /c {}.cmd --install-extension ./ra-lsp-0.0.1.vsix --force",
r"cmd.exe /c {}.cmd --install-extension ./rust-analyzer-0.1.0.vsix --force",
code_binary
),
work_dir: "./editors/code",
}
.run()?;
let output = Cmd {
unix: &format!(r"{} --list-extensions", code_binary),
windows: &format!(r"cmd.exe /c {}.cmd --list-extensions", code_binary),
work_dir: ".",
}
.run_with_output()?;
let installed_extensions = {
let output = Cmd {
unix: &format!(r"{} --list-extensions", code_binary),
windows: &format!(r"cmd.exe /c {}.cmd --list-extensions", code_binary),
work_dir: ".",
}
.run_with_output()?;
String::from_utf8(output.stdout)?
};
if !str::from_utf8(&output.stdout)?.contains("ra-lsp") {
if !installed_extensions.contains("rust-analyzer") {
anyhow::bail!(
"Could not install the Visual Studio Code extension. \
Please make sure you have at least NodeJS 10.x together with the latest version of VS Code installed and try again."
);
}
if installed_extensions.contains("ra-lsp") {
Cmd {
unix: &format!(r"{} --uninstall-extension matklad.ra-lsp", code_binary),
windows: &format!(
r"cmd.exe /c {}.cmd --uninstall-extension matklad.ra-lsp",
code_binary
),
work_dir: "./editors/code",
}
.run()?;
}
Ok(())
}