diff --git a/package.json b/package.json index 172c83b..7132efa 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,18 @@ "command": "shellCommand.execute", "title": "Execute shell command" } - ] + ], + "configuration": { + "title": "Tasks Shell Input", + "type": "object", + "properties": { + "shellCommand.ignoreFocusOut": { + "type": "boolean", + "default": "true", + "description": "keep input boxes open when focus moves to another part of the editor" + } + } + } }, "scripts": { "vscode:prepublish": "npm run compile", diff --git a/src/extension.ts b/src/extension.ts index 376a4b7..8318900 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -34,7 +34,8 @@ export function activate(this: any, context: vscode.ExtensionContext) { const handlePromptString = async () => { vscode.window.showWarningMessage( 'shellCommand.promptString is deprecated. Please use `${prompt}`.'); - const inputValue = await vscode.window.showInputBox(); + const ignoreFocusOut = vscode.workspace.getConfiguration('shellCommand').get('ignoreFocusOut'); + const inputValue = await vscode.window.showInputBox({ ignoreFocusOut }); return inputValue || ''; }; diff --git a/src/lib/VariableResolver.ts b/src/lib/VariableResolver.ts index e8ea43e..9fa916f 100644 --- a/src/lib/VariableResolver.ts +++ b/src/lib/VariableResolver.ts @@ -143,9 +143,11 @@ export class VariableResolver { const prevValue = this.context.workspaceState.get(promptId, ''); const initialValue = promptOptions.rememberPrevious ? prevValue : ''; + const ignoreFocusOut = vscode.workspace.getConfiguration('shellCommand').get('ignoreFocusOut'); const result = (await vscode.window.showInputBox({ value: initialValue, prompt: promptOptions.prompt, + ignoreFocusOut, })) ?? ''; this.context.workspaceState.update(promptId, result);