@codingame/monaco-vscode-keybindings-service-override 1.83.8 → 1.83.9
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/external/tslib/tslib.es6.js +11 -0
- package/index.js +1 -2
- package/keybindings.js +100 -0
- package/monaco.js +162 -0
- package/package.json +4 -3
- package/tools/injection.js +17 -0
- package/vscode/src/vs/base/common/keybindingParser.js +89 -0
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +50 -0
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardMapper.js +24 -0
- package/vscode/src/vs/workbench/browser/contextkeys.js +251 -0
- package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js +29 -0
- package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +1288 -0
- package/vscode/src/vs/workbench/services/commands/common/commandService.js +79 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +919 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +500 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/_.contribution.js +14 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/cz.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de-swiss.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.linux.js +181 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/dk.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/dvorak.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-belgian.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-ext.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-in.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-intl.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-intl.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-uk.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-uk.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.darwin.js +134 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.linux.js +183 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.win.js +168 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es-latin.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.linux.js +181 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.linux.js +181 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/hu.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/it.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/it.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/jp-roman.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/jp.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ko.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.darwin.js +17 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.linux.js +6 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.win.js +23 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/no.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pl.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pl.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt-br.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.linux.js +181 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/sv.win.js +165 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/thai.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/tr.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/zh-hans.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/common/keybindingIO.js +74 -0
- package/vscode/src/vs/workbench/services/keybinding/common/keymapInfo.js +110 -0
- package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.js +888 -0
- package/vscode/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.js +352 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
3
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
4
|
+
import { setConstant, IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
5
|
+
import { IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsIOSContext, IsMobileContext, IsDevelopmentContext, ProductQualityContext, InputFocusedContext } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkeys.js';
|
|
6
|
+
import { RemoteNameContext, VirtualWorkspaceContext, TemporaryWorkspaceContext, HasWebFileSystemAccess, EmbedderIdentifierContext, ActiveEditorContext, ActiveEditorReadonlyContext, ActiveEditorCanToggleReadonlyContext, ActiveEditorCanRevertContext, ActiveEditorCanSplitInGroupContext, ActiveEditorAvailableEditorIdsContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, SideBySideEditorActiveContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, DirtyWorkingCopiesContext, WorkbenchStateContext, WorkspaceFolderCountContext, OpenFolderWorkspaceSupportContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, SplitEditorsVertically, IsFullscreenContext, InEditorZenModeContext, IsCenteredLayoutContext, EditorAreaVisibleContext, EditorTabsVisibleContext, SideBarVisibleContext, PanelPositionContext, PanelVisibleContext, PanelMaximizedContext, PanelAlignmentContext, AuxiliaryBarVisibleContext, applyAvailableEditorIds } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
7
|
+
import { TEXT_DIFF_EDITOR_ID, SIDE_BY_SIDE_EDITOR_ID, EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
|
|
8
|
+
import { addDisposableListener, EventType, trackFocus } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
9
|
+
import { preferredSideBySideGroupDirection, IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
10
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
11
|
+
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
12
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
13
|
+
import { isTemporaryWorkspace, IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
14
|
+
import { positionToString, IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
15
|
+
import { getRemoteName } from 'monaco-editor/esm/vs/platform/remote/common/remoteHosts.js';
|
|
16
|
+
import { getVirtualWorkspaceScheme } from 'vscode/vscode/vs/platform/workspace/common/virtualWorkspace';
|
|
17
|
+
import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService';
|
|
18
|
+
import { isNative } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
19
|
+
import { IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
|
|
20
|
+
import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/panecomposite/browser/panecomposite';
|
|
21
|
+
import { WebFileSystemAccess } from 'monaco-editor/esm/vs/platform/files/browser/webFileSystemAccess.js';
|
|
22
|
+
import { IProductService } from 'monaco-editor/esm/vs/platform/product/common/productService.js';
|
|
23
|
+
import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
24
|
+
|
|
25
|
+
let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disposable {
|
|
26
|
+
constructor(contextKeyService, contextService, configurationService, environmentService, productService, editorService, editorResolverService, editorGroupService, layoutService, paneCompositeService, workingCopyService, fileService) {
|
|
27
|
+
super();
|
|
28
|
+
this.contextKeyService = contextKeyService;
|
|
29
|
+
this.contextService = contextService;
|
|
30
|
+
this.configurationService = configurationService;
|
|
31
|
+
this.environmentService = environmentService;
|
|
32
|
+
this.productService = productService;
|
|
33
|
+
this.editorService = editorService;
|
|
34
|
+
this.editorResolverService = editorResolverService;
|
|
35
|
+
this.editorGroupService = editorGroupService;
|
|
36
|
+
this.layoutService = layoutService;
|
|
37
|
+
this.paneCompositeService = paneCompositeService;
|
|
38
|
+
this.workingCopyService = workingCopyService;
|
|
39
|
+
this.fileService = fileService;
|
|
40
|
+
IsMacContext.bindTo(this.contextKeyService);
|
|
41
|
+
IsLinuxContext.bindTo(this.contextKeyService);
|
|
42
|
+
IsWindowsContext.bindTo(this.contextKeyService);
|
|
43
|
+
IsWebContext.bindTo(this.contextKeyService);
|
|
44
|
+
IsMacNativeContext.bindTo(this.contextKeyService);
|
|
45
|
+
IsIOSContext.bindTo(this.contextKeyService);
|
|
46
|
+
IsMobileContext.bindTo(this.contextKeyService);
|
|
47
|
+
RemoteNameContext.bindTo(this.contextKeyService).set(getRemoteName(this.environmentService.remoteAuthority) || '');
|
|
48
|
+
this.virtualWorkspaceContext = VirtualWorkspaceContext.bindTo(this.contextKeyService);
|
|
49
|
+
this.temporaryWorkspaceContext = TemporaryWorkspaceContext.bindTo(this.contextKeyService);
|
|
50
|
+
this.updateWorkspaceContextKeys();
|
|
51
|
+
HasWebFileSystemAccess.bindTo(this.contextKeyService).set(WebFileSystemAccess.supported(window));
|
|
52
|
+
const isDevelopment = !this.environmentService.isBuilt || this.environmentService.isExtensionDevelopment;
|
|
53
|
+
IsDevelopmentContext.bindTo(this.contextKeyService).set(isDevelopment);
|
|
54
|
+
setConstant(IsDevelopmentContext.key, isDevelopment);
|
|
55
|
+
ProductQualityContext.bindTo(this.contextKeyService).set(this.productService.quality || '');
|
|
56
|
+
EmbedderIdentifierContext.bindTo(this.contextKeyService).set(productService.embedderIdentifier);
|
|
57
|
+
this.activeEditorContext = ActiveEditorContext.bindTo(this.contextKeyService);
|
|
58
|
+
this.activeEditorIsReadonly = ActiveEditorReadonlyContext.bindTo(this.contextKeyService);
|
|
59
|
+
this.activeEditorCanToggleReadonly = ActiveEditorCanToggleReadonlyContext.bindTo(this.contextKeyService);
|
|
60
|
+
this.activeEditorCanRevert = ActiveEditorCanRevertContext.bindTo(this.contextKeyService);
|
|
61
|
+
this.activeEditorCanSplitInGroup = ActiveEditorCanSplitInGroupContext.bindTo(this.contextKeyService);
|
|
62
|
+
this.activeEditorAvailableEditorIds = ActiveEditorAvailableEditorIdsContext.bindTo(this.contextKeyService);
|
|
63
|
+
this.editorsVisibleContext = EditorsVisibleContext.bindTo(this.contextKeyService);
|
|
64
|
+
this.textCompareEditorVisibleContext = TextCompareEditorVisibleContext.bindTo(this.contextKeyService);
|
|
65
|
+
this.textCompareEditorActiveContext = TextCompareEditorActiveContext.bindTo(this.contextKeyService);
|
|
66
|
+
this.sideBySideEditorActiveContext = SideBySideEditorActiveContext.bindTo(this.contextKeyService);
|
|
67
|
+
this.activeEditorGroupEmpty = ActiveEditorGroupEmptyContext.bindTo(this.contextKeyService);
|
|
68
|
+
this.activeEditorGroupIndex = ActiveEditorGroupIndexContext.bindTo(this.contextKeyService);
|
|
69
|
+
this.activeEditorGroupLast = ActiveEditorGroupLastContext.bindTo(this.contextKeyService);
|
|
70
|
+
this.activeEditorGroupLocked = ActiveEditorGroupLockedContext.bindTo(this.contextKeyService);
|
|
71
|
+
this.multipleEditorGroupsContext = MultipleEditorGroupsContext.bindTo(this.contextKeyService);
|
|
72
|
+
this.dirtyWorkingCopiesContext = DirtyWorkingCopiesContext.bindTo(this.contextKeyService);
|
|
73
|
+
this.dirtyWorkingCopiesContext.set(this.workingCopyService.hasDirty);
|
|
74
|
+
this.inputFocusedContext = InputFocusedContext.bindTo(this.contextKeyService);
|
|
75
|
+
this.workbenchStateContext = WorkbenchStateContext.bindTo(this.contextKeyService);
|
|
76
|
+
this.updateWorkbenchStateContextKey();
|
|
77
|
+
this.workspaceFolderCountContext = WorkspaceFolderCountContext.bindTo(this.contextKeyService);
|
|
78
|
+
this.updateWorkspaceFolderCountContextKey();
|
|
79
|
+
this.openFolderWorkspaceSupportContext = OpenFolderWorkspaceSupportContext.bindTo(this.contextKeyService);
|
|
80
|
+
this.openFolderWorkspaceSupportContext.set(isNative || typeof this.environmentService.remoteAuthority === 'string');
|
|
81
|
+
this.emptyWorkspaceSupportContext = EmptyWorkspaceSupportContext.bindTo(this.contextKeyService);
|
|
82
|
+
this.emptyWorkspaceSupportContext.set(isNative || typeof this.environmentService.remoteAuthority === 'string');
|
|
83
|
+
this.enterMultiRootWorkspaceSupportContext = EnterMultiRootWorkspaceSupportContext.bindTo(this.contextKeyService);
|
|
84
|
+
this.enterMultiRootWorkspaceSupportContext.set(isNative || typeof this.environmentService.remoteAuthority === 'string');
|
|
85
|
+
this.splitEditorsVerticallyContext = SplitEditorsVertically.bindTo(this.contextKeyService);
|
|
86
|
+
this.updateSplitEditorsVerticallyContext();
|
|
87
|
+
this.isFullscreenContext = IsFullscreenContext.bindTo(this.contextKeyService);
|
|
88
|
+
this.inZenModeContext = InEditorZenModeContext.bindTo(this.contextKeyService);
|
|
89
|
+
this.isCenteredLayoutContext = IsCenteredLayoutContext.bindTo(this.contextKeyService);
|
|
90
|
+
this.editorAreaVisibleContext = EditorAreaVisibleContext.bindTo(this.contextKeyService);
|
|
91
|
+
this.editorTabsVisibleContext = EditorTabsVisibleContext.bindTo(this.contextKeyService);
|
|
92
|
+
this.sideBarVisibleContext = SideBarVisibleContext.bindTo(this.contextKeyService);
|
|
93
|
+
this.panelPositionContext = PanelPositionContext.bindTo(this.contextKeyService);
|
|
94
|
+
this.panelPositionContext.set(positionToString(this.layoutService.getPanelPosition()));
|
|
95
|
+
this.panelVisibleContext = PanelVisibleContext.bindTo(this.contextKeyService);
|
|
96
|
+
this.panelVisibleContext.set(this.layoutService.isVisible("workbench.parts.panel" ));
|
|
97
|
+
this.panelMaximizedContext = PanelMaximizedContext.bindTo(this.contextKeyService);
|
|
98
|
+
this.panelMaximizedContext.set(this.layoutService.isPanelMaximized());
|
|
99
|
+
this.panelAlignmentContext = PanelAlignmentContext.bindTo(this.contextKeyService);
|
|
100
|
+
this.panelAlignmentContext.set(this.layoutService.getPanelAlignment());
|
|
101
|
+
this.auxiliaryBarVisibleContext = AuxiliaryBarVisibleContext.bindTo(this.contextKeyService);
|
|
102
|
+
this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible("workbench.parts.auxiliarybar" ));
|
|
103
|
+
this.registerListeners();
|
|
104
|
+
}
|
|
105
|
+
registerListeners() {
|
|
106
|
+
this.editorGroupService.whenReady.then(() => {
|
|
107
|
+
this.updateEditorAreaContextKeys();
|
|
108
|
+
this.updateEditorContextKeys();
|
|
109
|
+
});
|
|
110
|
+
this._register(this.editorService.onDidActiveEditorChange(() => this.updateEditorContextKeys()));
|
|
111
|
+
this._register(this.editorService.onDidVisibleEditorsChange(() => this.updateEditorContextKeys()));
|
|
112
|
+
this._register(this.editorGroupService.onDidAddGroup(() => this.updateEditorContextKeys()));
|
|
113
|
+
this._register(this.editorGroupService.onDidRemoveGroup(() => this.updateEditorContextKeys()));
|
|
114
|
+
this._register(this.editorGroupService.onDidChangeGroupIndex(() => this.updateEditorContextKeys()));
|
|
115
|
+
this._register(this.editorGroupService.onDidChangeActiveGroup(() => this.updateEditorGroupContextKeys()));
|
|
116
|
+
this._register(this.editorGroupService.onDidChangeGroupLocked(() => this.updateEditorGroupContextKeys()));
|
|
117
|
+
this._register(this.editorGroupService.onDidChangeEditorPartOptions(() => this.updateEditorAreaContextKeys()));
|
|
118
|
+
this._register(addDisposableListener(window, EventType.FOCUS_IN, () => this.updateInputContextKeys(), true));
|
|
119
|
+
this._register(this.contextService.onDidChangeWorkbenchState(() => this.updateWorkbenchStateContextKey()));
|
|
120
|
+
this._register(this.contextService.onDidChangeWorkspaceFolders(() => {
|
|
121
|
+
this.updateWorkspaceFolderCountContextKey();
|
|
122
|
+
this.updateWorkspaceContextKeys();
|
|
123
|
+
}));
|
|
124
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
125
|
+
if (e.affectsConfiguration('workbench.editor.openSideBySideDirection')) {
|
|
126
|
+
this.updateSplitEditorsVerticallyContext();
|
|
127
|
+
}
|
|
128
|
+
}));
|
|
129
|
+
this._register(this.layoutService.onDidChangeZenMode(enabled => this.inZenModeContext.set(enabled)));
|
|
130
|
+
this._register(this.layoutService.onDidChangeFullscreen(fullscreen => this.isFullscreenContext.set(fullscreen)));
|
|
131
|
+
this._register(this.layoutService.onDidChangeCenteredLayout(centered => this.isCenteredLayoutContext.set(centered)));
|
|
132
|
+
this._register(this.layoutService.onDidChangePanelPosition(position => this.panelPositionContext.set(position)));
|
|
133
|
+
this._register(this.layoutService.onDidChangePanelAlignment(alignment => this.panelAlignmentContext.set(alignment)));
|
|
134
|
+
this._register(this.paneCompositeService.onDidPaneCompositeClose(() => this.updateSideBarContextKeys()));
|
|
135
|
+
this._register(this.paneCompositeService.onDidPaneCompositeOpen(() => this.updateSideBarContextKeys()));
|
|
136
|
+
this._register(this.layoutService.onDidChangePartVisibility(() => {
|
|
137
|
+
this.editorAreaVisibleContext.set(this.layoutService.isVisible("workbench.parts.editor" ));
|
|
138
|
+
this.panelVisibleContext.set(this.layoutService.isVisible("workbench.parts.panel" ));
|
|
139
|
+
this.panelMaximizedContext.set(this.layoutService.isPanelMaximized());
|
|
140
|
+
this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible("workbench.parts.auxiliarybar" ));
|
|
141
|
+
}));
|
|
142
|
+
this._register(this.workingCopyService.onDidChangeDirty(workingCopy => this.dirtyWorkingCopiesContext.set(workingCopy.isDirty() || this.workingCopyService.hasDirty)));
|
|
143
|
+
}
|
|
144
|
+
updateEditorAreaContextKeys() {
|
|
145
|
+
this.editorTabsVisibleContext.set(!!this.editorGroupService.partOptions.showTabs);
|
|
146
|
+
}
|
|
147
|
+
updateEditorContextKeys() {
|
|
148
|
+
const activeEditorPane = this.editorService.activeEditorPane;
|
|
149
|
+
const visibleEditorPanes = this.editorService.visibleEditorPanes;
|
|
150
|
+
this.textCompareEditorActiveContext.set(activeEditorPane?.getId() === TEXT_DIFF_EDITOR_ID);
|
|
151
|
+
this.textCompareEditorVisibleContext.set(( visibleEditorPanes.some(editorPane => editorPane.getId() === TEXT_DIFF_EDITOR_ID)));
|
|
152
|
+
this.sideBySideEditorActiveContext.set(activeEditorPane?.getId() === SIDE_BY_SIDE_EDITOR_ID);
|
|
153
|
+
if (visibleEditorPanes.length > 0) {
|
|
154
|
+
this.editorsVisibleContext.set(true);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
this.editorsVisibleContext.reset();
|
|
158
|
+
}
|
|
159
|
+
if (!this.editorService.activeEditor) {
|
|
160
|
+
this.activeEditorGroupEmpty.set(true);
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
this.activeEditorGroupEmpty.reset();
|
|
164
|
+
}
|
|
165
|
+
this.updateEditorGroupContextKeys();
|
|
166
|
+
if (activeEditorPane) {
|
|
167
|
+
this.activeEditorContext.set(activeEditorPane.getId());
|
|
168
|
+
this.activeEditorCanRevert.set(!activeEditorPane.input.hasCapability(4 ));
|
|
169
|
+
this.activeEditorCanSplitInGroup.set(activeEditorPane.input.hasCapability(32 ));
|
|
170
|
+
applyAvailableEditorIds(this.activeEditorAvailableEditorIds, activeEditorPane.input, this.editorResolverService);
|
|
171
|
+
this.activeEditorIsReadonly.set(!!activeEditorPane.input.isReadonly());
|
|
172
|
+
const primaryEditorResource = EditorResourceAccessor.getOriginalUri(activeEditorPane.input, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
173
|
+
this.activeEditorCanToggleReadonly.set(!!primaryEditorResource && this.fileService.hasProvider(primaryEditorResource) && !this.fileService.hasCapability(primaryEditorResource, 2048 ));
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
this.activeEditorContext.reset();
|
|
177
|
+
this.activeEditorIsReadonly.reset();
|
|
178
|
+
this.activeEditorCanToggleReadonly.reset();
|
|
179
|
+
this.activeEditorCanRevert.reset();
|
|
180
|
+
this.activeEditorCanSplitInGroup.reset();
|
|
181
|
+
this.activeEditorAvailableEditorIds.reset();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
updateEditorGroupContextKeys() {
|
|
185
|
+
const groupCount = this.editorGroupService.count;
|
|
186
|
+
if (groupCount > 1) {
|
|
187
|
+
this.multipleEditorGroupsContext.set(true);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
this.multipleEditorGroupsContext.reset();
|
|
191
|
+
}
|
|
192
|
+
const activeGroup = this.editorGroupService.activeGroup;
|
|
193
|
+
this.activeEditorGroupIndex.set(activeGroup.index + 1);
|
|
194
|
+
this.activeEditorGroupLast.set(activeGroup.index === groupCount - 1);
|
|
195
|
+
this.activeEditorGroupLocked.set(activeGroup.isLocked);
|
|
196
|
+
}
|
|
197
|
+
updateInputContextKeys() {
|
|
198
|
+
function activeElementIsInput() {
|
|
199
|
+
return !!document.activeElement && (document.activeElement.tagName === 'INPUT' || document.activeElement.tagName === 'TEXTAREA');
|
|
200
|
+
}
|
|
201
|
+
const isInputFocused = activeElementIsInput();
|
|
202
|
+
this.inputFocusedContext.set(isInputFocused);
|
|
203
|
+
if (isInputFocused) {
|
|
204
|
+
const tracker = trackFocus(document.activeElement);
|
|
205
|
+
Event.once(tracker.onDidBlur)(() => {
|
|
206
|
+
this.inputFocusedContext.set(activeElementIsInput());
|
|
207
|
+
tracker.dispose();
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
updateWorkbenchStateContextKey() {
|
|
212
|
+
this.workbenchStateContext.set(this.getWorkbenchStateString());
|
|
213
|
+
}
|
|
214
|
+
updateWorkspaceFolderCountContextKey() {
|
|
215
|
+
this.workspaceFolderCountContext.set(this.contextService.getWorkspace().folders.length);
|
|
216
|
+
}
|
|
217
|
+
updateSplitEditorsVerticallyContext() {
|
|
218
|
+
const direction = preferredSideBySideGroupDirection(this.configurationService);
|
|
219
|
+
this.splitEditorsVerticallyContext.set(direction === 1 );
|
|
220
|
+
}
|
|
221
|
+
getWorkbenchStateString() {
|
|
222
|
+
switch (this.contextService.getWorkbenchState()) {
|
|
223
|
+
case 1 : return 'empty';
|
|
224
|
+
case 2 : return 'folder';
|
|
225
|
+
case 3 : return 'workspace';
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
updateSideBarContextKeys() {
|
|
229
|
+
this.sideBarVisibleContext.set(this.layoutService.isVisible("workbench.parts.sidebar" ));
|
|
230
|
+
}
|
|
231
|
+
updateWorkspaceContextKeys() {
|
|
232
|
+
this.virtualWorkspaceContext.set(getVirtualWorkspaceScheme(this.contextService.getWorkspace()) || '');
|
|
233
|
+
this.temporaryWorkspaceContext.set(isTemporaryWorkspace(this.contextService.getWorkspace()));
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
WorkbenchContextKeysHandler = ( __decorate([
|
|
237
|
+
( __param(0, IContextKeyService)),
|
|
238
|
+
( __param(1, IWorkspaceContextService)),
|
|
239
|
+
( __param(2, IConfigurationService)),
|
|
240
|
+
( __param(3, IWorkbenchEnvironmentService)),
|
|
241
|
+
( __param(4, IProductService)),
|
|
242
|
+
( __param(5, IEditorService)),
|
|
243
|
+
( __param(6, IEditorResolverService)),
|
|
244
|
+
( __param(7, IEditorGroupsService)),
|
|
245
|
+
( __param(8, IWorkbenchLayoutService)),
|
|
246
|
+
( __param(9, IPaneCompositePartService)),
|
|
247
|
+
( __param(10, IWorkingCopyService)),
|
|
248
|
+
( __param(11, IFileService))
|
|
249
|
+
], WorkbenchContextKeysHandler));
|
|
250
|
+
|
|
251
|
+
export { WorkbenchContextKeysHandler };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
2
|
+
import { registerAction2, Action2 } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
3
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
4
|
+
import { Categories } from 'monaco-editor/esm/vs/platform/action/common/actionCommonCategories.js';
|
|
5
|
+
import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
6
|
+
import { showWindowLogActionId } from 'vscode/vscode/vs/workbench/services/log/common/logConstants';
|
|
7
|
+
|
|
8
|
+
class ToggleKeybindingsLogAction extends Action2 {
|
|
9
|
+
constructor() {
|
|
10
|
+
super({
|
|
11
|
+
id: 'workbench.action.toggleKeybindingsLog',
|
|
12
|
+
title: { value: ( nls.localizeWithPath(
|
|
13
|
+
'vs/workbench/contrib/keybindings/browser/keybindings.contribution',
|
|
14
|
+
'toggleKeybindingsLog',
|
|
15
|
+
"Toggle Keyboard Shortcuts Troubleshooting"
|
|
16
|
+
)), original: 'Toggle Keyboard Shortcuts Troubleshooting' },
|
|
17
|
+
category: Categories.Developer,
|
|
18
|
+
f1: true
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
run(accessor) {
|
|
22
|
+
const logging = accessor.get(IKeybindingService).toggleLogging();
|
|
23
|
+
if (logging) {
|
|
24
|
+
const commandService = accessor.get(ICommandService);
|
|
25
|
+
commandService.executeCommand(showWindowLogActionId);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
registerAction2(ToggleKeybindingsLogAction);
|