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 The automatic installation is expected to *just work* for common cases, if it
doesn't, report bugs! 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 [Vim emulation plugin](https://github.com/VSCodeVim/Vim), you will likely
need to turn off the `rust-analyzer.enableEnhancedTyping` setting. 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 $ cd ./editors/code
$ npm install $ npm install
$ ./node_modules/vsce/out/vsce package $ ./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. 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`). 3. Open the Extensions View (`View > Extensions`, keyboard shortcut: `Ctrl+Shift+X`).
4. From the top-right kebab menu (`···`) select `Install from VSIX...` 4. From the top-right kebab menu (`···`) select `Install from VSIX...`
5. Inside the `rust-analyzer` directory find the `editors/code` subdirectory and choose 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. 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 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 !out/main.js
!package.json !package.json
!package-lock.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", "name": "rust-analyzer",
"version": "0.0.1", "version": "0.1.0",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View file

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

View file

@ -107,29 +107,44 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> {
}; };
Cmd { 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!( 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 code_binary
), ),
work_dir: "./editors/code", work_dir: "./editors/code",
} }
.run()?; .run()?;
let output = Cmd { let installed_extensions = {
unix: &format!(r"{} --list-extensions", code_binary), let output = Cmd {
windows: &format!(r"cmd.exe /c {}.cmd --list-extensions", code_binary), unix: &format!(r"{} --list-extensions", code_binary),
work_dir: ".", windows: &format!(r"cmd.exe /c {}.cmd --list-extensions", code_binary),
} work_dir: ".",
.run_with_output()?; }
.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!( anyhow::bail!(
"Could not install the Visual Studio Code extension. \ "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." 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(()) Ok(())
} }