We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4ff9df2 commit 1add030Copy full SHA for 1add030
src/common/window.apis.ts
@@ -255,8 +255,17 @@ export async function showInputBoxWithButtons(
255
inputBox.hide();
256
}
257
}),
258
- inputBox.onDidAccept(() => {
+ inputBox.onDidAccept(async () => {
259
if (!deferred.completed) {
260
+ let isValid = true;
261
+ if (options?.validateInput) {
262
+ const validation = await options.validateInput(inputBox.value);
263
+ isValid = validation === null || validation === undefined;
264
+ if (!isValid) {
265
+ inputBox.validationMessage = typeof validation === 'string' ? validation : 'Invalid input';
266
+ return; // Do not resolve, keep the input box open
267
+ }
268
269
deferred.resolve(inputBox.value);
270
271
0 commit comments