Skip to content

Commit 9a73bf2

Browse files
committed
Merge branch 'topic/vscode-spark-picker' into 'master'
Prevent the GNATprove option picker from waiting infinitely in testing See merge request eng/ide/ada_language_server!2098
2 parents 62b9e5c + ff89ac3 commit 9a73bf2

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

integration/vscode/ada/.vscode-test.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ import * as dotenv from 'dotenv';
77
dotenv.config({ override: true });
88
// console.log(process.env);
99

10+
/**
11+
* Set this env variable to tell the VS Code extension we are running in a
12+
* testing environment
13+
*/
14+
process.env['ALS_VSCODE_TEST_ENV'] = '1';
15+
1016
let baseMochaOptions = {
1117
ui: 'tdd',
1218
color: true,

integration/vscode/ada/src/helpers.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,3 +712,9 @@ export function getMatchingPrefixes(
712712

713713
return [prefix1, prefix2];
714714
}
715+
716+
/**
717+
* This constant indicates whether the code is running in a testing
718+
* environment.
719+
*/
720+
export const inTesting = process.env['ALS_VSCODE_TEST_ENV'] === '1';

integration/vscode/ada/src/multiStepInput.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
QuickPickItem,
2222
window,
2323
} from 'vscode';
24+
import { inTesting } from './helpers';
2425

2526
// -------------------------------------------------------
2627
// Helper code that wraps the API for the multi-step case.
@@ -183,6 +184,19 @@ export class MultiStepInput {
183184
}
184185
this.current = input;
185186
this.current.show();
187+
188+
if (inTesting) {
189+
/**
190+
* In testing, do not wait for User selection and return
191+
* the default selections immediately.
192+
*/
193+
this.current.hide();
194+
if (canSelectMany) {
195+
resolve(<any>input.selectedItems.concat());
196+
} else {
197+
resolve(<any>input.selectedItems[0]);
198+
}
199+
}
186200
});
187201
} finally {
188202
disposables.forEach((d) => d.dispose());

0 commit comments

Comments
 (0)