Skip to content

Commit

Permalink
Auto merge of #16416 - Young-Flash:cargo_ext_detect, r=lnicola
Browse files Browse the repository at this point in the history
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 #16392
  • Loading branch information
bors committed Feb 1, 2024
2 parents 3afa6b1 + 4facb62 commit 135a8d9
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions editors/code/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,7 @@ export async function deactivate() {
export async function activate(
context: vscode.ExtensionContext,
): Promise<RustAnalyzerExtensionApi> {
if (vscode.extensions.getExtension("rust-lang.rust")) {
vscode.window
.showWarningMessage(
`You have both the rust-analyzer (rust-lang.rust-analyzer) and Rust (rust-lang.rust) ` +
"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",
)
.then(() => {}, console.error);
}
checkConflictingExtensions();

const ctx = new Ctx(context, createCommands(), fetchWorkspace());
// VS Code doesn't show a notification when an extension fails to activate
Expand Down Expand Up @@ -200,3 +191,26 @@ function createCommands(): Record<string, CommandFactory> {
revealDependency: { enabled: commands.revealDependency },
};
}

function checkConflictingExtensions() {
if (vscode.extensions.getExtension("rust-lang.rust")) {
vscode.window
.showWarningMessage(
`You have both the rust-analyzer (rust-lang.rust-analyzer) and Rust (rust-lang.rust) ` +
"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",
)
.then(() => {}, console.error);
}

if (vscode.extensions.getExtension("panicbit.cargo")) {
vscode.window
.showWarningMessage(
`You have both the rust-analyzer (rust-lang.rust-analyzer) and Cargo (panicbit.cargo) plugins enabled` +
'you can disable it or set {"cargo.automaticCheck": false} in settings.json to avoid invoking cargo twice',
"Got it",
)
.then(() => {}, console.error);
}
}

0 comments on commit 135a8d9

Please sign in to comment.