Skip to content

Commit 2dbeb35

Browse files
Merge pull request #170 from augustocdias/ignore-focus-out
Add extension setting to ignore focus out
2 parents a8a5041 + f923ecf commit 2dbeb35

7 files changed

Lines changed: 52 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## [1.20.0] 2025-12-12
4+
5+
- Add extension setting to ignore focus out (#162)
6+
37
## [1.19.1] 2025-07-02
48

59
- Fix empty string perceived when dismissing the popup (#151)

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,14 @@ There are a few limitations to be aware of:
282282
* within an input command arg you can only reference other inputs defined with `shellCommand.execute`
283283
* ensure you don't have another input with the same exact `inputs.args.command` in your tasks or launch configs as this may confuse the extension
284284

285+
## Settings
286+
287+
Settings for the extension that apply globally (not only to one task) use VSCode's settings mechanism.
288+
Click `File` -> `Preferences` -> `Settings` -> `Extensions` -> `Tasks Shell Input`.
289+
290+
Available settings are:
291+
- Ignore focus out in prompts
292+
285293
## Developing and contributing
286294

287295
Please see [./CONTRIBUTING.md](./CONTRIBUTING.md) for documentation on developing this extension.

package-lock.json

Lines changed: 20 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Tasks Shell Input",
44
"description": "Use shell commands as input for your tasks",
55
"icon": "icon.png",
6-
"version": "1.19.1",
6+
"version": "1.20.0",
77
"publisher": "augustocdias",
88
"repository": {
99
"url": "https://github.com/augustocdias/vscode-shell-command"
@@ -32,7 +32,16 @@
3232
"command": "shellCommand.execute",
3333
"title": "Execute shell command"
3434
}
35-
]
35+
],
36+
"configuration": {
37+
"properties": {
38+
"shellInput.ignoreFocusOut": {
39+
"type": "boolean",
40+
"default": false,
41+
"description": "Ignore focus out in prompts"
42+
}
43+
}
44+
}
3645
},
3746
"scripts": {
3847
"vscode:prepublish": "npm run compile",

src/extension.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ export function activate(this: any, context: vscode.ExtensionContext) {
3434
const handlePromptString = async () => {
3535
vscode.window.showWarningMessage(
3636
'shellCommand.promptString is deprecated. Please use `${prompt}`.');
37-
const inputValue = await vscode.window.showInputBox();
37+
const config = vscode.workspace.getConfiguration("shellInput");
38+
const ignoreFocusOut = config.get<boolean>("ignoreFocusOut") || false;
39+
const inputValue = await vscode.window.showInputBox({ ignoreFocusOut });
3840

3941
return inputValue || '';
4042
};

src/lib/CommandHandler.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ export class CommandHandler {
290290
picker.canSelectMany = this.args.multiselect!;
291291
picker.matchOnDescription = true;
292292
picker.matchOnDetail = true;
293+
const config = vscode.workspace.getConfiguration("shellInput");
294+
picker.ignoreFocusOut =
295+
config.get<boolean>("ignoreFocusOut") || false;
293296

294297
if (this.args.description !== undefined) {
295298
picker.placeholder = this.args.description;

src/lib/VariableResolver.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,13 @@ export class VariableResolver {
142142
const promptId = `prompt/${taskId}_${match.index}`;
143143
const prevValue = this.context.workspaceState.get<string>(promptId, '');
144144
const initialValue = promptOptions.rememberPrevious ? prevValue : '';
145+
const config = vscode.workspace.getConfiguration("shellInput");
146+
const ignoreFocusOut = config.get<boolean>("ignoreFocusOut") || false;
145147

146148
const result = (await vscode.window.showInputBox({
147149
value: initialValue,
148150
prompt: promptOptions.prompt,
151+
ignoreFocusOut,
149152
})) ?? '';
150153

151154
this.context.workspaceState.update(promptId, result);

0 commit comments

Comments
 (0)