@codingame/monaco-vscode-xterm-common 24.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/empty.js +1 -0
- package/package.json +45 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.d.ts +11 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.js +26 -0
- package/vscode/src/vs/platform/terminal/common/environmentVariable.d.ts +86 -0
- package/vscode/src/vs/platform/terminal/common/environmentVariable.js +10 -0
- package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.d.ts +17 -0
- package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.js +214 -0
- package/vscode/src/vs/platform/terminal/common/terminalRecorder.d.ts +14 -0
- package/vscode/src/vs/platform/terminal/common/terminalRecorder.js +75 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +125 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.d.ts +104 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.js +1554 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.js +45 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.js +82 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.d.ts +408 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.js +2338 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.d.ts +143 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +684 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.js +68 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.d.ts +57 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.js +135 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.js +754 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.js +112 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.d.ts +17 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.js +59 -0
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.d.ts +38 -0
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.js +319 -0
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalStorageKeys.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalStorageKeys.js +17 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.d.ts +58 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +69 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/media/stickyScroll.css +49 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.js +25 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollContribution.d.ts +35 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollContribution.js +117 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.d.ts +56 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +428 -0
|
@@ -0,0 +1,754 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { WorkbenchList } from '@codingame/monaco-vscode-api/vscode/vs/platform/list/browser/listService';
|
|
4
|
+
import { IListService } from '@codingame/monaco-vscode-api/vscode/vs/platform/list/browser/listService.service';
|
|
5
|
+
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
6
|
+
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
7
|
+
import { IKeybindingService } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
8
|
+
import { IThemeService } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/themeService.service';
|
|
9
|
+
import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
|
|
10
|
+
import { TerminalDataTransfers } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal';
|
|
11
|
+
import { ITerminalService, ITerminalGroupService, ITerminalEditingService, ITerminalConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
12
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
13
|
+
import { $ as $$1, append, addDisposableListener, EventType, addStandardDisposableListener } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
14
|
+
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
15
|
+
import { ActionBar } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionbar';
|
|
16
|
+
import { MenuItemAction } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
|
|
17
|
+
import { MenuEntryActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
|
18
|
+
import { TerminalCommandId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal';
|
|
19
|
+
import { TerminalLocation, TerminalSettingId } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal';
|
|
20
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
21
|
+
import { Action } from '@codingame/monaco-vscode-api/vscode/vs/base/common/actions';
|
|
22
|
+
import { ResourceLabels, DEFAULT_LABELS_CONTAINER } from '@codingame/monaco-vscode-api/vscode/vs/workbench/browser/labels';
|
|
23
|
+
import { IDecorationsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/decorations/common/decorations.service';
|
|
24
|
+
import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
|
|
25
|
+
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
26
|
+
import { dispose, toDisposable, DisposableStore, Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
27
|
+
import { ListDragOverEffectPosition, ListDragOverEffectType } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/list/list';
|
|
28
|
+
import { DataTransfers } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dnd';
|
|
29
|
+
import { disposableTimeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
30
|
+
import { NativeDragAndDropData, ElementsDragAndDropData } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/list/listView';
|
|
31
|
+
import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
|
|
32
|
+
import { getIconId, getColorClass, getUriClasses } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminalIcon';
|
|
33
|
+
import { IContextViewService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
|
|
34
|
+
import { InputBox, MessageType } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/inputbox/inputBox';
|
|
35
|
+
import { createSingleCallFunction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/functional';
|
|
36
|
+
import { KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
|
|
37
|
+
import { containsDragType, CodeDataTransfers, getPathForFile } from '@codingame/monaco-vscode-api/vscode/vs/platform/dnd/browser/dnd';
|
|
38
|
+
import { terminalStrings } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalStrings';
|
|
39
|
+
import { ILifecycleService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
40
|
+
import { TerminalContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalContextKey';
|
|
41
|
+
import { getTerminalResourcesFromDragEvent, parseTerminalUri } from '@codingame/monaco-vscode-xterm-addons-common/vscode/vs/workbench/contrib/terminal/browser/terminalUri';
|
|
42
|
+
import { getInstanceHoverInfo } from './terminalTooltip.js';
|
|
43
|
+
import { defaultInputBoxStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
|
|
44
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
45
|
+
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
46
|
+
import { getColorForSeverity } from './terminalStatusList.js';
|
|
47
|
+
import { TerminalContextActionRunner } from './terminalContextMenu.js';
|
|
48
|
+
import { HoverPosition } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverWidget';
|
|
49
|
+
import { ICommandService } from '@codingame/monaco-vscode-api/vscode/vs/platform/commands/common/commands.service';
|
|
50
|
+
import { StorageScope } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
51
|
+
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
52
|
+
import { TerminalStorageKeys } from '../common/terminalStorageKeys.js';
|
|
53
|
+
import { isObject } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
54
|
+
|
|
55
|
+
const $ = $$1;
|
|
56
|
+
var TerminalTabsListSizes;
|
|
57
|
+
(function (TerminalTabsListSizes) {
|
|
58
|
+
TerminalTabsListSizes[TerminalTabsListSizes["TabHeight"] = 22] = "TabHeight";
|
|
59
|
+
TerminalTabsListSizes[TerminalTabsListSizes["NarrowViewWidth"] = 46] = "NarrowViewWidth";
|
|
60
|
+
TerminalTabsListSizes[TerminalTabsListSizes["WideViewMinimumWidth"] = 80] = "WideViewMinimumWidth";
|
|
61
|
+
TerminalTabsListSizes[TerminalTabsListSizes["DefaultWidth"] = 120] = "DefaultWidth";
|
|
62
|
+
TerminalTabsListSizes[TerminalTabsListSizes["MidpointViewWidth"] = 63] = "MidpointViewWidth";
|
|
63
|
+
TerminalTabsListSizes[TerminalTabsListSizes["ActionbarMinimumWidth"] = 105] = "ActionbarMinimumWidth";
|
|
64
|
+
TerminalTabsListSizes[TerminalTabsListSizes["MaximumWidth"] = 500] = "MaximumWidth";
|
|
65
|
+
})(TerminalTabsListSizes || (TerminalTabsListSizes = {}));
|
|
66
|
+
let TerminalTabList = class TerminalTabList extends WorkbenchList {
|
|
67
|
+
constructor(container, contextKeyService, listService, _configurationService, _terminalService, _terminalGroupService, _terminalEditingService, instantiationService, decorationsService, _themeService, _storageService, lifecycleService, _hoverService) {
|
|
68
|
+
super('TerminalTabsList', container, {
|
|
69
|
+
getHeight: () => TerminalTabsListSizes.TabHeight,
|
|
70
|
+
getTemplateId: () => 'terminal.tabs'
|
|
71
|
+
}, [instantiationService.createInstance(TerminalTabsRenderer, container, instantiationService.createInstance(ResourceLabels, DEFAULT_LABELS_CONTAINER), () => this.getSelectedElements())], {
|
|
72
|
+
horizontalScrolling: false,
|
|
73
|
+
supportDynamicHeights: false,
|
|
74
|
+
selectionNavigation: true,
|
|
75
|
+
identityProvider: {
|
|
76
|
+
getId: e => e?.instanceId
|
|
77
|
+
},
|
|
78
|
+
accessibilityProvider: instantiationService.createInstance(TerminalTabsAccessibilityProvider),
|
|
79
|
+
smoothScrolling: _configurationService.getValue('workbench.list.smoothScrolling'),
|
|
80
|
+
multipleSelectionSupport: true,
|
|
81
|
+
paddingBottom: TerminalTabsListSizes.TabHeight,
|
|
82
|
+
dnd: instantiationService.createInstance(TerminalTabsDragAndDrop),
|
|
83
|
+
openOnSingleClick: true
|
|
84
|
+
}, contextKeyService, listService, _configurationService, instantiationService);
|
|
85
|
+
this._configurationService = _configurationService;
|
|
86
|
+
this._terminalService = _terminalService;
|
|
87
|
+
this._terminalGroupService = _terminalGroupService;
|
|
88
|
+
this._terminalEditingService = _terminalEditingService;
|
|
89
|
+
this._themeService = _themeService;
|
|
90
|
+
this._storageService = _storageService;
|
|
91
|
+
this._hoverService = _hoverService;
|
|
92
|
+
const instanceDisposables = [
|
|
93
|
+
this._terminalGroupService.onDidChangeInstances(() => this.refresh()),
|
|
94
|
+
this._terminalGroupService.onDidChangeGroups(() => this.refresh()),
|
|
95
|
+
this._terminalGroupService.onDidShow(() => this.refresh()),
|
|
96
|
+
this._terminalGroupService.onDidChangeInstanceCapability(() => this.refresh()),
|
|
97
|
+
this._terminalService.onAnyInstanceTitleChange(() => this.refresh()),
|
|
98
|
+
this._terminalService.onAnyInstanceIconChange(() => this.refresh()),
|
|
99
|
+
this._terminalService.onAnyInstancePrimaryStatusChange(() => this.refresh()),
|
|
100
|
+
this._terminalService.onDidChangeConnectionState(() => this.refresh()),
|
|
101
|
+
this._themeService.onDidColorThemeChange(() => this.refresh()),
|
|
102
|
+
this._terminalGroupService.onDidChangeActiveInstance(e => {
|
|
103
|
+
if (e) {
|
|
104
|
+
const i = this._terminalGroupService.instances.indexOf(e);
|
|
105
|
+
this.setSelection([i]);
|
|
106
|
+
this.reveal(i);
|
|
107
|
+
}
|
|
108
|
+
this.refresh();
|
|
109
|
+
}),
|
|
110
|
+
this._storageService.onDidChangeValue(StorageScope.APPLICATION, TerminalStorageKeys.TabsShowDetailed, this.disposables)(() => this.refresh()),
|
|
111
|
+
];
|
|
112
|
+
this.disposables.add(lifecycleService.onWillShutdown(e => {
|
|
113
|
+
dispose(instanceDisposables);
|
|
114
|
+
instanceDisposables.length = 0;
|
|
115
|
+
}));
|
|
116
|
+
this.disposables.add(toDisposable(() => {
|
|
117
|
+
dispose(instanceDisposables);
|
|
118
|
+
instanceDisposables.length = 0;
|
|
119
|
+
}));
|
|
120
|
+
this.disposables.add(this.onMouseDblClick(async (e) => {
|
|
121
|
+
if (!e.element) {
|
|
122
|
+
e.browserEvent.preventDefault();
|
|
123
|
+
e.browserEvent.stopPropagation();
|
|
124
|
+
const instance = await this._terminalService.createTerminal({ location: TerminalLocation.Panel });
|
|
125
|
+
this._terminalGroupService.setActiveInstance(instance);
|
|
126
|
+
await instance.focusWhenReady();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (this._terminalEditingService.getEditingTerminal()?.instanceId === e.element.instanceId) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (this._getFocusMode() === 'doubleClick' && this.getFocus().length === 1) {
|
|
133
|
+
e.element.focus(true);
|
|
134
|
+
}
|
|
135
|
+
}));
|
|
136
|
+
this.disposables.add(this.onMouseClick(async (e) => {
|
|
137
|
+
if (this._terminalEditingService.getEditingTerminal()?.instanceId === e.element?.instanceId) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (e.browserEvent.altKey && e.element) {
|
|
141
|
+
await this._terminalService.createTerminal({ location: { parentTerminal: e.element } });
|
|
142
|
+
}
|
|
143
|
+
else if (this._getFocusMode() === 'singleClick') {
|
|
144
|
+
if (this.getSelection().length <= 1) {
|
|
145
|
+
e.element?.focus(true);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
this.disposables.add(this.onContextMenu(e => {
|
|
150
|
+
if (!e.element) {
|
|
151
|
+
this.setSelection([]);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const selection = this.getSelectedElements();
|
|
155
|
+
if (!selection || !selection.find(s => e.element === s)) {
|
|
156
|
+
this.setFocus(e.index !== undefined ? [e.index] : []);
|
|
157
|
+
}
|
|
158
|
+
}));
|
|
159
|
+
this._terminalTabsSingleSelectedContextKey = TerminalContextKeys.tabsSingularSelection.bindTo(contextKeyService);
|
|
160
|
+
this._isSplitContextKey = TerminalContextKeys.splitTerminalTabFocused.bindTo(contextKeyService);
|
|
161
|
+
this.disposables.add(this.onDidChangeSelection(e => this._updateContextKey()));
|
|
162
|
+
this.disposables.add(this.onDidChangeFocus(() => this._updateContextKey()));
|
|
163
|
+
this.disposables.add(this.onDidOpen(async (e) => {
|
|
164
|
+
const instance = e.element;
|
|
165
|
+
if (!instance) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
this._terminalGroupService.setActiveInstance(instance);
|
|
169
|
+
if (!e.editorOptions.preserveFocus) {
|
|
170
|
+
await instance.focusWhenReady();
|
|
171
|
+
}
|
|
172
|
+
}));
|
|
173
|
+
if (!this._decorationsProvider) {
|
|
174
|
+
this._decorationsProvider = this.disposables.add(instantiationService.createInstance(TabDecorationsProvider));
|
|
175
|
+
this.disposables.add(decorationsService.registerDecorationsProvider(this._decorationsProvider));
|
|
176
|
+
}
|
|
177
|
+
this.refresh();
|
|
178
|
+
}
|
|
179
|
+
_getFocusMode() {
|
|
180
|
+
return this._configurationService.getValue(TerminalSettingId.TabsFocusMode);
|
|
181
|
+
}
|
|
182
|
+
refresh(cancelEditing = true) {
|
|
183
|
+
if (cancelEditing && this._terminalEditingService.isEditable(undefined)) {
|
|
184
|
+
this.domFocus();
|
|
185
|
+
}
|
|
186
|
+
this.splice(0, this.length, this._terminalGroupService.instances.slice());
|
|
187
|
+
}
|
|
188
|
+
focusHover() {
|
|
189
|
+
const instance = this.getSelectedElements()[0];
|
|
190
|
+
if (!instance) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
this._hoverService.showInstantHover({
|
|
194
|
+
...getInstanceHoverInfo(instance, this._storageService),
|
|
195
|
+
target: this.getHTMLElement(),
|
|
196
|
+
trapFocus: true
|
|
197
|
+
}, true);
|
|
198
|
+
}
|
|
199
|
+
_updateContextKey() {
|
|
200
|
+
this._terminalTabsSingleSelectedContextKey.set(this.getSelectedElements().length === 1);
|
|
201
|
+
const instance = this.getFocusedElements();
|
|
202
|
+
this._isSplitContextKey.set(instance.length > 0 && this._terminalGroupService.instanceIsSplit(instance[0]));
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
TerminalTabList = ( __decorate([
|
|
206
|
+
( __param(1, IContextKeyService)),
|
|
207
|
+
( __param(2, IListService)),
|
|
208
|
+
( __param(3, IConfigurationService)),
|
|
209
|
+
( __param(4, ITerminalService)),
|
|
210
|
+
( __param(5, ITerminalGroupService)),
|
|
211
|
+
( __param(6, ITerminalEditingService)),
|
|
212
|
+
( __param(7, IInstantiationService)),
|
|
213
|
+
( __param(8, IDecorationsService)),
|
|
214
|
+
( __param(9, IThemeService)),
|
|
215
|
+
( __param(10, IStorageService)),
|
|
216
|
+
( __param(11, ILifecycleService)),
|
|
217
|
+
( __param(12, IHoverService))
|
|
218
|
+
], TerminalTabList));
|
|
219
|
+
let TerminalTabsRenderer = class TerminalTabsRenderer {
|
|
220
|
+
constructor(_container, _labels, _getSelection, _instantiationService, _terminalConfigurationService, _terminalService, _terminalGroupService, _terminalEditingService, _hoverService, _keybindingService, _listService, _storageService, _themeService, _contextViewService, _commandService) {
|
|
221
|
+
this._container = _container;
|
|
222
|
+
this._labels = _labels;
|
|
223
|
+
this._getSelection = _getSelection;
|
|
224
|
+
this._instantiationService = _instantiationService;
|
|
225
|
+
this._terminalConfigurationService = _terminalConfigurationService;
|
|
226
|
+
this._terminalService = _terminalService;
|
|
227
|
+
this._terminalGroupService = _terminalGroupService;
|
|
228
|
+
this._terminalEditingService = _terminalEditingService;
|
|
229
|
+
this._hoverService = _hoverService;
|
|
230
|
+
this._keybindingService = _keybindingService;
|
|
231
|
+
this._listService = _listService;
|
|
232
|
+
this._storageService = _storageService;
|
|
233
|
+
this._themeService = _themeService;
|
|
234
|
+
this._contextViewService = _contextViewService;
|
|
235
|
+
this._commandService = _commandService;
|
|
236
|
+
this.templateId = 'terminal.tabs';
|
|
237
|
+
this._cachedContainerWidth = -1;
|
|
238
|
+
}
|
|
239
|
+
renderTemplate(container) {
|
|
240
|
+
const element = append(container, $('.terminal-tabs-entry'));
|
|
241
|
+
const context = {};
|
|
242
|
+
const templateDisposables = ( new DisposableStore());
|
|
243
|
+
const label = templateDisposables.add(this._labels.create(element, {
|
|
244
|
+
supportHighlights: true,
|
|
245
|
+
supportDescriptionHighlights: true,
|
|
246
|
+
supportIcons: true,
|
|
247
|
+
hoverDelegate: {
|
|
248
|
+
delay: 0,
|
|
249
|
+
showHover: options => {
|
|
250
|
+
return this._hoverService.showDelayedHover({
|
|
251
|
+
...options,
|
|
252
|
+
actions: context.hoverActions,
|
|
253
|
+
target: element,
|
|
254
|
+
appearance: {
|
|
255
|
+
showPointer: true
|
|
256
|
+
},
|
|
257
|
+
position: {
|
|
258
|
+
hoverPosition: this._terminalConfigurationService.config.tabs.location === 'left' ? HoverPosition.RIGHT : HoverPosition.LEFT
|
|
259
|
+
}
|
|
260
|
+
}, { groupId: 'terminal-tabs-list' });
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}));
|
|
264
|
+
const actionsContainer = append(label.element, $('.actions'));
|
|
265
|
+
const actionBar = templateDisposables.add(( new ActionBar(actionsContainer, {
|
|
266
|
+
actionRunner: templateDisposables.add(( new TerminalContextActionRunner())),
|
|
267
|
+
actionViewItemProvider: (action, options) => action instanceof MenuItemAction
|
|
268
|
+
? templateDisposables.add(this._instantiationService.createInstance(MenuEntryActionViewItem, action, { hoverDelegate: options.hoverDelegate }))
|
|
269
|
+
: undefined
|
|
270
|
+
})));
|
|
271
|
+
return {
|
|
272
|
+
element,
|
|
273
|
+
label,
|
|
274
|
+
actionBar,
|
|
275
|
+
context,
|
|
276
|
+
elementDisposables: ( new DisposableStore()),
|
|
277
|
+
templateDisposables
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
shouldHideText() {
|
|
281
|
+
return this._container ? this.getContainerWidthCachedForTask() < TerminalTabsListSizes.MidpointViewWidth : false;
|
|
282
|
+
}
|
|
283
|
+
shouldHideActionBar() {
|
|
284
|
+
return this._container ? this.getContainerWidthCachedForTask() <= TerminalTabsListSizes.ActionbarMinimumWidth : false;
|
|
285
|
+
}
|
|
286
|
+
getContainerWidthCachedForTask() {
|
|
287
|
+
if (this._cachedContainerWidth === -1) {
|
|
288
|
+
this._cachedContainerWidth = this._container.clientWidth;
|
|
289
|
+
queueMicrotask(() => this._cachedContainerWidth = -1);
|
|
290
|
+
}
|
|
291
|
+
return this._cachedContainerWidth;
|
|
292
|
+
}
|
|
293
|
+
renderElement(instance, index, template) {
|
|
294
|
+
const hasText = !this.shouldHideText();
|
|
295
|
+
const group = this._terminalGroupService.getGroupForInstance(instance);
|
|
296
|
+
if (!group) {
|
|
297
|
+
throw ( new Error(`Could not find group for instance "${instance.instanceId}"`));
|
|
298
|
+
}
|
|
299
|
+
template.element.classList.toggle('has-text', hasText);
|
|
300
|
+
template.element.classList.toggle('is-active', this._terminalGroupService.activeInstance === instance);
|
|
301
|
+
let prefix = '';
|
|
302
|
+
if (group.terminalInstances.length > 1) {
|
|
303
|
+
const terminalIndex = group.terminalInstances.indexOf(instance);
|
|
304
|
+
if (terminalIndex === 0) {
|
|
305
|
+
prefix = `┌ `;
|
|
306
|
+
}
|
|
307
|
+
else if (terminalIndex === group.terminalInstances.length - 1) {
|
|
308
|
+
prefix = `└ `;
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
prefix = `├ `;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
const hoverInfo = getInstanceHoverInfo(instance, this._storageService);
|
|
315
|
+
template.context.hoverActions = hoverInfo.actions;
|
|
316
|
+
const iconId = this._instantiationService.invokeFunction(getIconId, instance);
|
|
317
|
+
const hasActionbar = !this.shouldHideActionBar();
|
|
318
|
+
let label = '';
|
|
319
|
+
if (!hasText) {
|
|
320
|
+
const primaryStatus = instance.statusList.primary;
|
|
321
|
+
if (primaryStatus && primaryStatus.severity > Severity.Ignore) {
|
|
322
|
+
label = `${prefix}$(${primaryStatus.icon?.id || iconId})`;
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
label = `${prefix}$(${iconId})`;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
this.fillActionBar(instance, template);
|
|
330
|
+
label = prefix;
|
|
331
|
+
if (instance.icon) {
|
|
332
|
+
label += `$(${iconId}) ${instance.title}`;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (!hasActionbar) {
|
|
336
|
+
template.actionBar.clear();
|
|
337
|
+
}
|
|
338
|
+
template.elementDisposables.add(addDisposableListener(template.element, EventType.AUXCLICK, e => {
|
|
339
|
+
e.stopImmediatePropagation();
|
|
340
|
+
if (e.button === 1 ) {
|
|
341
|
+
this._terminalService.safeDisposeTerminal(instance);
|
|
342
|
+
}
|
|
343
|
+
}));
|
|
344
|
+
const extraClasses = [];
|
|
345
|
+
const colorClass = getColorClass(instance);
|
|
346
|
+
if (colorClass) {
|
|
347
|
+
extraClasses.push(colorClass);
|
|
348
|
+
}
|
|
349
|
+
const uriClasses = getUriClasses(instance, this._themeService.getColorTheme().type);
|
|
350
|
+
if (uriClasses) {
|
|
351
|
+
extraClasses.push(...uriClasses);
|
|
352
|
+
}
|
|
353
|
+
template.label.setResource({
|
|
354
|
+
resource: instance.resource,
|
|
355
|
+
name: label,
|
|
356
|
+
description: hasText ? instance.description : undefined
|
|
357
|
+
}, {
|
|
358
|
+
fileDecorations: {
|
|
359
|
+
colors: true,
|
|
360
|
+
badges: hasText
|
|
361
|
+
},
|
|
362
|
+
title: {
|
|
363
|
+
markdown: hoverInfo.content,
|
|
364
|
+
markdownNotSupportedFallback: undefined
|
|
365
|
+
},
|
|
366
|
+
extraClasses
|
|
367
|
+
});
|
|
368
|
+
const editableData = this._terminalEditingService.getEditableData(instance);
|
|
369
|
+
template.label.element.classList.toggle('editable-tab', !!editableData);
|
|
370
|
+
if (editableData) {
|
|
371
|
+
template.elementDisposables.add(this._renderInputBox(template.label.element.querySelector('.monaco-icon-label-container'), instance, editableData));
|
|
372
|
+
template.actionBar.clear();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
_renderInputBox(container, instance, editableData) {
|
|
376
|
+
const value = instance.title || '';
|
|
377
|
+
const inputBox = ( new InputBox(container, this._contextViewService, {
|
|
378
|
+
validationOptions: {
|
|
379
|
+
validation: (value) => {
|
|
380
|
+
const message = editableData.validationMessage(value);
|
|
381
|
+
if (!message || message.severity !== Severity.Error) {
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
return {
|
|
385
|
+
content: message.content,
|
|
386
|
+
formatContent: true,
|
|
387
|
+
type: MessageType.ERROR
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
ariaLabel: ( localize(11629, "Type terminal name. Press Enter to confirm or Escape to cancel.")),
|
|
392
|
+
inputBoxStyles: defaultInputBoxStyles
|
|
393
|
+
}));
|
|
394
|
+
inputBox.element.style.height = '22px';
|
|
395
|
+
inputBox.value = value;
|
|
396
|
+
inputBox.focus();
|
|
397
|
+
inputBox.select({ start: 0, end: value.length });
|
|
398
|
+
const done = createSingleCallFunction((success, finishEditing) => {
|
|
399
|
+
inputBox.element.style.display = 'none';
|
|
400
|
+
const value = inputBox.value;
|
|
401
|
+
dispose(toDispose);
|
|
402
|
+
inputBox.element.remove();
|
|
403
|
+
if (finishEditing) {
|
|
404
|
+
editableData.onFinish(value, success);
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
const showInputBoxNotification = () => {
|
|
408
|
+
if (inputBox.isInputValid()) {
|
|
409
|
+
const message = editableData.validationMessage(inputBox.value);
|
|
410
|
+
if (message) {
|
|
411
|
+
inputBox.showMessage({
|
|
412
|
+
content: message.content,
|
|
413
|
+
formatContent: true,
|
|
414
|
+
type: message.severity === Severity.Info ? MessageType.INFO : message.severity === Severity.Warning ? MessageType.WARNING : MessageType.ERROR
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
inputBox.hideMessage();
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
showInputBoxNotification();
|
|
423
|
+
const toDispose = [
|
|
424
|
+
inputBox,
|
|
425
|
+
addStandardDisposableListener(inputBox.inputElement, EventType.KEY_DOWN, (e) => {
|
|
426
|
+
e.stopPropagation();
|
|
427
|
+
if (e.equals(KeyCode.Enter)) {
|
|
428
|
+
done(inputBox.isInputValid(), true);
|
|
429
|
+
}
|
|
430
|
+
else if (e.equals(KeyCode.Escape)) {
|
|
431
|
+
done(false, true);
|
|
432
|
+
}
|
|
433
|
+
}),
|
|
434
|
+
addStandardDisposableListener(inputBox.inputElement, EventType.KEY_UP, (e) => {
|
|
435
|
+
showInputBoxNotification();
|
|
436
|
+
}),
|
|
437
|
+
addDisposableListener(inputBox.inputElement, EventType.BLUR, () => {
|
|
438
|
+
done(inputBox.isInputValid(), true);
|
|
439
|
+
})
|
|
440
|
+
];
|
|
441
|
+
return toDisposable(() => {
|
|
442
|
+
done(false, false);
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
disposeElement(instance, index, templateData) {
|
|
446
|
+
templateData.elementDisposables.clear();
|
|
447
|
+
templateData.actionBar.clear();
|
|
448
|
+
}
|
|
449
|
+
disposeTemplate(templateData) {
|
|
450
|
+
templateData.elementDisposables.dispose();
|
|
451
|
+
templateData.templateDisposables.dispose();
|
|
452
|
+
}
|
|
453
|
+
fillActionBar(instance, template) {
|
|
454
|
+
const actions = [
|
|
455
|
+
template.elementDisposables.add(( new Action(
|
|
456
|
+
TerminalCommandId.SplitActiveTab,
|
|
457
|
+
terminalStrings.split.short,
|
|
458
|
+
ThemeIcon.asClassName(Codicon.splitHorizontal),
|
|
459
|
+
true,
|
|
460
|
+
async () => {
|
|
461
|
+
this._runForSelectionOrInstance(instance, async (e) => {
|
|
462
|
+
this._terminalService.createTerminal({ location: { parentTerminal: e } });
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
))),
|
|
466
|
+
];
|
|
467
|
+
if (instance.shellLaunchConfig.tabActions) {
|
|
468
|
+
for (const action of instance.shellLaunchConfig.tabActions) {
|
|
469
|
+
actions.push(template.elementDisposables.add(( new Action(
|
|
470
|
+
action.id,
|
|
471
|
+
action.label,
|
|
472
|
+
action.icon ? ThemeIcon.asClassName(action.icon) : undefined,
|
|
473
|
+
true,
|
|
474
|
+
async () => {
|
|
475
|
+
this._runForSelectionOrInstance(instance, e => this._commandService.executeCommand(action.id, instance));
|
|
476
|
+
}
|
|
477
|
+
))));
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
actions.push(template.elementDisposables.add(( new Action(
|
|
481
|
+
TerminalCommandId.KillActiveTab,
|
|
482
|
+
terminalStrings.kill.short,
|
|
483
|
+
ThemeIcon.asClassName(Codicon.trashcan),
|
|
484
|
+
true,
|
|
485
|
+
async () => {
|
|
486
|
+
this._runForSelectionOrInstance(instance, e => this._terminalService.safeDisposeTerminal(e));
|
|
487
|
+
}
|
|
488
|
+
))));
|
|
489
|
+
template.actionBar.clear();
|
|
490
|
+
for (const action of actions) {
|
|
491
|
+
template.actionBar.push(action, { icon: true, label: false, keybinding: this._keybindingService.lookupKeybinding(action.id)?.getLabel() });
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
_runForSelectionOrInstance(instance, callback) {
|
|
495
|
+
const selection = this._getSelection();
|
|
496
|
+
if (selection.includes(instance)) {
|
|
497
|
+
for (const s of selection) {
|
|
498
|
+
if (s) {
|
|
499
|
+
callback(s);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
else {
|
|
504
|
+
callback(instance);
|
|
505
|
+
}
|
|
506
|
+
this._terminalGroupService.focusTabs();
|
|
507
|
+
this._listService.lastFocusedList?.focusNext();
|
|
508
|
+
}
|
|
509
|
+
};
|
|
510
|
+
TerminalTabsRenderer = ( __decorate([
|
|
511
|
+
( __param(3, IInstantiationService)),
|
|
512
|
+
( __param(4, ITerminalConfigurationService)),
|
|
513
|
+
( __param(5, ITerminalService)),
|
|
514
|
+
( __param(6, ITerminalGroupService)),
|
|
515
|
+
( __param(7, ITerminalEditingService)),
|
|
516
|
+
( __param(8, IHoverService)),
|
|
517
|
+
( __param(9, IKeybindingService)),
|
|
518
|
+
( __param(10, IListService)),
|
|
519
|
+
( __param(11, IStorageService)),
|
|
520
|
+
( __param(12, IThemeService)),
|
|
521
|
+
( __param(13, IContextViewService)),
|
|
522
|
+
( __param(14, ICommandService))
|
|
523
|
+
], TerminalTabsRenderer));
|
|
524
|
+
let TerminalTabsAccessibilityProvider = class TerminalTabsAccessibilityProvider {
|
|
525
|
+
constructor(_terminalGroupService) {
|
|
526
|
+
this._terminalGroupService = _terminalGroupService;
|
|
527
|
+
}
|
|
528
|
+
getWidgetAriaLabel() {
|
|
529
|
+
return localize(11630, "Terminal tabs");
|
|
530
|
+
}
|
|
531
|
+
getAriaLabel(instance) {
|
|
532
|
+
let ariaLabel = '';
|
|
533
|
+
const tab = this._terminalGroupService.getGroupForInstance(instance);
|
|
534
|
+
if (tab && tab.terminalInstances?.length > 1) {
|
|
535
|
+
const terminalIndex = tab.terminalInstances.indexOf(instance);
|
|
536
|
+
ariaLabel = ( localize(
|
|
537
|
+
11631,
|
|
538
|
+
"Terminal {0} {1}, split {2} of {3}",
|
|
539
|
+
instance.instanceId,
|
|
540
|
+
instance.title,
|
|
541
|
+
terminalIndex + 1,
|
|
542
|
+
tab.terminalInstances.length
|
|
543
|
+
));
|
|
544
|
+
}
|
|
545
|
+
else {
|
|
546
|
+
ariaLabel = ( localize(11632, "Terminal {0} {1}", instance.instanceId, instance.title));
|
|
547
|
+
}
|
|
548
|
+
return ariaLabel;
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
TerminalTabsAccessibilityProvider = ( __decorate([
|
|
552
|
+
( __param(0, ITerminalGroupService))
|
|
553
|
+
], TerminalTabsAccessibilityProvider));
|
|
554
|
+
let TerminalTabsDragAndDrop = class TerminalTabsDragAndDrop extends Disposable {
|
|
555
|
+
constructor(_terminalService, _terminalGroupService, _terminalEditingService, _listService) {
|
|
556
|
+
super();
|
|
557
|
+
this._terminalService = _terminalService;
|
|
558
|
+
this._terminalGroupService = _terminalGroupService;
|
|
559
|
+
this._terminalEditingService = _terminalEditingService;
|
|
560
|
+
this._listService = _listService;
|
|
561
|
+
this._autoFocusDisposable = Disposable.None;
|
|
562
|
+
this._primaryBackend = this._terminalService.getPrimaryBackend();
|
|
563
|
+
}
|
|
564
|
+
getDragURI(instance) {
|
|
565
|
+
if (this._terminalEditingService.getEditingTerminal()?.instanceId === instance.instanceId) {
|
|
566
|
+
return null;
|
|
567
|
+
}
|
|
568
|
+
return ( instance.resource.toString());
|
|
569
|
+
}
|
|
570
|
+
getDragLabel(elements, originalEvent) {
|
|
571
|
+
return elements.length === 1 ? elements[0].title : undefined;
|
|
572
|
+
}
|
|
573
|
+
onDragLeave() {
|
|
574
|
+
this._autoFocusInstance = undefined;
|
|
575
|
+
this._autoFocusDisposable.dispose();
|
|
576
|
+
this._autoFocusDisposable = Disposable.None;
|
|
577
|
+
}
|
|
578
|
+
onDragStart(data, originalEvent) {
|
|
579
|
+
if (!originalEvent.dataTransfer) {
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
const dndData = data.getData();
|
|
583
|
+
if (!Array.isArray(dndData)) {
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
586
|
+
const terminals = dndData.filter(isTerminalInstance);
|
|
587
|
+
if (terminals.length > 0) {
|
|
588
|
+
originalEvent.dataTransfer.setData(TerminalDataTransfers.Terminals, JSON.stringify(( terminals.map(e => ( e.resource.toString())))));
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
onDragOver(data, targetInstance, targetIndex, targetSector, originalEvent) {
|
|
592
|
+
if (data instanceof NativeDragAndDropData) {
|
|
593
|
+
if (!containsDragType(originalEvent, DataTransfers.FILES, DataTransfers.RESOURCES, TerminalDataTransfers.Terminals, CodeDataTransfers.FILES)) {
|
|
594
|
+
return false;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
const didChangeAutoFocusInstance = this._autoFocusInstance !== targetInstance;
|
|
598
|
+
if (didChangeAutoFocusInstance) {
|
|
599
|
+
this._autoFocusDisposable.dispose();
|
|
600
|
+
this._autoFocusInstance = targetInstance;
|
|
601
|
+
}
|
|
602
|
+
if (!targetInstance && !containsDragType(originalEvent, TerminalDataTransfers.Terminals)) {
|
|
603
|
+
return data instanceof ElementsDragAndDropData;
|
|
604
|
+
}
|
|
605
|
+
if (didChangeAutoFocusInstance && targetInstance) {
|
|
606
|
+
this._autoFocusDisposable = disposableTimeout(() => {
|
|
607
|
+
this._terminalService.setActiveInstance(targetInstance);
|
|
608
|
+
this._autoFocusInstance = undefined;
|
|
609
|
+
}, 500, this._store);
|
|
610
|
+
}
|
|
611
|
+
return {
|
|
612
|
+
feedback: targetIndex ? [targetIndex] : undefined,
|
|
613
|
+
accept: true,
|
|
614
|
+
effect: { type: ListDragOverEffectType.Move, position: ListDragOverEffectPosition.Over }
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
async drop(data, targetInstance, targetIndex, targetSector, originalEvent) {
|
|
618
|
+
this._autoFocusDisposable.dispose();
|
|
619
|
+
this._autoFocusInstance = undefined;
|
|
620
|
+
let sourceInstances;
|
|
621
|
+
const promises = [];
|
|
622
|
+
const resources = getTerminalResourcesFromDragEvent(originalEvent);
|
|
623
|
+
if (resources) {
|
|
624
|
+
for (const uri of resources) {
|
|
625
|
+
const instance = this._terminalService.getInstanceFromResource(uri);
|
|
626
|
+
if (instance) {
|
|
627
|
+
if (Array.isArray(sourceInstances)) {
|
|
628
|
+
sourceInstances.push(instance);
|
|
629
|
+
}
|
|
630
|
+
else {
|
|
631
|
+
sourceInstances = [instance];
|
|
632
|
+
}
|
|
633
|
+
this._terminalService.moveToTerminalView(instance);
|
|
634
|
+
}
|
|
635
|
+
else if (this._primaryBackend) {
|
|
636
|
+
const terminalIdentifier = parseTerminalUri(uri);
|
|
637
|
+
if (terminalIdentifier.instanceId) {
|
|
638
|
+
promises.push(this._primaryBackend.requestDetachInstance(terminalIdentifier.workspaceId, terminalIdentifier.instanceId));
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
if (promises.length) {
|
|
644
|
+
let processes = await Promise.all(promises);
|
|
645
|
+
processes = processes.filter(p => p !== undefined);
|
|
646
|
+
let lastInstance;
|
|
647
|
+
for (const attachPersistentProcess of processes) {
|
|
648
|
+
lastInstance = await this._terminalService.createTerminal({ config: { attachPersistentProcess } });
|
|
649
|
+
}
|
|
650
|
+
if (lastInstance) {
|
|
651
|
+
this._terminalService.setActiveInstance(lastInstance);
|
|
652
|
+
}
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
if (sourceInstances === undefined) {
|
|
656
|
+
if (!(data instanceof ElementsDragAndDropData)) {
|
|
657
|
+
this._handleExternalDrop(targetInstance, originalEvent);
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
const draggedElement = data.getData();
|
|
661
|
+
if (!draggedElement || !Array.isArray(draggedElement)) {
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
sourceInstances = [];
|
|
665
|
+
for (const e of draggedElement) {
|
|
666
|
+
if (isTerminalInstance(e)) {
|
|
667
|
+
sourceInstances.push(e);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
if (!targetInstance) {
|
|
672
|
+
this._terminalGroupService.moveGroupToEnd(sourceInstances);
|
|
673
|
+
this._terminalService.setActiveInstance(sourceInstances[0]);
|
|
674
|
+
const targetGroup = this._terminalGroupService.getGroupForInstance(sourceInstances[0]);
|
|
675
|
+
if (targetGroup) {
|
|
676
|
+
const index = this._terminalGroupService.groups.indexOf(targetGroup);
|
|
677
|
+
this._listService.lastFocusedList?.setSelection([index]);
|
|
678
|
+
}
|
|
679
|
+
return;
|
|
680
|
+
}
|
|
681
|
+
this._terminalGroupService.moveGroup(sourceInstances, targetInstance);
|
|
682
|
+
this._terminalService.setActiveInstance(sourceInstances[0]);
|
|
683
|
+
const targetGroup = this._terminalGroupService.getGroupForInstance(sourceInstances[0]);
|
|
684
|
+
if (targetGroup) {
|
|
685
|
+
const index = this._terminalGroupService.groups.indexOf(targetGroup);
|
|
686
|
+
this._listService.lastFocusedList?.setSelection([index]);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
async _handleExternalDrop(instance, e) {
|
|
690
|
+
if (!instance || !e.dataTransfer) {
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
let resource;
|
|
694
|
+
const rawResources = e.dataTransfer.getData(DataTransfers.RESOURCES);
|
|
695
|
+
if (rawResources) {
|
|
696
|
+
resource = ( URI.parse(JSON.parse(rawResources)[0]));
|
|
697
|
+
}
|
|
698
|
+
const rawCodeFiles = e.dataTransfer.getData(CodeDataTransfers.FILES);
|
|
699
|
+
if (!resource && rawCodeFiles) {
|
|
700
|
+
resource = URI.file(JSON.parse(rawCodeFiles)[0]);
|
|
701
|
+
}
|
|
702
|
+
if (!resource && e.dataTransfer.files.length > 0 && getPathForFile(e.dataTransfer.files[0])) {
|
|
703
|
+
resource = URI.file(getPathForFile(e.dataTransfer.files[0]));
|
|
704
|
+
}
|
|
705
|
+
if (!resource) {
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
this._terminalService.setActiveInstance(instance);
|
|
709
|
+
instance.focus();
|
|
710
|
+
await instance.sendPath(resource, false);
|
|
711
|
+
}
|
|
712
|
+
};
|
|
713
|
+
TerminalTabsDragAndDrop = ( __decorate([
|
|
714
|
+
( __param(0, ITerminalService)),
|
|
715
|
+
( __param(1, ITerminalGroupService)),
|
|
716
|
+
( __param(2, ITerminalEditingService)),
|
|
717
|
+
( __param(3, IListService))
|
|
718
|
+
], TerminalTabsDragAndDrop));
|
|
719
|
+
let TabDecorationsProvider = class TabDecorationsProvider extends Disposable {
|
|
720
|
+
constructor(_terminalService) {
|
|
721
|
+
super();
|
|
722
|
+
this._terminalService = _terminalService;
|
|
723
|
+
this.label = ( localize(11633, "Terminal"));
|
|
724
|
+
this._onDidChange = this._register(( new Emitter()));
|
|
725
|
+
this.onDidChange = this._onDidChange.event;
|
|
726
|
+
this._register(this._terminalService.onAnyInstancePrimaryStatusChange(e => this._onDidChange.fire([e.resource])));
|
|
727
|
+
}
|
|
728
|
+
provideDecorations(resource) {
|
|
729
|
+
if (resource.scheme !== Schemas.vscodeTerminal) {
|
|
730
|
+
return undefined;
|
|
731
|
+
}
|
|
732
|
+
const instance = this._terminalService.getInstanceFromResource(resource);
|
|
733
|
+
if (!instance) {
|
|
734
|
+
return undefined;
|
|
735
|
+
}
|
|
736
|
+
const primaryStatus = instance?.statusList?.primary;
|
|
737
|
+
if (!primaryStatus?.icon) {
|
|
738
|
+
return undefined;
|
|
739
|
+
}
|
|
740
|
+
return {
|
|
741
|
+
color: getColorForSeverity(primaryStatus.severity),
|
|
742
|
+
letter: primaryStatus.icon,
|
|
743
|
+
tooltip: primaryStatus.tooltip
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
TabDecorationsProvider = ( __decorate([
|
|
748
|
+
( __param(0, ITerminalService))
|
|
749
|
+
], TabDecorationsProvider));
|
|
750
|
+
function isTerminalInstance(obj) {
|
|
751
|
+
return isObject(obj) && 'instanceId' in obj;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
export { TerminalTabList, TerminalTabsListSizes };
|