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.ts34
1 files changed, 23 insertions, 11 deletions
diff --git a/editors/code/src/main.ts b/editors/code/src/main.ts
index 4b2d3c8a5..282240d84 100644
--- a/editors/code/src/main.ts
+++ b/editors/code/src/main.ts
@@ -131,7 +131,7 @@ async function tryActivate(context: vscode.ExtensionContext) {
131 ctx.pushCleanup(activateTaskProvider(workspaceFolder, ctx.config)); 131 ctx.pushCleanup(activateTaskProvider(workspaceFolder, ctx.config));
132 132
133 activateInlayHints(ctx); 133 activateInlayHints(ctx);
134 warnAboutRustLangExtensionConflict(); 134 warnAboutExtensionConflicts();
135 135
136 vscode.workspace.onDidChangeConfiguration( 136 vscode.workspace.onDidChangeConfiguration(
137 _ => ctx?.client?.sendNotification('workspace/didChangeConfiguration', { settings: "" }), 137 _ => ctx?.client?.sendNotification('workspace/didChangeConfiguration', { settings: "" }),
@@ -287,12 +287,14 @@ async function getServer(config: Config, state: PersistentState): Promise<string
287 if (config.package.releaseTag === null) return "rust-analyzer"; 287 if (config.package.releaseTag === null) return "rust-analyzer";
288 288
289 let platform: string | undefined; 289 let platform: string | undefined;
290 if (process.arch === "x64" || process.arch === "ia32") { 290 if ((process.arch === "x64" || process.arch === "ia32") && process.platform === "win32") {
291 if (process.platform === "linux") platform = "linux"; 291 platform = "x86_64-pc-windows-msvc";
292 if (process.platform === "darwin") platform = "mac"; 292 } else if (process.arch === "x64" && process.platform === "linux") {
293 if (process.platform === "win32") platform = "windows"; 293 platform = "x86_64-unknown-linux-gnu";
294 } else if (process.arch === "x64" && process.platform === "darwin") {
295 platform = "x86_64-apple-darwin";
294 } else if (process.arch === "arm64" && process.platform === "darwin") { 296 } else if (process.arch === "arm64" && process.platform === "darwin") {
295 platform = "mac"; 297 platform = "aarch64-apple-darwin";
296 } 298 }
297 if (platform === undefined) { 299 if (platform === undefined) {
298 vscode.window.showErrorMessage( 300 vscode.window.showErrorMessage(
@@ -305,7 +307,7 @@ async function getServer(config: Config, state: PersistentState): Promise<string
305 ); 307 );
306 return undefined; 308 return undefined;
307 } 309 }
308 const ext = platform === "windows" ? ".exe" : ""; 310 const ext = platform.indexOf("-windows-") !== -1 ? ".exe" : "";
309 const dest = path.join(config.globalStoragePath, `rust-analyzer-${platform}${ext}`); 311 const dest = path.join(config.globalStoragePath, `rust-analyzer-${platform}${ext}`);
310 const exists = await fs.stat(dest).then(() => true, () => false); 312 const exists = await fs.stat(dest).then(() => true, () => false);
311 if (!exists) { 313 if (!exists) {
@@ -411,11 +413,21 @@ async function queryForGithubToken(state: PersistentState): Promise<void> {
411 } 413 }
412} 414}
413 415
414function warnAboutRustLangExtensionConflict() { 416function warnAboutExtensionConflicts() {
415 const rustLangExt = vscode.extensions.getExtension("rust-lang.rust"); 417 const conflicting = [
416 if (rustLangExt !== undefined) { 418 ["rust-analyzer", "matklad.rust-analyzer"],
419 ["Rust", "rust-lang.rust"],
420 ["Rust", "kalitaalexey.vscode-rust"],
421 ];
422
423 const found = conflicting.filter(
424 nameId => vscode.extensions.getExtension(nameId[1]) !== undefined);
425
426 if (found.length > 1) {
427 const fst = found[0];
428 const sec = found[1];
417 vscode.window.showWarningMessage( 429 vscode.window.showWarningMessage(
418 "You have both rust-analyzer (matklad.rust-analyzer) and Rust (rust-lang.rust) " + 430 `You have both the ${fst[0]} (${fst[1]}) and ${sec[0]} (${sec[1]}) ` +
419 "plugins enabled. These are known to conflict and cause various functions of " + 431 "plugins enabled. These are known to conflict and cause various functions of " +
420 "both plugins to not work correctly. You should disable one of them.", "Got it"); 432 "both plugins to not work correctly. You should disable one of them.", "Got it");
421 }; 433 };