Skip to content

Commit

Permalink
test: don't show modal dialogs in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuisi committed Oct 18, 2023
1 parent e14d04b commit 5cab99c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions vscode-lean4/src/utils/clientProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class LeanClientProvider implements Disposable {
this.subscriptions.push(
commands.registerCommand('lean4.restartFile', () => this.restartFile()),
commands.registerCommand('lean4.refreshFileDependencies', () => this.restartFile()),
commands.registerCommand('lean4.restartServer', () => this.restartActiveClient()),
commands.registerCommand('lean4.restartServer', showDialog => this.restartActiveClient(showDialog ?? true)),
commands.registerCommand('lean4.stopServer', () => this.stopActiveClient())
);

Expand Down Expand Up @@ -155,7 +155,12 @@ export class LeanClientProvider implements Disposable {
}
}

private async restartActiveClient() {
private async restartActiveClient(showDialog: boolean = true) {
if (!showDialog) {
void this.activeClient?.restart();
return
}

const result: string | undefined = await window.showInformationMessage(
'Restart Lean 4 server to re-elaborate all open files?',
{ modal: true },
Expand Down
2 changes: 1 addition & 1 deletion vscode-lean4/test/suite/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ export async function restartLeanServer(client: LeanClient, retries=60, delay=10
client.restarted(() => { stateChanges.push('restarted'); });
client.serverFailed(() => { stateChanges.push('failed'); });

await vscode.commands.executeCommand('lean4.restartServer');
await vscode.commands.executeCommand('lean4.restartServer', false);

while (count < retries){
const index = stateChanges.indexOf('restarted');
Expand Down

0 comments on commit 5cab99c

Please sign in to comment.