diff --git a/docs/user/README.md b/docs/user/README.md index fa202f06ccc..d17108788b3 100644 --- a/docs/user/README.md +++ b/docs/user/README.md @@ -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 diff --git a/editors/code/.vscodeignore b/editors/code/.vscodeignore index 9bcd28e6122..3d1156d3bee 100644 --- a/editors/code/.vscodeignore +++ b/editors/code/.vscodeignore @@ -2,3 +2,4 @@ !out/main.js !package.json !package-lock.json +!icon.png diff --git a/editors/code/icon.png b/editors/code/icon.png new file mode 100644 index 00000000000..992aee4bd56 Binary files /dev/null and b/editors/code/icon.png differ diff --git a/editors/code/package-lock.json b/editors/code/package-lock.json index adb01760a1e..3059323aa88 100644 --- a/editors/code/package-lock.json +++ b/editors/code/package-lock.json @@ -1,6 +1,6 @@ { - "name": "ra-lsp", - "version": "0.0.1", + "name": "rust-analyzer", + "version": "0.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/editors/code/package.json b/editors/code/package.json index e7fc314f3b5..7c22d21d35d 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -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/" diff --git a/xtask/src/install.rs b/xtask/src/install.rs index fa82633de15..bffd91af172 100644 --- a/xtask/src/install.rs +++ b/xtask/src/install.rs @@ -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(()) }