mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-14 06:15:27 +00:00
minor: update conflict extension detect logic
This commit is contained in:
parent
56f54c87e7
commit
96ebad0409
1 changed files with 9 additions and 17 deletions
|
@ -25,7 +25,7 @@ export async function deactivate() {
|
||||||
export async function activate(
|
export async function activate(
|
||||||
context: vscode.ExtensionContext,
|
context: vscode.ExtensionContext,
|
||||||
): Promise<RustAnalyzerExtensionApi> {
|
): Promise<RustAnalyzerExtensionApi> {
|
||||||
conflictExtDetect();
|
checkConflictingExtensions();
|
||||||
|
|
||||||
const ctx = new Ctx(context, createCommands(), fetchWorkspace());
|
const ctx = new Ctx(context, createCommands(), fetchWorkspace());
|
||||||
// VS Code doesn't show a notification when an extension fails to activate
|
// VS Code doesn't show a notification when an extension fails to activate
|
||||||
|
@ -192,7 +192,7 @@ function createCommands(): Record<string, CommandFactory> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function conflictExtDetect() {
|
function checkConflictingExtensions() {
|
||||||
if (vscode.extensions.getExtension("rust-lang.rust")) {
|
if (vscode.extensions.getExtension("rust-lang.rust")) {
|
||||||
vscode.window
|
vscode.window
|
||||||
.showWarningMessage(
|
.showWarningMessage(
|
||||||
|
@ -205,20 +205,12 @@ function conflictExtDetect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vscode.extensions.getExtension("panicbit.cargo")) {
|
if (vscode.extensions.getExtension("panicbit.cargo")) {
|
||||||
const isRustAnalyzerCheckOnSave = vscode.workspace
|
vscode.window
|
||||||
.getConfiguration("rust-analyzer")
|
.showWarningMessage(
|
||||||
.get("checkOnSave");
|
`You have both the rust-analyzer (rust-lang.rust-analyzer) and Cargo (panicbit.cargo) ` +
|
||||||
const isCargoAutomaticCheck = vscode.workspace
|
'you can disable it or set {"cargo.automaticCheck": false} in settings.json to avoid invoking cargo twice',
|
||||||
.getConfiguration("cargo")
|
"Got it",
|
||||||
.get("automaticCheck");
|
)
|
||||||
if (isRustAnalyzerCheckOnSave && isCargoAutomaticCheck) {
|
.then(() => {}, console.error);
|
||||||
vscode.window
|
|
||||||
.showWarningMessage(
|
|
||||||
`You have Cargo (panicbit.cargo) enabled with 'cargo.automaticCheck' set to true(default), ` +
|
|
||||||
'you can disable it or set {"cargo.automaticCheck": false} in settings.json to avoid invoke cargo twice',
|
|
||||||
"Got it",
|
|
||||||
)
|
|
||||||
.then(() => {}, console.error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue