|
3 | 3 | * Licensed under the MIT License. See License.txt in the project root for license information.
|
4 | 4 | *--------------------------------------------------------------------------------------------*/
|
5 | 5 |
|
| 6 | +import { isKeyboardEvent, isMouseEvent, isPointerEvent } from '../../../../base/browser/dom.js'; |
6 | 7 | import { Action } from '../../../../base/common/actions.js';
|
| 8 | +import { CancellationToken } from '../../../../base/common/cancellation.js'; |
7 | 9 | import { Codicon } from '../../../../base/common/codicons.js';
|
| 10 | +import { Iterable } from '../../../../base/common/iterator.js'; |
8 | 11 | import { KeyChord, KeyCode, KeyMod } from '../../../../base/common/keyCodes.js';
|
| 12 | +import { IDisposable } from '../../../../base/common/lifecycle.js'; |
9 | 13 | import { Schemas } from '../../../../base/common/network.js';
|
| 14 | +import { isAbsolute } from '../../../../base/common/path.js'; |
10 | 15 | import { isWindows } from '../../../../base/common/platform.js';
|
11 |
| -import { IDisposable } from '../../../../base/common/lifecycle.js'; |
| 16 | +import { dirname } from '../../../../base/common/resources.js'; |
12 | 17 | import { isObject, isString } from '../../../../base/common/types.js';
|
13 | 18 | import { URI } from '../../../../base/common/uri.js';
|
14 | 19 | import { ICodeEditorService } from '../../../../editor/browser/services/codeEditorService.js';
|
| 20 | +import { ILanguageService } from '../../../../editor/common/languages/language.js'; |
15 | 21 | import { EndOfLinePreference } from '../../../../editor/common/model.js';
|
| 22 | +import { getIconClasses } from '../../../../editor/common/services/getIconClasses.js'; |
| 23 | +import { IModelService } from '../../../../editor/common/services/model.js'; |
16 | 24 | import { localize, localize2 } from '../../../../nls.js';
|
| 25 | +import { AccessibleViewProviderId } from '../../../../platform/accessibility/browser/accessibleView.js'; |
17 | 26 | import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from '../../../../platform/accessibility/common/accessibility.js';
|
18 |
| -import { Action2, registerAction2, IAction2Options, MenuId } from '../../../../platform/actions/common/actions.js'; |
| 27 | +import { Action2, IAction2Options, MenuId, registerAction2 } from '../../../../platform/actions/common/actions.js'; |
19 | 28 | import { ICommandService } from '../../../../platform/commands/common/commands.js';
|
20 | 29 | import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
|
21 | 30 | import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
|
| 31 | +import { FileKind } from '../../../../platform/files/common/files.js'; |
22 | 32 | import { ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js';
|
23 | 33 | import { KeybindingWeight } from '../../../../platform/keybinding/common/keybindingsRegistry.js';
|
24 | 34 | import { ILabelService } from '../../../../platform/label/common/label.js';
|
25 | 35 | import { IListService } from '../../../../platform/list/browser/listService.js';
|
26 | 36 | import { INotificationService, Severity } from '../../../../platform/notification/common/notification.js';
|
27 | 37 | import { IOpenerService } from '../../../../platform/opener/common/opener.js';
|
28 |
| -import { IPickOptions, IQuickInputService, IQuickPickItem, QuickPickItem } from '../../../../platform/quickinput/common/quickInput.js'; |
| 38 | +import { IPickOptions, IQuickInputService, IQuickPickItem } from '../../../../platform/quickinput/common/quickInput.js'; |
| 39 | +import { TerminalCapability } from '../../../../platform/terminal/common/capabilities/capabilities.js'; |
29 | 40 | import { ITerminalProfile, TerminalExitReason, TerminalIcon, TerminalLocation, TerminalSettingId } from '../../../../platform/terminal/common/terminal.js';
|
| 41 | +import { createProfileSchemaEnums } from '../../../../platform/terminal/common/terminalProfiles.js'; |
| 42 | +import { IThemeService } from '../../../../platform/theme/common/themeService.js'; |
30 | 43 | import { IWorkspaceContextService, IWorkspaceFolder } from '../../../../platform/workspace/common/workspace.js';
|
31 | 44 | import { PICK_WORKSPACE_FOLDER_COMMAND_ID } from '../../../browser/actions/workspaceCommands.js';
|
32 | 45 | import { CLOSE_EDITOR_COMMAND_ID } from '../../../browser/parts/editor/editorCommands.js';
|
33 |
| -import { Direction, ICreateTerminalOptions, IDetachedTerminalInstance, ITerminalConfigurationService, ITerminalEditorService, ITerminalGroupService, ITerminalInstance, ITerminalInstanceService, ITerminalService, IXtermTerminal } from './terminal.js'; |
34 |
| -import { IRemoteTerminalAttachTarget, ITerminalProfileResolverService, ITerminalProfileService, TERMINAL_VIEW_ID, TerminalCommandId } from '../common/terminal.js'; |
35 |
| -import { TerminalContextKeys } from '../common/terminalContextKey.js'; |
36 |
| -import { createProfileSchemaEnums } from '../../../../platform/terminal/common/terminalProfiles.js'; |
37 |
| -import { terminalStrings } from '../common/terminalStrings.js'; |
38 | 46 | import { IConfigurationResolverService } from '../../../services/configurationResolver/common/configurationResolver.js';
|
| 47 | +import { ConfigurationResolverExpression } from '../../../services/configurationResolver/common/configurationResolverExpression.js'; |
| 48 | +import { editorGroupToColumn } from '../../../services/editor/common/editorGroupColumn.js'; |
| 49 | +import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.js'; |
| 50 | +import { SIDE_GROUP } from '../../../services/editor/common/editorService.js'; |
39 | 51 | import { IWorkbenchEnvironmentService } from '../../../services/environment/common/environmentService.js';
|
40 |
| -import { IHistoryService } from '../../../services/history/common/history.js'; |
41 | 52 | import { IPreferencesService } from '../../../services/preferences/common/preferences.js';
|
42 | 53 | import { IRemoteAgentService } from '../../../services/remote/common/remoteAgentService.js';
|
43 |
| -import { SIDE_GROUP } from '../../../services/editor/common/editorService.js'; |
44 |
| -import { isAbsolute } from '../../../../base/common/path.js'; |
45 |
| -import { ITerminalQuickPickItem } from './terminalProfileQuickpick.js'; |
46 |
| -import { IThemeService } from '../../../../platform/theme/common/themeService.js'; |
47 |
| -import { getIconId, getColorClass, getUriClasses } from './terminalIcon.js'; |
48 |
| -import { IModelService } from '../../../../editor/common/services/model.js'; |
49 |
| -import { ILanguageService } from '../../../../editor/common/languages/language.js'; |
50 |
| -import { CancellationToken } from '../../../../base/common/cancellation.js'; |
51 |
| -import { dirname } from '../../../../base/common/resources.js'; |
52 |
| -import { getIconClasses } from '../../../../editor/common/services/getIconClasses.js'; |
53 |
| -import { FileKind } from '../../../../platform/files/common/files.js'; |
54 |
| -import { TerminalCapability } from '../../../../platform/terminal/common/capabilities/capabilities.js'; |
55 |
| -import { killTerminalIcon, newTerminalIcon } from './terminalIcons.js'; |
56 |
| -import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.js'; |
57 |
| -import { Iterable } from '../../../../base/common/iterator.js'; |
58 | 54 | import { accessibleViewCurrentProviderId, accessibleViewIsShown, accessibleViewOnLastLine } from '../../accessibility/browser/accessibilityConfiguration.js';
|
59 |
| -import { isKeyboardEvent, isMouseEvent, isPointerEvent } from '../../../../base/browser/dom.js'; |
60 |
| -import { editorGroupToColumn } from '../../../services/editor/common/editorGroupColumn.js'; |
| 55 | +import { IRemoteTerminalAttachTarget, ITerminalProfileResolverService, ITerminalProfileService, TERMINAL_VIEW_ID, TerminalCommandId } from '../common/terminal.js'; |
| 56 | +import { TerminalContextKeys } from '../common/terminalContextKey.js'; |
| 57 | +import { terminalStrings } from '../common/terminalStrings.js'; |
| 58 | +import { Direction, ICreateTerminalOptions, IDetachedTerminalInstance, ITerminalConfigurationService, ITerminalEditorService, ITerminalGroupService, ITerminalInstance, ITerminalInstanceService, ITerminalService, IXtermTerminal } from './terminal.js'; |
61 | 59 | import { InstanceContext } from './terminalContextMenu.js';
|
62 |
| -import { AccessibleViewProviderId } from '../../../../platform/accessibility/browser/accessibleView.js'; |
| 60 | +import { getColorClass, getIconId, getUriClasses } from './terminalIcon.js'; |
| 61 | +import { killTerminalIcon, newTerminalIcon } from './terminalIcons.js'; |
| 62 | +import { ITerminalQuickPickItem } from './terminalProfileQuickpick.js'; |
63 | 63 | import { TerminalTabList } from './terminalTabsList.js';
|
64 |
| -import { ConfigurationResolverExpression } from '../../../services/configurationResolver/common/configurationResolverExpression.js'; |
65 | 64 |
|
66 | 65 | export const switchTerminalActionViewItemSeparator = '\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500';
|
67 | 66 | export const switchTerminalShowTabsTitle = localize('showTerminalTabs', "Show Tabs");
|
@@ -120,101 +119,6 @@ export async function getCwdForSplit(
|
120 | 119 | }
|
121 | 120 | }
|
122 | 121 |
|
123 |
| -export const terminalSendSequenceCommand = async (accessor: ServicesAccessor, args: unknown) => { |
124 |
| - const quickInputService = accessor.get(IQuickInputService); |
125 |
| - const configurationResolverService = accessor.get(IConfigurationResolverService); |
126 |
| - const workspaceContextService = accessor.get(IWorkspaceContextService); |
127 |
| - const historyService = accessor.get(IHistoryService); |
128 |
| - const terminalService = accessor.get(ITerminalService); |
129 |
| - |
130 |
| - const instance = terminalService.activeInstance; |
131 |
| - if (instance) { |
132 |
| - let text = isObject(args) && 'text' in args ? toOptionalString(args.text) : undefined; |
133 |
| - |
134 |
| - // If no text provided, prompt user for input and process special characters |
135 |
| - if (!text) { |
136 |
| - text = await quickInputService.input({ |
137 |
| - value: '', |
138 |
| - placeHolder: 'Enter sequence to send (supports \\n, \\r, \\xAB)', |
139 |
| - prompt: localize('workbench.action.terminal.sendSequence.prompt', "Enter sequence to send to the terminal"), |
140 |
| - }); |
141 |
| - if (!text) { |
142 |
| - return; |
143 |
| - } |
144 |
| - // Process escape sequences |
145 |
| - let processedText = text |
146 |
| - .replace(/\\n/g, '\n') |
147 |
| - .replace(/\\r/g, '\r'); |
148 |
| - |
149 |
| - // Process hex escape sequences (\xNN) |
150 |
| - while (true) { |
151 |
| - const match = processedText.match(/\\x([0-9a-fA-F]{2})/); |
152 |
| - if (match === null || match.index === undefined || match.length < 2) { |
153 |
| - break; |
154 |
| - } |
155 |
| - processedText = processedText.slice(0, match.index) + String.fromCharCode(parseInt(match[1], 16)) + processedText.slice(match.index + 4); |
156 |
| - } |
157 |
| - |
158 |
| - text = processedText; |
159 |
| - } |
160 |
| - |
161 |
| - const activeWorkspaceRootUri = historyService.getLastActiveWorkspaceRoot(instance.isRemote ? Schemas.vscodeRemote : Schemas.file); |
162 |
| - const lastActiveWorkspaceRoot = activeWorkspaceRootUri ? workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri) ?? undefined : undefined; |
163 |
| - const resolvedText = await configurationResolverService.resolveAsync(lastActiveWorkspaceRoot, text); |
164 |
| - instance.sendText(resolvedText, false); |
165 |
| - } |
166 |
| -}; |
167 |
| - |
168 |
| -export const terminalSendSignalCommand = async (accessor: ServicesAccessor, args: unknown) => { |
169 |
| - const quickInputService = accessor.get(IQuickInputService); |
170 |
| - const instance = accessor.get(ITerminalService).activeInstance; |
171 |
| - if (!instance) { |
172 |
| - return; |
173 |
| - } |
174 |
| - |
175 |
| - let signal = isObject(args) && 'signal' in args ? toOptionalString(args.signal) : undefined; |
176 |
| - |
177 |
| - if (!signal) { |
178 |
| - const signalOptions: QuickPickItem[] = [ |
179 |
| - { label: 'SIGINT', description: localize('SIGINT', 'Interrupt process (Ctrl+C)') }, |
180 |
| - { label: 'SIGTERM', description: localize('SIGTERM', 'Terminate process gracefully') }, |
181 |
| - { label: 'SIGKILL', description: localize('SIGKILL', 'Force kill process') }, |
182 |
| - { label: 'SIGSTOP', description: localize('SIGSTOP', 'Stop process') }, |
183 |
| - { label: 'SIGCONT', description: localize('SIGCONT', 'Continue process') }, |
184 |
| - { label: 'SIGHUP', description: localize('SIGHUP', 'Hangup') }, |
185 |
| - { label: 'SIGQUIT', description: localize('SIGQUIT', 'Quit process') }, |
186 |
| - { label: 'SIGUSR1', description: localize('SIGUSR1', 'User-defined signal 1') }, |
187 |
| - { label: 'SIGUSR2', description: localize('SIGUSR2', 'User-defined signal 2') }, |
188 |
| - { type: 'separator' }, |
189 |
| - { label: localize('manualSignal', 'Manually enter signal') } |
190 |
| - ]; |
191 |
| - |
192 |
| - const selected = await quickInputService.pick(signalOptions, { |
193 |
| - placeHolder: localize('selectSignal', 'Select signal to send to terminal process') |
194 |
| - }); |
195 |
| - |
196 |
| - if (!selected) { |
197 |
| - return; |
198 |
| - } |
199 |
| - |
200 |
| - if (selected.label === localize('manualSignal', 'Manually enter signal')) { |
201 |
| - const inputSignal = await quickInputService.input({ |
202 |
| - prompt: localize('enterSignal', 'Enter signal name (e.g., SIGTERM, SIGKILL)'), |
203 |
| - }); |
204 |
| - |
205 |
| - if (!inputSignal) { |
206 |
| - return; |
207 |
| - } |
208 |
| - |
209 |
| - signal = inputSignal; |
210 |
| - } else { |
211 |
| - signal = selected.label; |
212 |
| - } |
213 |
| - } |
214 |
| - |
215 |
| - await instance.sendSignal(signal); |
216 |
| -}; |
217 |
| - |
218 | 122 | export class TerminalLaunchHelpAction extends Action {
|
219 | 123 |
|
220 | 124 | constructor(
|
@@ -1032,52 +936,6 @@ export function registerTerminalActions() {
|
1032 | 936 | }
|
1033 | 937 | });
|
1034 | 938 |
|
1035 |
| - registerTerminalAction({ |
1036 |
| - id: TerminalCommandId.SendSequence, |
1037 |
| - title: terminalStrings.sendSequence, |
1038 |
| - f1: true, |
1039 |
| - metadata: { |
1040 |
| - description: terminalStrings.sendSequence.value, |
1041 |
| - args: [{ |
1042 |
| - name: 'args', |
1043 |
| - schema: { |
1044 |
| - type: 'object', |
1045 |
| - required: ['text'], |
1046 |
| - properties: { |
1047 |
| - text: { |
1048 |
| - description: localize('sendSequence', "The sequence of text to send to the terminal"), |
1049 |
| - type: 'string' |
1050 |
| - } |
1051 |
| - }, |
1052 |
| - } |
1053 |
| - }] |
1054 |
| - }, |
1055 |
| - run: (c, accessor, args) => terminalSendSequenceCommand(accessor, args) |
1056 |
| - }); |
1057 |
| - |
1058 |
| - registerTerminalAction({ |
1059 |
| - id: TerminalCommandId.SendSignal, |
1060 |
| - title: terminalStrings.sendSignal, |
1061 |
| - f1: !isWindows, |
1062 |
| - metadata: { |
1063 |
| - description: terminalStrings.sendSignal.value, |
1064 |
| - args: [{ |
1065 |
| - name: 'args', |
1066 |
| - schema: { |
1067 |
| - type: 'object', |
1068 |
| - required: ['signal'], |
1069 |
| - properties: { |
1070 |
| - signal: { |
1071 |
| - description: localize('sendSignal', "The signal to send to the terminal process (e.g., 'SIGTERM', 'SIGINT', 'SIGKILL')"), |
1072 |
| - type: 'string' |
1073 |
| - } |
1074 |
| - }, |
1075 |
| - } |
1076 |
| - }] |
1077 |
| - }, |
1078 |
| - run: (c, accessor, args) => terminalSendSignalCommand(accessor, args) |
1079 |
| - }); |
1080 |
| - |
1081 | 939 | registerTerminalAction({
|
1082 | 940 | id: TerminalCommandId.NewWithCwd,
|
1083 | 941 | title: terminalStrings.newWithCwd,
|
|
0 commit comments