File tree Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Expand file tree Collapse file tree 4 files changed +16
-7
lines changed Original file line number Diff line number Diff line change 4747 {
4848 "command" : " command-server.runCommand" ,
4949 "key" : " ctrl+shift+f17" ,
50- "mac" : " cmd+shift+f17"
50+ "mac" : " cmd+shift+f17" ,
51+ "args" : " other"
5152 },
5253 {
5354 "command" : " command-server.runCommand" ,
5455 "key" : " ctrl+shift+alt+p" ,
55- "mac" : " cmd+shift+alt+p"
56+ "mac" : " cmd+shift+alt+p" ,
57+ "args" : " other"
5658 },
5759 {
5860 "command" : " command-server.runCommand" ,
Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ export default class CommandRunner {
6565
6666 const warnings = [ ] ;
6767
68+ let commandPromise : Thenable < unknown > | undefined ;
69+
6870 try {
6971 if ( ! vscode . window . state . focused ) {
7072 if ( this . backgroundWindowProtection ) {
@@ -82,7 +84,7 @@ export default class CommandRunner {
8284 throw new Error ( "Command in denyList" ) ;
8385 }
8486
85- const commandPromise = vscode . commands . executeCommand ( commandId , ...args ) ;
87+ commandPromise = vscode . commands . executeCommand ( commandId , ...args ) ;
8688
8789 let commandReturnValue = null ;
8890
@@ -107,5 +109,9 @@ export default class CommandRunner {
107109 }
108110
109111 await this . io . closeResponse ( ) ;
112+
113+ if ( commandPromise != null ) {
114+ await commandPromise ;
115+ }
110116 }
111117}
Original file line number Diff line number Diff line change @@ -14,14 +14,15 @@ export async function activate(context: vscode.ExtensionContext) {
1414 context . subscriptions . push (
1515 vscode . commands . registerCommand (
1616 "command-server.runCommand" ,
17- ( focusedElementType_ ? : FocusedElementType ) => {
17+ async ( focusedElementType_ : FocusedElementType ) => {
1818 focusedElementType = focusedElementType_ ;
19- return commandRunner . runCommand ( ) ;
19+ await commandRunner . runCommand ( ) ;
20+ focusedElementType = undefined ;
2021 }
2122 ) ,
2223 vscode . commands . registerCommand (
2324 "command-server.getFocusedElementType" ,
24- ( ) => focusedElementType ?? null
25+ ( ) => focusedElementType
2526 )
2627 ) ;
2728
Original file line number Diff line number Diff line change @@ -55,4 +55,4 @@ export interface Response {
5555/**
5656 * The type of the focused element in vscode at the moment of the command being executed.
5757 */
58- export type FocusedElementType = "textEditor" | "terminal" ;
58+ export type FocusedElementType = "textEditor" | "terminal" | "other" ;
You can’t perform that action at this time.
0 commit comments