Skip to content

Commit

Permalink
Prevent verification as tests UI from becoming unresponsive (#421)
Browse files Browse the repository at this point in the history
### Changes

Use a try/finally to ensure the finally code runs. If it doesn't run the
whole verification as tests UI gets stuck

### Testing

Manual testing for now.
  • Loading branch information
keyboardDrummer authored Aug 22, 2023
1 parent e3f00e2 commit 40cc8b8
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/ui/verificationSymbolStatusView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,25 @@ export default class VerificationSymbolStatusView {
const runningItems: TestItem[] = [];
let outerResolve: () => void;
await this.noRunCreationInProgress;
this.noRunCreationInProgress = new Promise((resolve) => {
outerResolve = resolve;
});

const runs = items.map(item => this.languageClient.runVerification({ position: item.range!.start, textDocument: { uri: item.uri!.toString() } }));
for(const index in runs) {
const success = await runs[index];
if(success) {
runningItems.push(items[index]);
try {
this.noRunCreationInProgress = new Promise((resolve) => {
outerResolve = resolve;
});

const runs = items.map(item => this.languageClient.runVerification({ position: item.range!.start, textDocument: { uri: item.uri!.toString() } }));
for(const index in runs) {
const success = await runs[index];
if(success) {
runningItems.push(items[index]);
}
}
}

if(runningItems.length > 0) {
this.createRun(runningItems);
if(runningItems.length > 0) {
this.createRun(runningItems);
}
} finally {
outerResolve!();
}
outerResolve!();
}, true);
return controller;
}
Expand Down

0 comments on commit 40cc8b8

Please sign in to comment.