Skip to content

Commit 5506933

Browse files
bors[bot]Przemyslaw Horbanextremegf
authored
Merge #7002
7002: Extension conflict check detects more combinations r=extremegf a=extremegf This will also detect conflicts with kalitaalexey.vscode-rust and work correctly after RA is integrated with rust-lang.rust extension. Co-authored-by: Przemyslaw Horban <[email protected]> Co-authored-by: P. Horban <[email protected]>
2 parents 013739c + 92b13d2 commit 5506933

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

editors/code/src/main.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ async function tryActivate(context: vscode.ExtensionContext) {
131131
ctx.pushCleanup(activateTaskProvider(workspaceFolder, ctx.config));
132132

133133
activateInlayHints(ctx);
134-
warnAboutRustLangExtensionConflict();
134+
warnAboutExtensionConflicts();
135135

136136
vscode.workspace.onDidChangeConfiguration(
137137
_ => ctx?.client?.sendNotification('workspace/didChangeConfiguration', { settings: "" }),
@@ -411,11 +411,21 @@ async function queryForGithubToken(state: PersistentState): Promise<void> {
411411
}
412412
}
413413

414-
function warnAboutRustLangExtensionConflict() {
415-
const rustLangExt = vscode.extensions.getExtension("rust-lang.rust");
416-
if (rustLangExt !== undefined) {
414+
function warnAboutExtensionConflicts() {
415+
const conflicting = [
416+
["rust-analyzer", "matklad.rust-analyzer"],
417+
["Rust", "rust-lang.rust"],
418+
["Rust", "kalitaalexey.vscode-rust"],
419+
];
420+
421+
const found = conflicting.filter(
422+
nameId => vscode.extensions.getExtension(nameId[1]) !== undefined);
423+
424+
if (found.length > 1) {
425+
const fst = found[0];
426+
const sec = found[1];
417427
vscode.window.showWarningMessage(
418-
"You have both rust-analyzer (matklad.rust-analyzer) and Rust (rust-lang.rust) " +
428+
`You have both the ${fst[0]} (${fst[1]}) and ${sec[0]} (${sec[1]}) ` +
419429
"plugins enabled. These are known to conflict and cause various functions of " +
420430
"both plugins to not work correctly. You should disable one of them.", "Got it");
421431
};

0 commit comments

Comments
 (0)