diff options
Diffstat (limited to 'xtask/src')
-rw-r--r-- | xtask/src/install.rs | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/xtask/src/install.rs b/xtask/src/install.rs index fa82633de..bffd91af1 100644 --- a/xtask/src/install.rs +++ b/xtask/src/install.rs | |||
@@ -107,29 +107,44 @@ fn install_client(ClientOpt::VsCode: ClientOpt) -> Result<()> { | |||
107 | }; | 107 | }; |
108 | 108 | ||
109 | Cmd { | 109 | Cmd { |
110 | unix: &format!(r"{} --install-extension ./ra-lsp-0.0.1.vsix --force", code_binary), | 110 | unix: &format!(r"{} --install-extension ./rust-analyzer-0.1.0.vsix --force", code_binary), |
111 | windows: &format!( | 111 | windows: &format!( |
112 | r"cmd.exe /c {}.cmd --install-extension ./ra-lsp-0.0.1.vsix --force", | 112 | r"cmd.exe /c {}.cmd --install-extension ./rust-analyzer-0.1.0.vsix --force", |
113 | code_binary | 113 | code_binary |
114 | ), | 114 | ), |
115 | work_dir: "./editors/code", | 115 | work_dir: "./editors/code", |
116 | } | 116 | } |
117 | .run()?; | 117 | .run()?; |
118 | 118 | ||
119 | let output = Cmd { | 119 | let installed_extensions = { |
120 | unix: &format!(r"{} --list-extensions", code_binary), | 120 | let output = Cmd { |
121 | windows: &format!(r"cmd.exe /c {}.cmd --list-extensions", code_binary), | 121 | unix: &format!(r"{} --list-extensions", code_binary), |
122 | work_dir: ".", | 122 | windows: &format!(r"cmd.exe /c {}.cmd --list-extensions", code_binary), |
123 | } | 123 | work_dir: ".", |
124 | .run_with_output()?; | 124 | } |
125 | .run_with_output()?; | ||
126 | String::from_utf8(output.stdout)? | ||
127 | }; | ||
125 | 128 | ||
126 | if !str::from_utf8(&output.stdout)?.contains("ra-lsp") { | 129 | if !installed_extensions.contains("rust-analyzer") { |
127 | anyhow::bail!( | 130 | anyhow::bail!( |
128 | "Could not install the Visual Studio Code extension. \ | 131 | "Could not install the Visual Studio Code extension. \ |
129 | Please make sure you have at least NodeJS 10.x together with the latest version of VS Code installed and try again." | 132 | Please make sure you have at least NodeJS 10.x together with the latest version of VS Code installed and try again." |
130 | ); | 133 | ); |
131 | } | 134 | } |
132 | 135 | ||
136 | if installed_extensions.contains("ra-lsp") { | ||
137 | Cmd { | ||
138 | unix: &format!(r"{} --uninstall-extension matklad.ra-lsp", code_binary), | ||
139 | windows: &format!( | ||
140 | r"cmd.exe /c {}.cmd --uninstall-extension matklad.ra-lsp", | ||
141 | code_binary | ||
142 | ), | ||
143 | work_dir: "./editors/code", | ||
144 | } | ||
145 | .run()?; | ||
146 | } | ||
147 | |||
133 | Ok(()) | 148 | Ok(()) |
134 | } | 149 | } |
135 | 150 | ||