Skip to content

Commit 1bccb28

Browse files
committed
Move terminal selection/command tools to core
Part of microsoft#259260 Fixes microsoft#261031 Fixes microsoft#259198
1 parent 61f1c11 commit 1bccb28

File tree

10 files changed

+292
-68
lines changed

10 files changed

+292
-68
lines changed

src/vs/platform/actions/common/actions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ export class MenuId {
253253
static readonly ChatAttachmentsContext = new MenuId('ChatAttachmentsContext');
254254
static readonly ChatToolOutputResourceToolbar = new MenuId('ChatToolOutputResourceToolbar');
255255
static readonly ChatTextEditorMenu = new MenuId('ChatTextEditorMenu');
256-
static readonly ChatTerminalMenu = new MenuId('ChatTerminalMenu');
257256
static readonly ChatToolOutputResourceContext = new MenuId('ChatToolOutputResourceContext');
258257
static readonly ChatSessionsMenu = new MenuId('ChatSessionsMenu');
259258
static readonly ChatConfirmationMenu = new MenuId('ChatConfirmationMenu');

src/vs/workbench/contrib/chat/browser/actions/chatActions.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,13 +1488,6 @@ MenuRegistry.appendMenuItem(MenuId.EditorContext, {
14881488
when: menuContext
14891489
});
14901490

1491-
MenuRegistry.appendMenuItem(MenuId.TerminalInstanceContext, {
1492-
submenu: MenuId.ChatTerminalMenu,
1493-
group: '2_copilot',
1494-
title,
1495-
when: menuContext
1496-
});
1497-
14981491
// --- Chat Default Visibility
14991492

15001493
registerAction2(class ToggleDefaultVisibilityAction extends Action2 {

src/vs/workbench/contrib/terminal/browser/terminalInstance.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
454454

455455
this._terminalFocusContextKey = TerminalContextKeys.focus.bindTo(scopedContextKeyService);
456456
this._terminalHasFixedWidth = TerminalContextKeys.terminalHasFixedWidth.bindTo(scopedContextKeyService);
457-
this._terminalHasTextContextKey = TerminalContextKeys.textSelected.bindTo(scopedContextKeyService);
457+
this._terminalHasTextContextKey = TerminalContextKeys.textSelected.bindTo(this._contextKeyService);
458458
this._terminalAltBufferActiveContextKey = TerminalContextKeys.altBufferActive.bindTo(scopedContextKeyService);
459459
this._terminalShellIntegrationEnabledContextKey = TerminalContextKeys.terminalShellIntegrationEnabled.bindTo(scopedContextKeyService);
460460

src/vs/workbench/contrib/terminal/browser/terminalMenus.ts

Lines changed: 29 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { terminalStrings } from '../common/terminalStrings.js';
1919
import { ACTIVE_GROUP, AUX_WINDOW_GROUP, SIDE_GROUP } from '../../../services/editor/common/editorService.js';
2020
import { DisposableStore } from '../../../../base/common/lifecycle.js';
2121

22-
const enum ContextMenuGroup {
22+
export const enum TerminalContextMenuGroup {
2323
Create = '1_create',
2424
Edit = '3_edit',
2525
Clear = '5_clear',
@@ -103,34 +103,14 @@ export function setupTerminalMenus(): void {
103103

104104
MenuRegistry.appendMenuItems(
105105
[
106-
{
107-
id: MenuId.TerminalInstanceContext,
108-
item: {
109-
group: ContextMenuGroup.Create,
110-
command: {
111-
id: TerminalCommandId.Split,
112-
title: terminalStrings.split.value
113-
}
114-
}
115-
},
116-
{
117-
id: MenuId.TerminalInstanceContext,
118-
item: {
119-
command: {
120-
id: TerminalCommandId.New,
121-
title: terminalStrings.new
122-
},
123-
group: ContextMenuGroup.Create
124-
}
125-
},
126106
{
127107
id: MenuId.TerminalInstanceContext,
128108
item: {
129109
command: {
130110
id: TerminalCommandId.KillViewOrEditor,
131111
title: terminalStrings.kill.value,
132112
},
133-
group: ContextMenuGroup.Kill
113+
group: TerminalContextMenuGroup.Kill
134114
}
135115
},
136116
{
@@ -140,7 +120,7 @@ export function setupTerminalMenus(): void {
140120
id: TerminalCommandId.CopySelection,
141121
title: localize('workbench.action.terminal.copySelection.short', "Copy")
142122
},
143-
group: ContextMenuGroup.Edit,
123+
group: TerminalContextMenuGroup.Edit,
144124
order: 1
145125
}
146126
},
@@ -151,7 +131,7 @@ export function setupTerminalMenus(): void {
151131
id: TerminalCommandId.CopySelectionAsHtml,
152132
title: localize('workbench.action.terminal.copySelectionAsHtml', "Copy as HTML")
153133
},
154-
group: ContextMenuGroup.Edit,
134+
group: TerminalContextMenuGroup.Edit,
155135
order: 2
156136
}
157137
},
@@ -162,7 +142,7 @@ export function setupTerminalMenus(): void {
162142
id: TerminalCommandId.Paste,
163143
title: localize('workbench.action.terminal.paste.short', "Paste")
164144
},
165-
group: ContextMenuGroup.Edit,
145+
group: TerminalContextMenuGroup.Edit,
166146
order: 3
167147
}
168148
},
@@ -173,7 +153,7 @@ export function setupTerminalMenus(): void {
173153
id: TerminalCommandId.Clear,
174154
title: localize('workbench.action.terminal.clear', "Clear")
175155
},
176-
group: ContextMenuGroup.Clear,
156+
group: TerminalContextMenuGroup.Clear,
177157
}
178158
},
179159
{
@@ -183,7 +163,7 @@ export function setupTerminalMenus(): void {
183163
id: TerminalCommandId.SizeToContentWidth,
184164
title: terminalStrings.toggleSizeToContentWidth
185165
},
186-
group: ContextMenuGroup.Config
166+
group: TerminalContextMenuGroup.Config
187167
}
188168
},
189169

