@@ -11,16 +11,19 @@ import { localize, localize2 } from '../../../../../nls.js';
11
11
import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from '../../../../../platform/accessibility/common/accessibility.js' ;
12
12
import { ContextKeyExpr , type ContextKeyExpression } from '../../../../../platform/contextkey/common/contextkey.js' ;
13
13
import type { ServicesAccessor } from '../../../../../platform/instantiation/common/instantiation.js' ;
14
- import { KeybindingsRegistry , type IKeybindings , KeybindingWeight } from '../../../../../platform/keybinding/common/keybindingsRegistry.js' ;
15
- import { IQuickInputService , type QuickPickItem } from '../../../../../platform/quickinput/common/quickInput.js' ;
14
+ import { KeybindingsRegistry , KeybindingWeight , type IKeybindings } from '../../../../../platform/keybinding/common/keybindingsRegistry.js' ;
15
+ import { IQuickInputService } from '../../../../../platform/quickinput/common/quickInput.js' ;
16
16
import { GeneralShellType , WindowsShellType } from '../../../../../platform/terminal/common/terminal.js' ;
17
17
import { IWorkspaceContextService } from '../../../../../platform/workspace/common/workspace.js' ;
18
18
import { IConfigurationResolverService } from '../../../../services/configurationResolver/common/configurationResolver.js' ;
19
19
import { IHistoryService } from '../../../../services/history/common/history.js' ;
20
20
import { ITerminalService } from '../../../terminal/browser/terminal.js' ;
21
21
import { registerTerminalAction } from '../../../terminal/browser/terminalActions.js' ;
22
22
import { TerminalContextKeys , TerminalContextKeyStrings } from '../../../terminal/common/terminalContextKey.js' ;
23
- import { TerminalSendCommandsCommandId } from '../common/terminal.sendCommands.js' ;
23
+
24
+ export const enum TerminalSendSequenceCommandId {
25
+ SendSequence = 'workbench.action.terminal.sendSequence' ,
26
+ }
24
27
25
28
function toOptionalString ( obj : unknown ) : string | undefined {
26
29
return isString ( obj ) ? obj : undefined ;
@@ -73,7 +76,7 @@ export const terminalSendSequenceCommand = async (accessor: ServicesAccessor, ar
73
76
74
77
const sendSequenceString = localize2 ( 'sendSequence' , "Send Sequence" ) ;
75
78
registerTerminalAction ( {
76
- id : TerminalSendCommandsCommandId . SendSequence ,
79
+ id : TerminalSendSequenceCommandId . SendSequence ,
77
80
title : sendSequenceString ,
78
81
f1 : true ,
79
82
metadata : {
@@ -95,81 +98,9 @@ registerTerminalAction({
95
98
run : ( c , accessor , args ) => terminalSendSequenceCommand ( accessor , args )
96
99
} ) ;
97
100
98
- const sendSignalString = localize2 ( 'sendSignal' , "Send Signal" ) ;
99
- registerTerminalAction ( {
100
- id : TerminalSendCommandsCommandId . SendSignal ,
101
- title : sendSignalString ,
102
- f1 : ! isWindows ,
103
- metadata : {
104
- description : sendSignalString . value ,
105
- args : [ {
106
- name : 'args' ,
107
- schema : {
108
- type : 'object' ,
109
- required : [ 'signal' ] ,
110
- properties : {
111
- signal : {
112
- description : localize ( 'sendSignal.signal.desc' , "The signal to send to the terminal process (e.g., 'SIGTERM', 'SIGINT', 'SIGKILL')" ) ,
113
- type : 'string'
114
- }
115
- } ,
116
- }
117
- } ]
118
- } ,
119
- run : async ( c , accessor , args ) => {
120
- const quickInputService = accessor . get ( IQuickInputService ) ;
121
- const instance = c . service . activeInstance ;
122
- if ( ! instance ) {
123
- return ;
124
- }
125
-
126
- let signal = isObject ( args ) && 'signal' in args ? toOptionalString ( args . signal ) : undefined ;
127
-
128
- if ( ! signal ) {
129
- const signalOptions : QuickPickItem [ ] = [
130
- { label : 'SIGINT' , description : localize ( 'SIGINT' , 'Interrupt process (Ctrl+C)' ) } ,
131
- { label : 'SIGTERM' , description : localize ( 'SIGTERM' , 'Terminate process gracefully' ) } ,
132
- { label : 'SIGKILL' , description : localize ( 'SIGKILL' , 'Force kill process' ) } ,
133
- { label : 'SIGSTOP' , description : localize ( 'SIGSTOP' , 'Stop process' ) } ,
134
- { label : 'SIGCONT' , description : localize ( 'SIGCONT' , 'Continue process' ) } ,
135
- { label : 'SIGHUP' , description : localize ( 'SIGHUP' , 'Hangup' ) } ,
136
- { label : 'SIGQUIT' , description : localize ( 'SIGQUIT' , 'Quit process' ) } ,
137
- { label : 'SIGUSR1' , description : localize ( 'SIGUSR1' , 'User-defined signal 1' ) } ,
138
- { label : 'SIGUSR2' , description : localize ( 'SIGUSR2' , 'User-defined signal 2' ) } ,
139
- { type : 'separator' } ,
140
- { label : localize ( 'manualSignal' , 'Manually enter signal' ) }
141
- ] ;
142
-
143
- const selected = await quickInputService . pick ( signalOptions , {
144
- placeHolder : localize ( 'selectSignal' , 'Select signal to send to terminal process' )
145
- } ) ;
146
-
147
- if ( ! selected ) {
148
- return ;
149
- }
150
-
151
- if ( selected . label === localize ( 'manualSignal' , 'Manually enter signal' ) ) {
152
- const inputSignal = await quickInputService . input ( {
153
- prompt : localize ( 'enterSignal' , 'Enter signal name (e.g., SIGTERM, SIGKILL)' ) ,
154
- } ) ;
155
-
156
- if ( ! inputSignal ) {
157
- return ;
158
- }
159
-
160
- signal = inputSignal ;
161
- } else {
162
- signal = selected . label ;
163
- }
164
- }
165
-
166
- await instance . sendSignal ( signal ) ;
167
- }
168
- } ) ;
169
-
170
101
export function registerSendSequenceKeybinding ( text : string , rule : { when ?: ContextKeyExpression } & IKeybindings ) : void {
171
102
KeybindingsRegistry . registerCommandAndKeybindingRule ( {
172
- id : TerminalSendCommandsCommandId . SendSequence ,
103
+ id : TerminalSendSequenceCommandId . SendSequence ,
173
104
weight : KeybindingWeight . WorkbenchContrib ,
174
105
when : rule . when || TerminalContextKeys . focus ,
175
106
primary : rule . primary ,
0 commit comments