Skip to content

Commit 135a8d9

Browse files
committed
Auto merge of #16416 - Young-Flash:cargo_ext_detect, r=lnicola
internal: VS Code: report conflict with `panicbit.cargo` <img width="359" alt="notification" src="https://github.com/rust-lang/rust-analyzer/assets/71162630/420b9f34-ba73-4436-b868-6cd87c62287d"> related to rust-lang/rust-analyzer#16392
2 parents 3afa6b1 + 4facb62 commit 135a8d9

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

editors/code/src/main.ts

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,7 @@ export async function deactivate() {
2525
export async function activate(
2626
context: vscode.ExtensionContext,
2727
): Promise<RustAnalyzerExtensionApi> {
28-
if (vscode.extensions.getExtension("rust-lang.rust")) {
29-
vscode.window
30-
.showWarningMessage(
31-
`You have both the rust-analyzer (rust-lang.rust-analyzer) and Rust (rust-lang.rust) ` +
32-
"plugins enabled. These are known to conflict and cause various functions of " +
33-
"both plugins to not work correctly. You should disable one of them.",
34-
"Got it",
35-
)
36-
.then(() => {}, console.error);
37-
}
28+
checkConflictingExtensions();
3829

3930
const ctx = new Ctx(context, createCommands(), fetchWorkspace());
4031
// VS Code doesn't show a notification when an extension fails to activate
@@ -200,3 +191,26 @@ function createCommands(): Record<string, CommandFactory> {
200191
revealDependency: { enabled: commands.revealDependency },
201192
};
202193
}
194+
195+
function checkConflictingExtensions() {
196+
if (vscode.extensions.getExtension("rust-lang.rust")) {
197+
vscode.window
198+
.showWarningMessage(
199+
`You have both the rust-analyzer (rust-lang.rust-analyzer) and Rust (rust-lang.rust) ` +
200+
"plugins enabled. These are known to conflict and cause various functions of " +
201+
"both plugins to not work correctly. You should disable one of them.",
202+
"Got it",
203+
)
204+
.then(() => {}, console.error);
205+
}
206+
207+
if (vscode.extensions.getExtension("panicbit.cargo")) {
208+
vscode.window
209+
.showWarningMessage(
210+
`You have both the rust-analyzer (rust-lang.rust-analyzer) and Cargo (panicbit.cargo) plugins enabled` +
211+
'you can disable it or set {"cargo.automaticCheck": false} in settings.json to avoid invoking cargo twice',
212+
"Got it",
213+
)
214+
.then(() => {}, console.error);
215+
}
216+
}

0 commit comments

Comments
 (0)