@@ -194,7 +174,7 @@ export function setupTerminalMenus(): void {
194174
id: TerminalCommandId.SelectAll,
195175
title: localize('workbench.action.terminal.selectAll', "Select All"),
196176
},
197-
group: ContextMenuGroup.Edit,
177+
group: TerminalContextMenuGroup.Edit,
198178
order: 3
199179
}
200180
},
@@ -226,7 +206,7 @@ export function setupTerminalMenus(): void {
226206
{
227207
id: MenuId.TerminalEditorInstanceContext,
228208
item: {
229-
group: ContextMenuGroup.Create,
209+
group: TerminalContextMenuGroup.Create,
230210
command: {
231211
id: TerminalCommandId.Split,
232212
title: terminalStrings.split.value
@@ -240,7 +220,7 @@ export function setupTerminalMenus(): void {
240220
id: TerminalCommandId.New,
241221
title: terminalStrings.new
242222
},
243-
group: ContextMenuGroup.Create
223+
group: TerminalContextMenuGroup.Create
244224
}
245225
},
246226
{
@@ -250,7 +230,7 @@ export function setupTerminalMenus(): void {
250230
id: TerminalCommandId.KillEditor,
251231
title: terminalStrings.kill.value
252232
},
253-
group: ContextMenuGroup.Kill
233+
group: TerminalContextMenuGroup.Kill
254234
}
255235
},
256236
{
@@ -260,7 +240,7 @@ export function setupTerminalMenus(): void {
260240
id: TerminalCommandId.CopySelection,
261241
title: localize('workbench.action.terminal.copySelection.short', "Copy")
262242
},
263-
group: ContextMenuGroup.Edit,
243+
group: TerminalContextMenuGroup.Edit,
264244
order: 1
265245
}
266246
},
@@ -271,7 +251,7 @@ export function setupTerminalMenus(): void {
271251
id: TerminalCommandId.CopySelectionAsHtml,
272252
title: localize('workbench.action.terminal.copySelectionAsHtml', "Copy as HTML")
273253
},
274-
group: ContextMenuGroup.Edit,
254+
group: TerminalContextMenuGroup.Edit,
275255
order: 2
276256
}
277257
},
@@ -282,7 +262,7 @@ export function setupTerminalMenus(): void {
282262
id: TerminalCommandId.Paste,
283263
title: localize('workbench.action.terminal.paste.short', "Paste")
284264
},
285-
group: ContextMenuGroup.Edit,
265+
group: TerminalContextMenuGroup.Edit,
286266
order: 3
287267
}
288268
},
@@ -293,7 +273,7 @@ export function setupTerminalMenus(): void {
293273
id: TerminalCommandId.Clear,
294274
title: localize('workbench.action.terminal.clear', "Clear")
295275
},
296-
group: ContextMenuGroup.Clear,
276+
group: TerminalContextMenuGroup.Clear,
297277
}
298278
},
299279
{
@@ -303,7 +283,7 @@ export function setupTerminalMenus(): void {
303283
id: TerminalCommandId.SelectAll,
304284
title: localize('workbench.action.terminal.selectAll', "Select All"),
305285
},
306-
group: ContextMenuGroup.Edit,
286+
group: TerminalContextMenuGroup.Edit,
307287
order: 3
308288
}
309289
},
@@ -314,7 +294,7 @@ export function setupTerminalMenus(): void {
314294
id: TerminalCommandId.SizeToContentWidth,
315295
title: terminalStrings.toggleSizeToContentWidth
316296
},
317-
group: ContextMenuGroup.Config
297+
group: TerminalContextMenuGroup.Config
318298
}
319299
}
320300
]
@@ -329,7 +309,7 @@ export function setupTerminalMenus(): void {
329309
id: TerminalCommandId.NewWithProfile,
330310
title: localize('workbench.action.terminal.newWithProfile.short', "New Terminal With Profile...")
331311
},
332-
group: ContextMenuGroup.Create
312+
group: TerminalContextMenuGroup.Create
333313
}
334314
},
335315
{
@@ -339,7 +319,7 @@ export function setupTerminalMenus(): void {
339319
id: TerminalCommandId.New,
340320
title: terminalStrings.new
341321
},
342-
group: ContextMenuGroup.Create
322+
group: TerminalContextMenuGroup.Create
343323
}
344324
}
345325
]
@@ -551,7 +531,7 @@ export function setupTerminalMenus(): void {
551531
id: TerminalCommandId.SplitActiveTab,
552532
title: terminalStrings.split.value,
553533
},
554-
group: ContextMenuGroup.Create,
534+
group: TerminalContextMenuGroup.Create,
555535
order: 1
556536
}
557537
},
@@ -562,7 +542,7 @@ export function setupTerminalMenus(): void {
562542
id: TerminalCommandId.MoveToEditor,
563543
title: terminalStrings.moveToEditor.value
564544
},
565-
group: ContextMenuGroup.Create,
545+
group: TerminalContextMenuGroup.Create,
566546
order: 2
567547
}
568548
},
@@ -573,7 +553,7 @@ export function setupTerminalMenus(): void {
573553
id: TerminalCommandId.MoveIntoNewWindow,
574554
title: terminalStrings.moveIntoNewWindow.value
575555
},
576-
group: ContextMenuGroup.Create,
556+
group: TerminalContextMenuGroup.Create,
577557
order: 2
578558
}
579559
},
@@ -584,7 +564,7 @@ export function setupTerminalMenus(): void {
584564
id: TerminalCommandId.RenameActiveTab,
585565
title: localize('workbench.action.terminal.renameInstance', "Rename...")
586566
},
587-
group: ContextMenuGroup.Edit
567+
group: TerminalContextMenuGroup.Edit
588568
}
589569
},
590570
{
@@ -594,7 +574,7 @@ export function setupTerminalMenus(): void {
594574
id: TerminalCommandId.ChangeIconActiveTab,
595575
title: localize('workbench.action.terminal.changeIcon', "Change Icon...")
596576
},
597-
group: ContextMenuGroup.Edit
577+
group: TerminalContextMenuGroup.Edit
598578
}
599579
},
600580
{
@@ -604,7 +584,7 @@ export function setupTerminalMenus(): void {
604584
id: TerminalCommandId.ChangeColorActiveTab,
605585
title: localize('workbench.action.terminal.changeColor', "Change Color...")
606586
},
607-
group: ContextMenuGroup.Edit
587+
group: TerminalContextMenuGroup.Edit
608588
}
609589
},
610590
{
@@ -614,7 +594,7 @@ export function setupTerminalMenus(): void {
614594
id: TerminalCommandId.SizeToContentWidth,
615595
title: terminalStrings.toggleSizeToContentWidth
616596
},
617-
group: ContextMenuGroup.Edit
597+
group: TerminalContextMenuGroup.Edit
618598
}
619599
},
620600
{
@@ -625,7 +605,7 @@ export function setupTerminalMenus(): void {
625605
title: localize('workbench.action.terminal.joinInstance', "Join Terminals")
626606
},
627607
when: TerminalContextKeys.tabsSingularSelection.toNegated(),
628-
group: ContextMenuGroup.Config
608+
group: TerminalContextMenuGroup.Config
629609
}
630610
},
631611
{
@@ -636,7 +616,7 @@ export function setupTerminalMenus(): void {
636616
title: terminalStrings.unsplit.value
637617
},
638618
when: ContextKeyExpr.and(TerminalContextKeys.tabsSingularSelection, TerminalContextKeys.splitTerminalTabFocused),
639-
group: ContextMenuGroup.Config
619+
group: TerminalContextMenuGroup.Config
640620
}
641621
},
642622
{
@@ -646,7 +626,7 @@ export function setupTerminalMenus(): void {
646626
id: TerminalCommandId.KillActiveTab,
647627
title: terminalStrings.kill.value
648628
},
649-
group: ContextMenuGroup.Kill,
629+
group: TerminalContextMenuGroup.Kill,
650630
}
651631
}
652632
]

