aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/main.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/main.ts')
-rw-r--r--editors/code/src/main.ts25
1 files changed, 19 insertions, 6 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 670f2ebfd..12b4d0510 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -43,12 +43,16 @@ export async function activate(context: vscode.ExtensionContext) {
43 const config = new Config(context); 43 const config = new Config(context);
44 const state = new PersistentState(context.globalState); 44 const state = new PersistentState(context.globalState);
45 const serverPath = await bootstrap(config, state).catch(err => { 45 const serverPath = await bootstrap(config, state).catch(err => {
46 let message = "Failed to bootstrap rust-analyzer."; 46 let message = "bootstrap error. ";
47
47 if (err.code === "EBUSY" || err.code === "ETXTBSY") { 48 if (err.code === "EBUSY" || err.code === "ETXTBSY") {
48 message += " Other vscode windows might be using rust-analyzer, " + 49 message += "Other vscode windows might be using rust-analyzer, ";
49 "you should close them and reload this window to retry."; 50 message += "you should close them and reload this window to retry. ";
50 } 51 }
51 message += " Open \"Help > Toggle Developer Tools > Console\" to see the logs"; 52
53 message += 'Open "Help > Toggle Developer Tools > Console" to see the logs ';
54 message += '(enable verbose logs with "rust-analyzer.trace.extension")';
55
52 log.error("Bootstrap error", err); 56 log.error("Bootstrap error", err);
53 throw new Error(message); 57 throw new Error(message);
54 }); 58 });
@@ -178,7 +182,11 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi
178 assert(!!artifact, `Bad release: ${JSON.stringify(release)}`); 182 assert(!!artifact, `Bad release: ${JSON.stringify(release)}`);
179 183
180 const dest = path.join(config.globalStoragePath, "rust-analyzer.vsix"); 184 const dest = path.join(config.globalStoragePath, "rust-analyzer.vsix");
181 await download(artifact.browser_download_url, dest, "Downloading rust-analyzer extension"); 185 await download({
186 url: artifact.browser_download_url,
187 dest,
188 progressTitle: "Downloading rust-analyzer extension",
189 });
182 190
183 await vscode.commands.executeCommand("workbench.extensions.installExtension", vscode.Uri.file(dest)); 191 await vscode.commands.executeCommand("workbench.extensions.installExtension", vscode.Uri.file(dest));
184 await fs.unlink(dest); 192 await fs.unlink(dest);
@@ -299,7 +307,12 @@ async function getServer(config: Config, state: PersistentState): Promise<string
299 if (err.code !== "ENOENT") throw err; 307 if (err.code !== "ENOENT") throw err;
300 }); 308 });
301 309
302 await download(artifact.browser_download_url, dest, "Downloading rust-analyzer server", { mode: 0o755 }); 310 await download({
311 url: artifact.browser_download_url,
312 dest,
313 progressTitle: "Downloading rust-analyzer server",
314 mode: 0o755
315 });
303 316
304 // Patching executable if that's NixOS. 317 // Patching executable if that's NixOS.
305 if (await fs.stat("/etc/nixos").then(_ => true).catch(_ => false)) { 318 if (await fs.stat("/etc/nixos").then(_ => true).catch(_ => false)) {