Skip to content

Commit

Permalink
feat: display modal warning before updating project (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuisi authored Dec 22, 2023
1 parent 8d8c17e commit 918b6c7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion vscode-lean4/src/projectoperations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ export class ProjectOperationProvider implements Disposable {
const activeClient: LeanClient | undefined = this.clientProvider.getActiveClient()
if (!activeClient) {
void window.showErrorMessage('No active client.')
this.isRunningOperation = false
return
}

Expand Down Expand Up @@ -155,6 +154,13 @@ export class ProjectOperationProvider implements Disposable {
return
}

const warningMessage = `This command will update ${dependencyChoice.name} to its most recent version. It is only intended to be used by maintainers of this project. If the updated version of ${dependencyChoice.name} is incompatible with any other dependency or the code in this project, this project may not successfully build anymore. Are you sure you want to proceed?`
const warningInput = 'Proceed'
const warningChoice = await window.showWarningMessage(warningMessage, { modal: true }, warningInput)
if (warningChoice !== warningInput) {
return
}

await this.runOperation(async lakeRunner => {
const result: ExecutionResult = await lakeRunner.updateDependency(dependencyChoice.name)
if (result.exitCode === ExecutionExitCode.Cancelled) {
Expand Down

0 comments on commit 918b6c7

Please sign in to comment.