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 47
47
{
48
48
"command" : " command-server.runCommand" ,
49
49
"key" : " ctrl+shift+f17" ,
50
- "mac" : " cmd+shift+f17"
50
+ "mac" : " cmd+shift+f17" ,
51
+ "args" : " other"
51
52
},
52
53
{
53
54
"command" : " command-server.runCommand" ,
54
55
"key" : " ctrl+shift+alt+p" ,
55
- "mac" : " cmd+shift+alt+p"
56
+ "mac" : " cmd+shift+alt+p" ,
57
+ "args" : " other"
56
58
},
57
59
{
58
60
"command" : " command-server.runCommand" ,
Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ export default class CommandRunner {
65
65
66
66
const warnings = [ ] ;
67
67
68
+ let commandPromise : Thenable < unknown > | undefined ;
69
+
68
70
try {
69
71
if ( ! vscode . window . state . focused ) {
70
72
if ( this . backgroundWindowProtection ) {
@@ -82,7 +84,7 @@ export default class CommandRunner {
82
84
throw new Error ( "Command in denyList" ) ;
83
85
}
84
86
85
- const commandPromise = vscode . commands . executeCommand ( commandId , ...args ) ;
87
+ commandPromise = vscode . commands . executeCommand ( commandId , ...args ) ;
86
88
87
89
let commandReturnValue = null ;
88
90
@@ -107,5 +109,9 @@ export default class CommandRunner {
107
109
}
108
110
109
111
await this . io . closeResponse ( ) ;
112
+
113
+ if ( commandPromise != null ) {
114
+ await commandPromise ;
115
+ }
110
116
}
111
117
}
Original file line number Diff line number Diff line change @@ -14,14 +14,15 @@ export async function activate(context: vscode.ExtensionContext) {
14
14
context . subscriptions . push (
15
15
vscode . commands . registerCommand (
16
16
"command-server.runCommand" ,
17
- ( focusedElementType_ ? : FocusedElementType ) => {
17
+ async ( focusedElementType_ : FocusedElementType ) => {
18
18
focusedElementType = focusedElementType_ ;
19
- return commandRunner . runCommand ( ) ;
19
+ await commandRunner . runCommand ( ) ;
20
+ focusedElementType = undefined ;
20
21
}
21
22
) ,
22
23
vscode . commands . registerCommand (
23
24
"command-server.getFocusedElementType" ,
24
- ( ) => focusedElementType ?? null
25
+ ( ) => focusedElementType
25
26
)
26
27
) ;
27
28
Original file line number Diff line number Diff line change @@ -55,4 +55,4 @@ export interface Response {
55
55
/**
56
56
* The type of the focused element in vscode at the moment of the command being executed.
57
57
*/
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