]> git.lizzy.rs Git - rust.git/commitdiff
Rename VS Code extension to rust-analyzer
authorAleksey Kladov <aleksey.kladov@gmail.com>
Wed, 8 Jan 2020 16:21:18 +0000 (17:21 +0100)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Mon, 13 Jan 2020 10:13:18 +0000 (11:13 +0100)
docs/user/README.md
editors/code/.vscodeignore
editors/code/icon.png [new file with mode: 0644]
editors/code/package-lock.json
editors/code/package.json
xtask/src/install.rs

index fa202f06cccd435a08a9f99823c8a1d5f68449e6..d17108788b322ff42f98a14b807818c013953676 100644 (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
index 9bcd28e6122e4fbaa470adc0c7300efdf8c9137d..3d1156d3bee9a9bcdb81dd6d5415c7e9092c1852 100644 (file)
@@ -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 (file)
index 0000000..992aee4
Binary files /dev/null and b/editors/code/icon.png differ
index adb01760a1e0e407b84a2cbb70e32606d3c390a4..3059323aa8819be672298b24902ee5738c11f09d 100644 (file)
@@ -1,6 +1,6 @@
 {
-    "name": "ra-lsp",
-    "version": "0.0.1",
+    "name": "rust-analyzer",
+    "version": "0.1.0",
     "lockfileVersion": 1,
     "requires": true,
     "dependencies": {
index e7fc314f3b5c5da906c14ba74b4df7ca73eb5ed2..7c22d21d35d58fffb1c248e0c1babb3a500e48e5 100644 (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/"
index fa82633de152cf6126f84ebf92262dc79ea1a2a2..bffd91af1728388e0b55e751ba2632bdcf6a5a97 100644 (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(())
 }