]> git.lizzy.rs Git - rust.git/commitdiff
Extension conflict check detests more combinations
authorPrzemyslaw Horban <p.horban@invinets.com>
Tue, 22 Dec 2020 14:52:41 +0000 (15:52 +0100)
committerPrzemyslaw Horban <p.horban@invinets.com>
Tue, 22 Dec 2020 14:53:00 +0000 (15:53 +0100)
editors/code/src/main.ts

index 4b2d3c8a55791dee5417944e251b51d4a62fcbbc..601ed67a7d91120c00ce485aef2cf326de23ab32 100644 (file)
@@ -131,7 +131,7 @@ async function tryActivate(context: vscode.ExtensionContext) {
     ctx.pushCleanup(activateTaskProvider(workspaceFolder, ctx.config));
 
     activateInlayHints(ctx);
-    warnAboutRustLangExtensionConflict();
+    warnAboutExtensionConflicts();
 
     vscode.workspace.onDidChangeConfiguration(
         _ => ctx?.client?.sendNotification('workspace/didChangeConfiguration', { settings: "" }),
@@ -411,11 +411,21 @@ async function queryForGithubToken(state: PersistentState): Promise<void> {
     }
 }
 
-function warnAboutRustLangExtensionConflict() {
-    const rustLangExt = vscode.extensions.getExtension("rust-lang.rust");
-    if (rustLangExt !== undefined) {
+function warnAboutExtensionConflicts() {
+    const conflicting = [
+        ["rust-analyzer", "matklad.rust-analyzer"],
+        ["Rust", "rust-lang.rust"],
+        ["Rust", "kalitaalexey.vscode-rust"],
+    ];
+
+    const found = conflicting.filter(
+        nameId => vscode.extensions.getExtension(nameId[1]) !== undefined);
+
+    if (found.length > 1) {
+        const fst = found[0];
+        const sec = found[1];
         vscode.window.showWarningMessage(
-            "You have both rust-analyzer (matklad.rust-analyzer) and Rust (rust-lang.rust) " +
+            `You have both ${fst[0]} (${fst[1]}) and ${sec[0]} (${sec[1]}) ` +
             "plugins enabled. These are known to conflict and cause various functions of " +
             "both plugins to not work correctly. You should disable one of them.", "Got it");
     };