diff --git a/meta.ts b/meta.ts index 0a1723d6..5b0dfbbc 100644 --- a/meta.ts +++ b/meta.ts @@ -539,7 +539,7 @@ export function parseKeys(keys: string) { case "prompt": assert(!negate); whenClauses.splice(whenClauses.indexOf("editorTextFocus"), 1); - whenClauses.push("inputFocus && !textInputFocus"); + whenClauses.push("inputFocus && dance.inPrompt"); break; default: { diff --git a/package.build.ts b/package.build.ts index e73d6b58..754d0dd0 100644 --- a/package.build.ts +++ b/package.build.ts @@ -78,7 +78,7 @@ const selectionDecorationType = { // ============================================================================ const version = "0.5.14", - preRelease = 2; + preRelease = 3; export const pkg = (modules: Builder.ParsedModule[]) => ({ diff --git a/package.json b/package.json index ab046d93..2a181453 100644 --- a/package.json +++ b/package.json @@ -32,8 +32,8 @@ "vscode:prepublish": "yarn run generate && yarn run compile && yarn run compile-web", "package": "vsce package --allow-star-activation", "publish": "vsce publish --allow-star-activation", - "package:pre": "vsce package --allow-star-activation --pre-release --no-git-tag-version --no-update-package-json 0.5.14002", - "publish:pre": "vsce publish --allow-star-activation --pre-release --no-git-tag-version --no-update-package-json 0.5.14002" + "package:pre": "vsce package --allow-star-activation --pre-release --no-git-tag-version --no-update-package-json 0.5.14003", + "publish:pre": "vsce publish --allow-star-activation --pre-release --no-git-tag-version --no-update-package-json 0.5.14003" }, "devDependencies": { "@types/glob": "^7.2.0", @@ -3047,7 +3047,7 @@ }, { "key": "Up", - "when": "inputFocus && !textInputFocus", + "when": "inputFocus && dance.inPrompt", "command": "dance.changeInput", "args": { "action": "previous" @@ -3055,7 +3055,7 @@ }, { "key": "Down", - "when": "inputFocus && !textInputFocus", + "when": "inputFocus && dance.inPrompt", "command": "dance.changeInput", "args": { "action": "next" diff --git a/src/api/prompt.ts b/src/api/prompt.ts index 8ed14390..c9f5df00 100644 --- a/src/api/prompt.ts +++ b/src/api/prompt.ts @@ -57,6 +57,9 @@ export function prompt( }); } + const contextKey = "dance.inPrompt"; + const setContextPromise = vscode.commands.executeCommand("setContext", contextKey, true); + const disposables = [ inputBox, inputBox.onDidChangeValue(updateAndValidateValue), @@ -100,6 +103,10 @@ export function prompt( inputBox.onDidHide(() => { disposables.forEach((d) => d.dispose()); + setContextPromise.then(() => + vscode.commands.executeCommand("setContext", contextKey, false), + ); + const reason = context.cancellationToken?.isCancellationRequested ? CancellationError.Reason.CancellationToken : CancellationError.Reason.PressedEscape;