src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { ChatAgentLocation } from '../../../chat/common/constants.js';
1616
import { AbstractInline1ChatAction } from '../../../inlineChat/browser/inlineChatActions.js';
1717
import { isDetachedTerminalInstance } from '../../../terminal/browser/terminal.js';
1818
import { registerActiveXtermAction } from '../../../terminal/browser/terminalActions.js';
19+
import { TerminalContextMenuGroup } from '../../../terminal/browser/terminalMenus.js';
1920
import { TerminalContextKeys } from '../../../terminal/common/terminalContextKey.js';
2021
import { MENU_TERMINAL_CHAT_WIDGET_STATUS, TerminalChatCommandId, TerminalChatContextKeys } from './terminalChat.js';
2122
import { TerminalChatController } from './terminalChatController.js';
@@ -37,9 +38,9 @@ registerActiveXtermAction({
3738
TerminalChatContextKeys.hasChatAgent
3839
),
3940
menu: {
40-
id: MenuId.ChatTerminalMenu,
41-
group: 'copilot',
42-
order: 1
41+
id: MenuId.TerminalInstanceContext,
42+
group: TerminalContextMenuGroup.Create,
43+
order: 2
4344
},
4445
run: (_xterm, _accessor, activeInstance, opts?: unknown) => {
4546
if (isDetachedTerminalInstance(activeInstance)) {

0 commit comments

Comments
 (0)