mirror of
https://github.com/Microsoft/vscode
synced 2024-10-04 02:14:06 +00:00
fix #127157
This commit is contained in:
parent
92418e0ea0
commit
f5e9925a8b
|
@ -1,12 +0,0 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export const enum TerminalContextKey {
|
||||
TerminalIsOpen = 'terminalIsOpen',
|
||||
TerminalCount = 'terminalCount',
|
||||
TerminalGroupCount = 'terminalGroupCount',
|
||||
TerminalTabsNarrow = 'isTerminalTabsNarrow',
|
||||
TerminalProcessSupported = 'terminalProcessSupported'
|
||||
}
|
|
@ -38,7 +38,6 @@ import { KeyCode } from 'vs/base/common/keyCodes';
|
|||
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { IsMacNativeContext, IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { TerminalContextKey } from 'vs/platform/terminal/common/terminalContextKey';
|
||||
|
||||
export type IOpenRecentAction = IAction & { uri: URI, remoteAuthority?: string };
|
||||
|
||||
|
@ -100,7 +99,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
|
|||
mnemonicTitle: localize({ key: 'mTerminal', comment: ['&& denotes a mnemonic'] }, "&&Terminal")
|
||||
},
|
||||
order: 7,
|
||||
when: ContextKeyExpr.has(TerminalContextKey.TerminalProcessSupported)
|
||||
when: ContextKeyExpr.has('terminalProcessSupported')
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
|
||||
|
|
|
@ -11,7 +11,7 @@ import { ContextKeyAndExpr, ContextKeyEqualsExpr, ContextKeyExpr } from 'vs/plat
|
|||
import { TerminalSettingId } from 'vs/platform/terminal/common/terminal';
|
||||
import { ResourceContextKey } from 'vs/workbench/common/resources';
|
||||
import { IS_SPLIT_TERMINAL_CONTEXT_KEY, KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED, KEYBINDING_CONTEXT_TERMINAL_TABS_SINGULAR_SELECTION, TerminalCommandId, TERMINAL_VIEW_ID } from 'vs/workbench/contrib/terminal/common/terminal';
|
||||
import { TerminalContextKey } from 'vs/platform/terminal/common/terminalContextKey';
|
||||
import { TerminalContextKey } from 'vs/workbench/contrib/terminal/common/terminalContextKey';
|
||||
import { terminalStrings } from 'vs/workbench/contrib/terminal/common/terminalStrings';
|
||||
|
||||
const enum ContextMenuGroup {
|
||||
|
@ -56,7 +56,7 @@ export function setupTerminalMenus(): void {
|
|||
command: {
|
||||
id: TerminalCommandId.Split,
|
||||
title: localize({ key: 'miSplitTerminal', comment: ['&& denotes a mnemonic'] }, "&&Split Terminal"),
|
||||
precondition: ContextKeyExpr.has(TerminalContextKey.TerminalIsOpen)
|
||||
precondition: ContextKeyExpr.has(TerminalContextKey.IsOpen)
|
||||
},
|
||||
order: 2,
|
||||
when: KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED
|
||||
|
@ -261,18 +261,18 @@ export function setupTerminalMenus(): void {
|
|||
ContextKeyExpr.or(
|
||||
ContextKeyExpr.and(
|
||||
ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActiveTerminal}`, 'singleTerminal'),
|
||||
ContextKeyExpr.equals(TerminalContextKey.TerminalCount, 1)
|
||||
ContextKeyExpr.equals(TerminalContextKey.Count, 1)
|
||||
),
|
||||
ContextKeyExpr.and(
|
||||
ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActiveTerminal}`, 'singleTerminalOrNarrow'),
|
||||
ContextKeyExpr.or(
|
||||
ContextKeyExpr.equals(TerminalContextKey.TerminalCount, 1),
|
||||
ContextKeyExpr.has(TerminalContextKey.TerminalTabsNarrow)
|
||||
ContextKeyExpr.equals(TerminalContextKey.Count, 1),
|
||||
ContextKeyExpr.has(TerminalContextKey.TabsNarrow)
|
||||
)
|
||||
),
|
||||
ContextKeyExpr.and(
|
||||
ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActiveTerminal}`, 'singleGroup'),
|
||||
ContextKeyExpr.equals(TerminalContextKey.TerminalGroupCount, 1)
|
||||
ContextKeyExpr.equals(TerminalContextKey.GroupCount, 1)
|
||||
),
|
||||
ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActiveTerminal}`, 'always')
|
||||
)
|
||||
|
@ -295,18 +295,18 @@ export function setupTerminalMenus(): void {
|
|||
ContextKeyExpr.not(`config.${TerminalSettingId.TabsEnabled}`),
|
||||
ContextKeyExpr.and(
|
||||
ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActions}`, 'singleTerminal'),
|
||||
ContextKeyExpr.equals(TerminalContextKey.TerminalCount, 1)
|
||||
ContextKeyExpr.equals(TerminalContextKey.Count, 1)
|
||||
),
|
||||
ContextKeyExpr.and(
|
||||
ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActions}`, 'singleTerminalOrNarrow'),
|
||||
ContextKeyExpr.or(
|
||||
ContextKeyExpr.equals(TerminalContextKey.TerminalCount, 1),
|
||||
ContextKeyExpr.has(TerminalContextKey.TerminalTabsNarrow)
|
||||
ContextKeyExpr.equals(TerminalContextKey.Count, 1),
|
||||
ContextKeyExpr.has(TerminalContextKey.TabsNarrow)
|
||||
)
|
||||
),
|
||||
ContextKeyExpr.and(
|
||||
ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActions}`, 'singleGroup'),
|
||||
ContextKeyExpr.equals(TerminalContextKey.TerminalGroupCount, 1)
|
||||
ContextKeyExpr.equals(TerminalContextKey.GroupCount, 1)
|
||||
),
|
||||
ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActions}`, 'always')
|
||||
)
|
||||
|
@ -329,18 +329,18 @@ export function setupTerminalMenus(): void {
|
|||
ContextKeyExpr.not(`config.${TerminalSettingId.TabsEnabled}`),
|
||||
ContextKeyExpr.and(
|
||||
ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActions}`, 'singleTerminal'),
|
||||
ContextKeyExpr.equals(TerminalContextKey.TerminalCount, 1)
|
||||
ContextKeyExpr.equals(TerminalContextKey.Count, 1)
|
||||
),
|
||||
ContextKeyExpr.and(
|
||||
ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActions}`, 'singleTerminalOrNarrow'),
|
||||
ContextKeyExpr.or(
|
||||
ContextKeyExpr.equals(TerminalContextKey.TerminalCount, 1),
|
||||
ContextKeyExpr.has(TerminalContextKey.TerminalTabsNarrow)
|
||||
ContextKeyExpr.equals(TerminalContextKey.Count, 1),
|
||||
ContextKeyExpr.has(TerminalContextKey.TabsNarrow)
|
||||
)
|
||||
),
|
||||
ContextKeyExpr.and(
|
||||
ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActions}`, 'singleGroup'),
|
||||
ContextKeyExpr.equals(TerminalContextKey.TerminalGroupCount, 1)
|
||||
ContextKeyExpr.equals(TerminalContextKey.GroupCount, 1)
|
||||
),
|
||||
ContextKeyExpr.equals(`config.${TerminalSettingId.TabsShowActions}`, 'always')
|
||||
)
|
||||
|
|
|
@ -13,63 +13,64 @@ import { IProcessDataEvent, IProcessReadyEvent, IShellLaunchConfig, ITerminalDim
|
|||
import { IEnvironmentVariableInfo } from 'vs/workbench/contrib/terminal/common/environmentVariable';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { TerminalContextKey } from 'vs/workbench/contrib/terminal/common/terminalContextKey';
|
||||
|
||||
export const TERMINAL_VIEW_ID = 'terminal';
|
||||
|
||||
/** A context key that is set when there is at least one opened integrated terminal. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_IS_OPEN = new RawContextKey<boolean>('terminalIsOpen', false, true);
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_IS_OPEN = new RawContextKey<boolean>(TerminalContextKey.IsOpen, false, true);
|
||||
|
||||
/** A context key that is set when the integrated terminal has focus. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_FOCUS = new RawContextKey<boolean>('terminalFocus', false, nls.localize('terminalFocusContextKey', "Whether the terminal is focused"));
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_FOCUS = new RawContextKey<boolean>(TerminalContextKey.Focus, false, nls.localize('terminalFocusContextKey', "Whether the terminal is focused"));
|
||||
|
||||
/** A context key that is set to the current number of integrated terminals in the terminal groups. */
|
||||
export const KEYBINDING_CONTEXT_GROUP_TERMINAL_COUNT = new RawContextKey<number>('terminalCount', 0, nls.localize('terminalCountContextKey', "The current number of terminals"));
|
||||
export const KEYBINDING_CONTEXT_GROUP_TERMINAL_COUNT = new RawContextKey<number>(TerminalContextKey.Count, 0, nls.localize('terminalCountContextKey', "The current number of terminals"));
|
||||
|
||||
/** A context key that is set to the current number of integrated terminals. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_GROUP_COUNT = new RawContextKey<number>('terminalGroupCount', 0, nls.localize('terminalGroupCountContextKey', "The current number of terminal groups"));
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_GROUP_COUNT = new RawContextKey<number>(TerminalContextKey.GroupCount, 0, nls.localize('terminalGroupCountContextKey', "The current number of terminal groups"));
|
||||
|
||||
/** A context key that is set when the terminal tabs view is narrow. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_IS_TABS_NARROW_FOCUS = new RawContextKey<boolean>('isTerminalTabsNarrow', false, true);
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_IS_TABS_NARROW_FOCUS = new RawContextKey<boolean>(TerminalContextKey.TabsNarrow, false, true);
|
||||
|
||||
/** A context key that is set when the integrated terminal tabs widget has focus. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_TABS_FOCUS = new RawContextKey<boolean>('terminalTabsFocus', false, nls.localize('terminalTabsFocusContextKey', "Whether the terminal tabs widget is focused"));
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_TABS_FOCUS = new RawContextKey<boolean>(TerminalContextKey.TabsFocus, false, nls.localize('terminalTabsFocusContextKey', "Whether the terminal tabs widget is focused"));
|
||||
|
||||
/** A context key that is set when the integrated terminal tabs widget has the mouse focus. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_TABS_MOUSE = new RawContextKey<boolean>('terminalTabsMouse', false, undefined);
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_TABS_MOUSE = new RawContextKey<boolean>(TerminalContextKey.TabsMouse, false, undefined);
|
||||
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_SHELL_TYPE_KEY = 'terminalShellType';
|
||||
/** A context key that is set to the detected shell for the most recently active terminal, this is set to the last known value when no terminals exist. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_SHELL_TYPE = new RawContextKey<string>(KEYBINDING_CONTEXT_TERMINAL_SHELL_TYPE_KEY, undefined, { type: 'string', description: nls.localize('terminalShellTypeContextKey', "The shell type of the active terminal") });
|
||||
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_ALT_BUFFER_ACTIVE = new RawContextKey<boolean>('terminalAltBufferActive', false, true);
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_ALT_BUFFER_ACTIVE = new RawContextKey<boolean>(TerminalContextKey.AltBufferActive, false, true);
|
||||
|
||||
/** A context key that is set when the integrated terminal does not have focus. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_NOT_FOCUSED = KEYBINDING_CONTEXT_TERMINAL_FOCUS.toNegated();
|
||||
|
||||
/** A context key that is set when the user is navigating the accessibility tree */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_A11Y_TREE_FOCUS = new RawContextKey<boolean>('terminalA11yTreeFocus', false, true);
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_A11Y_TREE_FOCUS = new RawContextKey<boolean>(TerminalContextKey.A11yTreeFocus, false, true);
|
||||
|
||||
/** A keybinding context key that is set when the integrated terminal has text selected. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED = new RawContextKey<boolean>('terminalTextSelected', false, nls.localize('terminalTextSelectedContextKey', "Whether text is selected in the active terminal"));
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED = new RawContextKey<boolean>(TerminalContextKey.TextSelected, false, nls.localize('terminalTextSelectedContextKey', "Whether text is selected in the active terminal"));
|
||||
/** A keybinding context key that is set when the integrated terminal does not have text selected. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_TEXT_NOT_SELECTED = KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED.toNegated();
|
||||
|
||||
/** A context key that is set when the find widget in integrated terminal is visible. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_FIND_VISIBLE = new RawContextKey<boolean>('terminalFindVisible', false, true);
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_FIND_VISIBLE = new RawContextKey<boolean>(TerminalContextKey.FindVisible, false, true);
|
||||
/** A context key that is set when the find widget in integrated terminal is not visible. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_FIND_NOT_VISIBLE = KEYBINDING_CONTEXT_TERMINAL_FIND_VISIBLE.toNegated();
|
||||
/** A context key that is set when the find widget find input in integrated terminal is focused. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_FIND_INPUT_FOCUSED = new RawContextKey<boolean>('terminalFindInputFocused', false, true);
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_FIND_INPUT_FOCUSED = new RawContextKey<boolean>(TerminalContextKey.FindInputFocused, false, true);
|
||||
/** A context key that is set when the find widget in integrated terminal is focused. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_FIND_FOCUSED = new RawContextKey<boolean>('terminalFindFocused', false, true);
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_FIND_FOCUSED = new RawContextKey<boolean>(TerminalContextKey.FindFocused, false, true);
|
||||
/** A context key that is set when the find widget find input in integrated terminal is not focused. */
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_FIND_INPUT_NOT_FOCUSED = KEYBINDING_CONTEXT_TERMINAL_FIND_INPUT_FOCUSED.toNegated();
|
||||
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED = new RawContextKey<boolean>('terminalProcessSupported', false, nls.localize('terminalProcessSupportedContextKey', "Whether terminal processes can be launched"));
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_PROCESS_SUPPORTED = new RawContextKey<boolean>(TerminalContextKey.ProcessSupported, false, nls.localize('terminalProcessSupportedContextKey', "Whether terminal processes can be launched"));
|
||||
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_TABS_SINGULAR_SELECTION = new RawContextKey<boolean>('terminalTabsSingularSelection', false, nls.localize('terminalTabsSingularSelectedContextKey', "Whether one terminal tab is selected"));
|
||||
export const KEYBINDING_CONTEXT_TERMINAL_TABS_SINGULAR_SELECTION = new RawContextKey<boolean>(TerminalContextKey.TabsSingularSelection, false, nls.localize('terminalTabsSingularSelectedContextKey', "Whether one terminal tab is selected"));
|
||||
|
||||
export const IS_SPLIT_TERMINAL_CONTEXT_KEY = new RawContextKey<boolean>('isSplitTerminal', false, nls.localize('isSplitTerminalContextKey', "Whether or not the focused tab's terminal is a split terminal"));
|
||||
export const IS_SPLIT_TERMINAL_CONTEXT_KEY = new RawContextKey<boolean>(TerminalContextKey.SplitTerminal, false, nls.localize('isSplitTerminalContextKey', "Whether or not the focused tab's terminal is a split terminal"));
|
||||
|
||||
export const NEVER_MEASURE_RENDER_TIME_STORAGE_KEY = 'terminal.integrated.neverMeasureRenderTime';
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
export const enum TerminalContextKey {
|
||||
IsOpen = 'terminalIsOpen',
|
||||
Count = 'terminalCount',
|
||||
GroupCount = 'terminalGroupCount',
|
||||
TabsNarrow = 'isTerminalTabsNarrow',
|
||||
ProcessSupported = 'terminalProcessSupported',
|
||||
Focus = 'terminalFocus',
|
||||
TabsFocus = 'terminalTabsFocus',
|
||||
TabsMouse = 'terminalTabsMouse',
|
||||
AltBufferActive = 'terminalAltBufferActive',
|
||||
A11yTreeFocus = 'terminalA11yTreeFocus',
|
||||
TextSelected = 'terminalTextSelected',
|
||||
FindVisible = 'terminalFindVisible',
|
||||
FindInputFocused = 'terminalFindInputFocused',
|
||||
FindFocused = 'terminalFindFocused',
|
||||
TabsSingularSelection = 'terminalTabsSingularSelection',
|
||||
SplitTerminal = 'terminalSplitTerminal'
|
||||
}
|
Loading…
Reference in a new issue