@codingame/monaco-vscode-api 2.1.4 → 2.2.0-next.2
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/README.md +24 -0
- package/contributions.js +1 -0
- package/extensions.d.ts +7 -3
- package/extensions.js +28 -8
- package/lifecycle.js +11 -3
- package/localExtensionHost.js +13 -10
- package/missing-services.js +55 -10
- package/monaco.js +7 -3
- package/package.json +8 -8
- package/service-override/tools/views.d.ts +98 -0
- package/service-override/tools/views.js +249 -0
- package/services.d.ts +4 -2
- package/services.js +11 -9
- package/vscode/src/vs/base/browser/deviceAccess.js +60 -0
- package/vscode/src/vs/base/browser/dom.js +18 -1
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +178 -0
- package/vscode/src/vs/base/browser/ui/grid/grid.js +492 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +4 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.d.ts +1 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +1109 -0
- package/vscode/src/vs/base/browser/ui/sash/sash.js +9 -1
- package/vscode/src/vs/base/browser/ui/splitview/splitview.d.ts +348 -1
- package/vscode/src/vs/base/common/async.js +46 -2
- package/vscode/src/vs/base/common/codicons.d.ts +579 -0
- package/vscode/src/vs/base/common/event.js +11 -2
- package/vscode/src/vs/base/common/keybindingParser.js +87 -0
- package/vscode/src/vs/base/common/network.js +1 -2
- package/vscode/src/vs/base/common/observableInternal/utils.js +1 -1
- package/vscode/src/vs/base/common/platform.js +2 -1
- package/vscode/src/vs/base/common/scrollable.d.ts +28 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/colors.js +17 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/diffEditorItemTemplate.js +214 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorViewModel.js +84 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidget.js +54 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidgetImpl.js +324 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/objectPool.js +46 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/style.css.js +4 -0
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/utils.js +11 -0
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardLayout.js +61 -1
- package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +10 -0
- package/vscode/src/vs/platform/log/browser/log.js +24 -0
- package/vscode/src/vs/platform/product/common/product.js +1 -2
- package/vscode/src/vs/platform/userDataSync/common/abstractSynchronizer.js +772 -0
- package/vscode/src/vs/platform/userDataSync/common/userDataSyncStoreService.js +551 -0
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +22 -0
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +62 -0
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +788 -0
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +763 -0
- package/vscode/src/vs/workbench/browser/layout.d.ts +26 -0
- package/vscode/src/vs/workbench/browser/media/style.css.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +610 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +148 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +603 -0
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +333 -0
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +221 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1406 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +184 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +509 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +112 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1018 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +389 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsActions.js +213 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsAlerts.js +73 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCenter.js +307 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsList.js +226 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsStatus.js +218 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsToasts.js +433 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsViewer.js +436 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +377 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +66 -0
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +144 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +220 -0
- package/vscode/src/vs/workbench/browser/window.js +239 -5
- package/vscode/src/vs/workbench/common/configuration.js +11 -1
- package/vscode/src/vs/workbench/common/theme.js +3 -3
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +298 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +363 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +133 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +90 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentMenus.js +43 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentService.js +317 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +107 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +395 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +3 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +1277 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +17 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +123 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +342 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +451 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +176 -0
- package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +35 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +16 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +143 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +212 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +76 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +61 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +117 -0
- package/vscode/src/vs/workbench/contrib/editSessions/common/editSessions.js +62 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +5 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +77 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +72 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +254 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +97 -0
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +442 -0
- package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +430 -0
- package/vscode/src/vs/workbench/contrib/files/browser/explorerViewlet.js +10 -10
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +784 -0
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +487 -0
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +521 -0
- package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +150 -0
- package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +61 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveDocumentService.js +25 -1
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +178 -0
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +49 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +145 -0
- package/vscode/src/vs/workbench/contrib/mappedEdits/common/mappedEdits.contribution.js +22 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +691 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +238 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +76 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +40 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +69 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +346 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +96 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +144 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +103 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +399 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +195 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +39 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +126 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +611 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +156 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +262 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +171 -0
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService.js +41 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +317 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +56 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +315 -0
- package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +193 -0
- package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +2 -1
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.js +2 -2
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +37 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +39 -0
- package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +138 -2
- package/vscode/src/vs/workbench/contrib/tags/browser/workspaceTagsService.js +12 -0
- package/vscode/src/vs/workbench/contrib/tags/common/workspaceTags.js +3 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +4 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +281 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +358 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +131 -0
- package/vscode/src/vs/workbench/contrib/update/common/update.js +2 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +288 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +94 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +86 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +77 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +646 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +63 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +57 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +140 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +119 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +233 -0
- package/vscode/src/vs/workbench/contrib/workspace/common/workspace.js +16 -0
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +143 -0
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +0 -3
- package/vscode/src/vs/workbench/services/driver/browser/driver.js +184 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +668 -0
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +1482 -0
- package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +17 -1
- package/vscode/src/vs/workbench/services/lifecycle/common/lifecycle.js +8 -1
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +4 -0
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +521 -0
- package/vscode/src/vs/workbench/services/textMate/common/TMGrammars.js +102 -0
- package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +296 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +99 -0
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +596 -0
|
@@ -0,0 +1,763 @@
|
|
|
1
|
+
import { KeybindingsRegistry } from '../../../platform/keybinding/common/keybindingsRegistry.js';
|
|
2
|
+
import { List } from '../../../base/browser/ui/list/listWidget.js';
|
|
3
|
+
import { WorkbenchListFocusContextKey, IListService, WorkbenchListSupportsMultiSelectContextKey, WorkbenchTreeElementCanCollapse, WorkbenchTreeElementHasParent, WorkbenchTreeStickyScrollFocused, getSelectionKeyboardEvent, WorkbenchTreeElementCanExpand, WorkbenchTreeElementHasChild, WorkbenchListHasSelectionOrFocus, WorkbenchListSelectionNavigation, RawWorkbenchListFocusContextKey, WorkbenchListSupportsFind, WorkbenchTreeFindOpen, WorkbenchListScrollAtTopContextKey, WorkbenchListScrollAtBottomContextKey } from '../../../platform/list/browser/listService.js';
|
|
4
|
+
import { PagedList } from '../../../base/browser/ui/list/listPaging.js';
|
|
5
|
+
import { range, equals } from '../../../base/common/arrays.js';
|
|
6
|
+
import { ContextKeyExpr } from '../../../platform/contextkey/common/contextkey.js';
|
|
7
|
+
import { ObjectTree } from '../../../base/browser/ui/tree/objectTree.js';
|
|
8
|
+
import { AsyncDataTree } from '../../../base/browser/ui/tree/asyncDataTree.js';
|
|
9
|
+
import { DataTree } from '../../../base/browser/ui/tree/dataTree.js';
|
|
10
|
+
import { CommandsRegistry } from '../../../platform/commands/common/commands.js';
|
|
11
|
+
import { Table } from '../../../base/browser/ui/table/tableWidget.js';
|
|
12
|
+
import { AbstractTree, TreeFindMode, TreeFindMatchType } from '../../../base/browser/ui/tree/abstractTree.js';
|
|
13
|
+
import { isActiveElement } from '../../../base/browser/dom.js';
|
|
14
|
+
import { registerAction2, Action2 } from '../../../platform/actions/common/actions.js';
|
|
15
|
+
import { IConfigurationService } from '../../../platform/configuration/common/configuration.js';
|
|
16
|
+
import { localizeWithPath } from '../../../nls.js';
|
|
17
|
+
function ensureDOMFocus(widget) {
|
|
18
|
+
const element = widget?.getHTMLElement();
|
|
19
|
+
if (element && !isActiveElement(element)) {
|
|
20
|
+
widget?.domFocus();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function updateFocus(widget, updateFocusFn) {
|
|
24
|
+
if (!WorkbenchListSelectionNavigation.getValue(widget.contextKeyService)) {
|
|
25
|
+
return updateFocusFn(widget);
|
|
26
|
+
}
|
|
27
|
+
const focus = widget.getFocus();
|
|
28
|
+
const selection = widget.getSelection();
|
|
29
|
+
await updateFocusFn(widget);
|
|
30
|
+
const newFocus = widget.getFocus();
|
|
31
|
+
if (selection.length > 1 || !equals(focus, selection) || equals(focus, newFocus)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
35
|
+
widget.setSelection(newFocus, fakeKeyboardEvent);
|
|
36
|
+
}
|
|
37
|
+
async function navigate(widget, updateFocusFn) {
|
|
38
|
+
if (!widget) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
await updateFocus(widget, updateFocusFn);
|
|
42
|
+
const listFocus = widget.getFocus();
|
|
43
|
+
if (listFocus.length) {
|
|
44
|
+
widget.reveal(listFocus[0]);
|
|
45
|
+
}
|
|
46
|
+
widget.setAnchor(listFocus[0]);
|
|
47
|
+
ensureDOMFocus(widget);
|
|
48
|
+
}
|
|
49
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
50
|
+
id: 'list.focusDown',
|
|
51
|
+
weight: 200 ,
|
|
52
|
+
when: WorkbenchListFocusContextKey,
|
|
53
|
+
primary: 18 ,
|
|
54
|
+
mac: {
|
|
55
|
+
primary: 18 ,
|
|
56
|
+
secondary: [256 | 44 ]
|
|
57
|
+
},
|
|
58
|
+
handler: (accessor, arg2) => {
|
|
59
|
+
navigate(accessor.get(IListService).lastFocusedList, async (widget) => {
|
|
60
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
61
|
+
await widget.focusNext(typeof arg2 === 'number' ? arg2 : 1, false, fakeKeyboardEvent);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
66
|
+
id: 'list.focusUp',
|
|
67
|
+
weight: 200 ,
|
|
68
|
+
when: WorkbenchListFocusContextKey,
|
|
69
|
+
primary: 16 ,
|
|
70
|
+
mac: {
|
|
71
|
+
primary: 16 ,
|
|
72
|
+
secondary: [256 | 46 ]
|
|
73
|
+
},
|
|
74
|
+
handler: (accessor, arg2) => {
|
|
75
|
+
navigate(accessor.get(IListService).lastFocusedList, async (widget) => {
|
|
76
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
77
|
+
await widget.focusPrevious(typeof arg2 === 'number' ? arg2 : 1, false, fakeKeyboardEvent);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
82
|
+
id: 'list.focusAnyDown',
|
|
83
|
+
weight: 200 ,
|
|
84
|
+
when: WorkbenchListFocusContextKey,
|
|
85
|
+
primary: 512 | 18 ,
|
|
86
|
+
mac: {
|
|
87
|
+
primary: 512 | 18 ,
|
|
88
|
+
secondary: [256 | 512 | 44 ]
|
|
89
|
+
},
|
|
90
|
+
handler: (accessor, arg2) => {
|
|
91
|
+
navigate(accessor.get(IListService).lastFocusedList, async (widget) => {
|
|
92
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown', { altKey: true }));
|
|
93
|
+
await widget.focusNext(typeof arg2 === 'number' ? arg2 : 1, false, fakeKeyboardEvent);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
98
|
+
id: 'list.focusAnyUp',
|
|
99
|
+
weight: 200 ,
|
|
100
|
+
when: WorkbenchListFocusContextKey,
|
|
101
|
+
primary: 512 | 16 ,
|
|
102
|
+
mac: {
|
|
103
|
+
primary: 512 | 16 ,
|
|
104
|
+
secondary: [256 | 512 | 46 ]
|
|
105
|
+
},
|
|
106
|
+
handler: (accessor, arg2) => {
|
|
107
|
+
navigate(accessor.get(IListService).lastFocusedList, async (widget) => {
|
|
108
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown', { altKey: true }));
|
|
109
|
+
await widget.focusPrevious(typeof arg2 === 'number' ? arg2 : 1, false, fakeKeyboardEvent);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
114
|
+
id: 'list.focusPageDown',
|
|
115
|
+
weight: 200 ,
|
|
116
|
+
when: WorkbenchListFocusContextKey,
|
|
117
|
+
primary: 12 ,
|
|
118
|
+
handler: (accessor) => {
|
|
119
|
+
navigate(accessor.get(IListService).lastFocusedList, async (widget) => {
|
|
120
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
121
|
+
await widget.focusNextPage(fakeKeyboardEvent);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
126
|
+
id: 'list.focusPageUp',
|
|
127
|
+
weight: 200 ,
|
|
128
|
+
when: WorkbenchListFocusContextKey,
|
|
129
|
+
primary: 11 ,
|
|
130
|
+
handler: (accessor) => {
|
|
131
|
+
navigate(accessor.get(IListService).lastFocusedList, async (widget) => {
|
|
132
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
133
|
+
await widget.focusPreviousPage(fakeKeyboardEvent);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
138
|
+
id: 'list.focusFirst',
|
|
139
|
+
weight: 200 ,
|
|
140
|
+
when: WorkbenchListFocusContextKey,
|
|
141
|
+
primary: 14 ,
|
|
142
|
+
handler: (accessor) => {
|
|
143
|
+
navigate(accessor.get(IListService).lastFocusedList, async (widget) => {
|
|
144
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
145
|
+
await widget.focusFirst(fakeKeyboardEvent);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
150
|
+
id: 'list.focusLast',
|
|
151
|
+
weight: 200 ,
|
|
152
|
+
when: WorkbenchListFocusContextKey,
|
|
153
|
+
primary: 13 ,
|
|
154
|
+
handler: (accessor) => {
|
|
155
|
+
navigate(accessor.get(IListService).lastFocusedList, async (widget) => {
|
|
156
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
157
|
+
await widget.focusLast(fakeKeyboardEvent);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
162
|
+
id: 'list.focusAnyFirst',
|
|
163
|
+
weight: 200 ,
|
|
164
|
+
when: WorkbenchListFocusContextKey,
|
|
165
|
+
primary: 512 | 14 ,
|
|
166
|
+
handler: (accessor) => {
|
|
167
|
+
navigate(accessor.get(IListService).lastFocusedList, async (widget) => {
|
|
168
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown', { altKey: true }));
|
|
169
|
+
await widget.focusFirst(fakeKeyboardEvent);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
174
|
+
id: 'list.focusAnyLast',
|
|
175
|
+
weight: 200 ,
|
|
176
|
+
when: WorkbenchListFocusContextKey,
|
|
177
|
+
primary: 512 | 13 ,
|
|
178
|
+
handler: (accessor) => {
|
|
179
|
+
navigate(accessor.get(IListService).lastFocusedList, async (widget) => {
|
|
180
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown', { altKey: true }));
|
|
181
|
+
await widget.focusLast(fakeKeyboardEvent);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
function expandMultiSelection(focused, previousFocus) {
|
|
186
|
+
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
|
|
187
|
+
const list = focused;
|
|
188
|
+
const focus = list.getFocus() ? list.getFocus()[0] : undefined;
|
|
189
|
+
const selection = list.getSelection();
|
|
190
|
+
if (selection && typeof focus === 'number' && selection.indexOf(focus) >= 0) {
|
|
191
|
+
list.setSelection(selection.filter(s => s !== previousFocus));
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
if (typeof focus === 'number') {
|
|
195
|
+
list.setSelection(selection.concat(focus));
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
else if (focused instanceof ObjectTree || focused instanceof DataTree || focused instanceof AsyncDataTree) {
|
|
200
|
+
const list = focused;
|
|
201
|
+
const focus = list.getFocus() ? list.getFocus()[0] : undefined;
|
|
202
|
+
if (previousFocus === focus) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const selection = list.getSelection();
|
|
206
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown', { shiftKey: true }));
|
|
207
|
+
if (selection && selection.indexOf(focus) >= 0) {
|
|
208
|
+
list.setSelection(selection.filter(s => s !== previousFocus), fakeKeyboardEvent);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
list.setSelection(selection.concat(focus), fakeKeyboardEvent);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function revealFocusedStickyScroll(tree, postRevealAction) {
|
|
216
|
+
const focus = tree.getStickyScrollFocus();
|
|
217
|
+
if (focus.length === 0) {
|
|
218
|
+
throw new Error(`StickyScroll has no focus`);
|
|
219
|
+
}
|
|
220
|
+
if (focus.length > 1) {
|
|
221
|
+
throw new Error(`StickyScroll can only have a single focused item`);
|
|
222
|
+
}
|
|
223
|
+
tree.reveal(focus[0]);
|
|
224
|
+
tree.getHTMLElement().focus();
|
|
225
|
+
tree.setFocus(focus);
|
|
226
|
+
postRevealAction?.(focus[0]);
|
|
227
|
+
}
|
|
228
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
229
|
+
id: 'list.expandSelectionDown',
|
|
230
|
+
weight: 200 ,
|
|
231
|
+
when: ( ContextKeyExpr.and(WorkbenchListFocusContextKey, WorkbenchListSupportsMultiSelectContextKey)),
|
|
232
|
+
primary: 1024 | 18 ,
|
|
233
|
+
handler: (accessor, arg2) => {
|
|
234
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
235
|
+
if (!widget) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
const previousFocus = widget.getFocus() ? widget.getFocus()[0] : undefined;
|
|
239
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
240
|
+
widget.focusNext(typeof arg2 === 'number' ? arg2 : 1, false, fakeKeyboardEvent);
|
|
241
|
+
expandMultiSelection(widget, previousFocus);
|
|
242
|
+
const focus = widget.getFocus();
|
|
243
|
+
if (focus.length) {
|
|
244
|
+
widget.reveal(focus[0]);
|
|
245
|
+
}
|
|
246
|
+
ensureDOMFocus(widget);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
250
|
+
id: 'list.expandSelectionUp',
|
|
251
|
+
weight: 200 ,
|
|
252
|
+
when: ( ContextKeyExpr.and(WorkbenchListFocusContextKey, WorkbenchListSupportsMultiSelectContextKey)),
|
|
253
|
+
primary: 1024 | 16 ,
|
|
254
|
+
handler: (accessor, arg2) => {
|
|
255
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
256
|
+
if (!widget) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const previousFocus = widget.getFocus() ? widget.getFocus()[0] : undefined;
|
|
260
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
261
|
+
widget.focusPrevious(typeof arg2 === 'number' ? arg2 : 1, false, fakeKeyboardEvent);
|
|
262
|
+
expandMultiSelection(widget, previousFocus);
|
|
263
|
+
const focus = widget.getFocus();
|
|
264
|
+
if (focus.length) {
|
|
265
|
+
widget.reveal(focus[0]);
|
|
266
|
+
}
|
|
267
|
+
ensureDOMFocus(widget);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
271
|
+
id: 'list.collapse',
|
|
272
|
+
weight: 200 ,
|
|
273
|
+
when: ( ContextKeyExpr.and(WorkbenchListFocusContextKey, ( ContextKeyExpr.or(WorkbenchTreeElementCanCollapse, WorkbenchTreeElementHasParent)))),
|
|
274
|
+
primary: 15 ,
|
|
275
|
+
mac: {
|
|
276
|
+
primary: 15 ,
|
|
277
|
+
secondary: [2048 | 16 ]
|
|
278
|
+
},
|
|
279
|
+
handler: (accessor) => {
|
|
280
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
281
|
+
if (!widget || !(widget instanceof ObjectTree || widget instanceof DataTree || widget instanceof AsyncDataTree)) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
const tree = widget;
|
|
285
|
+
const focusedElements = tree.getFocus();
|
|
286
|
+
if (focusedElements.length === 0) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
const focus = focusedElements[0];
|
|
290
|
+
if (!tree.collapse(focus)) {
|
|
291
|
+
const parent = tree.getParentElement(focus);
|
|
292
|
+
if (parent) {
|
|
293
|
+
navigate(widget, widget => {
|
|
294
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
295
|
+
widget.setFocus([parent], fakeKeyboardEvent);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
302
|
+
id: 'list.stickyScroll.collapse',
|
|
303
|
+
weight: 200 + 50,
|
|
304
|
+
when: WorkbenchTreeStickyScrollFocused,
|
|
305
|
+
primary: 15 ,
|
|
306
|
+
mac: {
|
|
307
|
+
primary: 15 ,
|
|
308
|
+
secondary: [2048 | 16 ]
|
|
309
|
+
},
|
|
310
|
+
handler: (accessor) => {
|
|
311
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
312
|
+
if (!widget || !(widget instanceof ObjectTree || widget instanceof DataTree || widget instanceof AsyncDataTree)) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
revealFocusedStickyScroll(widget, focus => widget.collapse(focus));
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
319
|
+
id: 'list.collapseAll',
|
|
320
|
+
weight: 200 ,
|
|
321
|
+
when: WorkbenchListFocusContextKey,
|
|
322
|
+
primary: 2048 | 15 ,
|
|
323
|
+
mac: {
|
|
324
|
+
primary: 2048 | 15 ,
|
|
325
|
+
secondary: [2048 | 1024 | 16 ]
|
|
326
|
+
},
|
|
327
|
+
handler: (accessor) => {
|
|
328
|
+
const focused = accessor.get(IListService).lastFocusedList;
|
|
329
|
+
if (focused && !(focused instanceof List || focused instanceof PagedList || focused instanceof Table)) {
|
|
330
|
+
focused.collapseAll();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
335
|
+
id: 'list.collapseAllToFocus',
|
|
336
|
+
weight: 200 ,
|
|
337
|
+
when: WorkbenchListFocusContextKey,
|
|
338
|
+
handler: accessor => {
|
|
339
|
+
const focused = accessor.get(IListService).lastFocusedList;
|
|
340
|
+
const fakeKeyboardEvent = getSelectionKeyboardEvent('keydown', true);
|
|
341
|
+
if (focused instanceof ObjectTree || focused instanceof DataTree || focused instanceof AsyncDataTree) {
|
|
342
|
+
const tree = focused;
|
|
343
|
+
const focus = tree.getFocus();
|
|
344
|
+
if (focus.length > 0) {
|
|
345
|
+
tree.collapse(focus[0], true);
|
|
346
|
+
}
|
|
347
|
+
tree.setSelection(focus, fakeKeyboardEvent);
|
|
348
|
+
tree.setAnchor(focus[0]);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
353
|
+
id: 'list.focusParent',
|
|
354
|
+
weight: 200 ,
|
|
355
|
+
when: WorkbenchListFocusContextKey,
|
|
356
|
+
handler: (accessor) => {
|
|
357
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
358
|
+
if (!widget || !(widget instanceof ObjectTree || widget instanceof DataTree || widget instanceof AsyncDataTree)) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
const tree = widget;
|
|
362
|
+
const focusedElements = tree.getFocus();
|
|
363
|
+
if (focusedElements.length === 0) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const focus = focusedElements[0];
|
|
367
|
+
const parent = tree.getParentElement(focus);
|
|
368
|
+
if (parent) {
|
|
369
|
+
navigate(widget, widget => {
|
|
370
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
371
|
+
widget.setFocus([parent], fakeKeyboardEvent);
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
377
|
+
id: 'list.expand',
|
|
378
|
+
weight: 200 ,
|
|
379
|
+
when: ( ContextKeyExpr.and(WorkbenchListFocusContextKey, ( ContextKeyExpr.or(WorkbenchTreeElementCanExpand, WorkbenchTreeElementHasChild)))),
|
|
380
|
+
primary: 17 ,
|
|
381
|
+
handler: (accessor) => {
|
|
382
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
383
|
+
if (!widget) {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (widget instanceof ObjectTree || widget instanceof DataTree) {
|
|
387
|
+
const focusedElements = widget.getFocus();
|
|
388
|
+
if (focusedElements.length === 0) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
const focus = focusedElements[0];
|
|
392
|
+
if (!widget.expand(focus)) {
|
|
393
|
+
const child = widget.getFirstElementChild(focus);
|
|
394
|
+
if (child) {
|
|
395
|
+
const node = widget.getNode(child);
|
|
396
|
+
if (node.visible) {
|
|
397
|
+
navigate(widget, widget => {
|
|
398
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
399
|
+
widget.setFocus([child], fakeKeyboardEvent);
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
else if (widget instanceof AsyncDataTree) {
|
|
406
|
+
const focusedElements = widget.getFocus();
|
|
407
|
+
if (focusedElements.length === 0) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
const focus = focusedElements[0];
|
|
411
|
+
widget.expand(focus).then(didExpand => {
|
|
412
|
+
if (focus && !didExpand) {
|
|
413
|
+
const child = widget.getFirstElementChild(focus);
|
|
414
|
+
if (child) {
|
|
415
|
+
const node = widget.getNode(child);
|
|
416
|
+
if (node.visible) {
|
|
417
|
+
navigate(widget, widget => {
|
|
418
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
419
|
+
widget.setFocus([child], fakeKeyboardEvent);
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
function selectElement(accessor, retainCurrentFocus) {
|
|
429
|
+
const focused = accessor.get(IListService).lastFocusedList;
|
|
430
|
+
const fakeKeyboardEvent = getSelectionKeyboardEvent('keydown', retainCurrentFocus);
|
|
431
|
+
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
|
|
432
|
+
const list = focused;
|
|
433
|
+
list.setAnchor(list.getFocus()[0]);
|
|
434
|
+
list.setSelection(list.getFocus(), fakeKeyboardEvent);
|
|
435
|
+
}
|
|
436
|
+
else if (focused instanceof ObjectTree || focused instanceof DataTree || focused instanceof AsyncDataTree) {
|
|
437
|
+
const tree = focused;
|
|
438
|
+
const focus = tree.getFocus();
|
|
439
|
+
if (focus.length > 0) {
|
|
440
|
+
let toggleCollapsed = true;
|
|
441
|
+
if (tree.expandOnlyOnTwistieClick === true) {
|
|
442
|
+
toggleCollapsed = false;
|
|
443
|
+
}
|
|
444
|
+
else if (typeof tree.expandOnlyOnTwistieClick !== 'boolean' && tree.expandOnlyOnTwistieClick(focus[0])) {
|
|
445
|
+
toggleCollapsed = false;
|
|
446
|
+
}
|
|
447
|
+
if (toggleCollapsed) {
|
|
448
|
+
tree.toggleCollapsed(focus[0]);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
tree.setAnchor(focus[0]);
|
|
452
|
+
tree.setSelection(focus, fakeKeyboardEvent);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
456
|
+
id: 'list.select',
|
|
457
|
+
weight: 200 ,
|
|
458
|
+
when: WorkbenchListFocusContextKey,
|
|
459
|
+
primary: 3 ,
|
|
460
|
+
mac: {
|
|
461
|
+
primary: 3 ,
|
|
462
|
+
secondary: [2048 | 18 ]
|
|
463
|
+
},
|
|
464
|
+
handler: (accessor) => {
|
|
465
|
+
selectElement(accessor, false);
|
|
466
|
+
}
|
|
467
|
+
});
|
|
468
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
469
|
+
id: 'list.stickyScrollselect',
|
|
470
|
+
weight: 200 + 50,
|
|
471
|
+
when: WorkbenchTreeStickyScrollFocused,
|
|
472
|
+
primary: 3 ,
|
|
473
|
+
mac: {
|
|
474
|
+
primary: 3 ,
|
|
475
|
+
secondary: [2048 | 18 ]
|
|
476
|
+
},
|
|
477
|
+
handler: (accessor) => {
|
|
478
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
479
|
+
if (!widget || !(widget instanceof ObjectTree || widget instanceof DataTree || widget instanceof AsyncDataTree)) {
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
revealFocusedStickyScroll(widget, focus => widget.setSelection([focus]));
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
486
|
+
id: 'list.selectAndPreserveFocus',
|
|
487
|
+
weight: 200 ,
|
|
488
|
+
when: WorkbenchListFocusContextKey,
|
|
489
|
+
handler: accessor => {
|
|
490
|
+
selectElement(accessor, true);
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
494
|
+
id: 'list.selectAll',
|
|
495
|
+
weight: 200 ,
|
|
496
|
+
when: ( ContextKeyExpr.and(WorkbenchListFocusContextKey, WorkbenchListSupportsMultiSelectContextKey)),
|
|
497
|
+
primary: 2048 | 31 ,
|
|
498
|
+
handler: (accessor) => {
|
|
499
|
+
const focused = accessor.get(IListService).lastFocusedList;
|
|
500
|
+
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
|
|
501
|
+
const list = focused;
|
|
502
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
503
|
+
list.setSelection(range(list.length), fakeKeyboardEvent);
|
|
504
|
+
}
|
|
505
|
+
else if (focused instanceof ObjectTree || focused instanceof DataTree || focused instanceof AsyncDataTree) {
|
|
506
|
+
const tree = focused;
|
|
507
|
+
const focus = tree.getFocus();
|
|
508
|
+
const selection = tree.getSelection();
|
|
509
|
+
let start = undefined;
|
|
510
|
+
if (focus.length > 0 && (selection.length === 0 || !selection.includes(focus[0]))) {
|
|
511
|
+
start = focus[0];
|
|
512
|
+
}
|
|
513
|
+
if (!start && selection.length > 0) {
|
|
514
|
+
start = selection[0];
|
|
515
|
+
}
|
|
516
|
+
let scope = undefined;
|
|
517
|
+
if (!start) {
|
|
518
|
+
scope = undefined;
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
scope = tree.getParentElement(start);
|
|
522
|
+
}
|
|
523
|
+
const newSelection = [];
|
|
524
|
+
const visit = (node) => {
|
|
525
|
+
for (const child of node.children) {
|
|
526
|
+
if (child.visible) {
|
|
527
|
+
newSelection.push(child.element);
|
|
528
|
+
if (!child.collapsed) {
|
|
529
|
+
visit(child);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
visit(tree.getNode(scope));
|
|
535
|
+
if (scope && selection.length === newSelection.length) {
|
|
536
|
+
newSelection.unshift(scope);
|
|
537
|
+
}
|
|
538
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
539
|
+
tree.setSelection(newSelection, fakeKeyboardEvent);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
});
|
|
543
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
544
|
+
id: 'list.toggleSelection',
|
|
545
|
+
weight: 200 ,
|
|
546
|
+
when: WorkbenchListFocusContextKey,
|
|
547
|
+
primary: 2048 | 1024 | 3 ,
|
|
548
|
+
handler: (accessor) => {
|
|
549
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
550
|
+
if (!widget) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
const focus = widget.getFocus();
|
|
554
|
+
if (focus.length === 0) {
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
const selection = widget.getSelection();
|
|
558
|
+
const index = selection.indexOf(focus[0]);
|
|
559
|
+
if (index > -1) {
|
|
560
|
+
widget.setSelection([...selection.slice(0, index), ...selection.slice(index + 1)]);
|
|
561
|
+
}
|
|
562
|
+
else {
|
|
563
|
+
widget.setSelection([...selection, focus[0]]);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
568
|
+
id: 'list.toggleExpand',
|
|
569
|
+
weight: 200 ,
|
|
570
|
+
when: WorkbenchListFocusContextKey,
|
|
571
|
+
primary: 10 ,
|
|
572
|
+
handler: (accessor) => {
|
|
573
|
+
const focused = accessor.get(IListService).lastFocusedList;
|
|
574
|
+
if (focused instanceof ObjectTree || focused instanceof DataTree || focused instanceof AsyncDataTree) {
|
|
575
|
+
const tree = focused;
|
|
576
|
+
const focus = tree.getFocus();
|
|
577
|
+
if (focus.length > 0 && tree.isCollapsible(focus[0])) {
|
|
578
|
+
tree.toggleCollapsed(focus[0]);
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
selectElement(accessor, true);
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
586
|
+
id: 'list.stickyScrolltoggleExpand',
|
|
587
|
+
weight: 200 + 50,
|
|
588
|
+
when: WorkbenchTreeStickyScrollFocused,
|
|
589
|
+
primary: 10 ,
|
|
590
|
+
handler: (accessor) => {
|
|
591
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
592
|
+
if (!widget || !(widget instanceof ObjectTree || widget instanceof DataTree || widget instanceof AsyncDataTree)) {
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
revealFocusedStickyScroll(widget);
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
599
|
+
id: 'list.clear',
|
|
600
|
+
weight: 200 ,
|
|
601
|
+
when: ( ContextKeyExpr.and(WorkbenchListFocusContextKey, WorkbenchListHasSelectionOrFocus)),
|
|
602
|
+
primary: 9 ,
|
|
603
|
+
handler: (accessor) => {
|
|
604
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
605
|
+
if (!widget) {
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
const selection = widget.getSelection();
|
|
609
|
+
const fakeKeyboardEvent = ( new KeyboardEvent('keydown'));
|
|
610
|
+
if (selection.length > 1) {
|
|
611
|
+
const useSelectionNavigation = WorkbenchListSelectionNavigation.getValue(widget.contextKeyService);
|
|
612
|
+
if (useSelectionNavigation) {
|
|
613
|
+
const focus = widget.getFocus();
|
|
614
|
+
widget.setSelection([focus[0]], fakeKeyboardEvent);
|
|
615
|
+
}
|
|
616
|
+
else {
|
|
617
|
+
widget.setSelection([], fakeKeyboardEvent);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
else {
|
|
621
|
+
widget.setSelection([], fakeKeyboardEvent);
|
|
622
|
+
widget.setFocus([], fakeKeyboardEvent);
|
|
623
|
+
}
|
|
624
|
+
widget.setAnchor(undefined);
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
CommandsRegistry.registerCommand({
|
|
628
|
+
id: 'list.triggerTypeNavigation',
|
|
629
|
+
handler: (accessor) => {
|
|
630
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
631
|
+
widget?.triggerTypeNavigation();
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
CommandsRegistry.registerCommand({
|
|
635
|
+
id: 'list.toggleFindMode',
|
|
636
|
+
handler: (accessor) => {
|
|
637
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
638
|
+
if (widget instanceof AbstractTree || widget instanceof AsyncDataTree) {
|
|
639
|
+
const tree = widget;
|
|
640
|
+
tree.findMode = tree.findMode === TreeFindMode.Filter ? TreeFindMode.Highlight : TreeFindMode.Filter;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
});
|
|
644
|
+
CommandsRegistry.registerCommand({
|
|
645
|
+
id: 'list.toggleFindMatchType',
|
|
646
|
+
handler: (accessor) => {
|
|
647
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
648
|
+
if (widget instanceof AbstractTree || widget instanceof AsyncDataTree) {
|
|
649
|
+
const tree = widget;
|
|
650
|
+
tree.findMatchType = tree.findMatchType === TreeFindMatchType.Contiguous ? TreeFindMatchType.Fuzzy : TreeFindMatchType.Contiguous;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
CommandsRegistry.registerCommandAlias('list.toggleKeyboardNavigation', 'list.triggerTypeNavigation');
|
|
655
|
+
CommandsRegistry.registerCommandAlias('list.toggleFilterOnType', 'list.toggleFindMode');
|
|
656
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
657
|
+
id: 'list.find',
|
|
658
|
+
weight: 200 ,
|
|
659
|
+
when: ( ContextKeyExpr.and(RawWorkbenchListFocusContextKey, WorkbenchListSupportsFind)),
|
|
660
|
+
primary: 2048 | 36 ,
|
|
661
|
+
secondary: [61 ],
|
|
662
|
+
handler: (accessor) => {
|
|
663
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
664
|
+
if (widget instanceof List || widget instanceof PagedList || widget instanceof Table) ;
|
|
665
|
+
else if (widget instanceof AbstractTree || widget instanceof AsyncDataTree) {
|
|
666
|
+
const tree = widget;
|
|
667
|
+
tree.openFind();
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
672
|
+
id: 'list.closeFind',
|
|
673
|
+
weight: 200 ,
|
|
674
|
+
when: ( ContextKeyExpr.and(RawWorkbenchListFocusContextKey, WorkbenchTreeFindOpen)),
|
|
675
|
+
primary: 9 ,
|
|
676
|
+
handler: (accessor) => {
|
|
677
|
+
const widget = accessor.get(IListService).lastFocusedList;
|
|
678
|
+
if (widget instanceof AbstractTree || widget instanceof AsyncDataTree) {
|
|
679
|
+
const tree = widget;
|
|
680
|
+
tree.closeFind();
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
685
|
+
id: 'list.scrollUp',
|
|
686
|
+
weight: 200 ,
|
|
687
|
+
when: ( ContextKeyExpr.and(WorkbenchListFocusContextKey, WorkbenchListScrollAtTopContextKey?.negate())),
|
|
688
|
+
primary: 2048 | 16 ,
|
|
689
|
+
handler: accessor => {
|
|
690
|
+
const focused = accessor.get(IListService).lastFocusedList;
|
|
691
|
+
if (!focused) {
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
focused.scrollTop -= 10;
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
698
|
+
id: 'list.scrollDown',
|
|
699
|
+
weight: 200 ,
|
|
700
|
+
when: ( ContextKeyExpr.and(
|
|
701
|
+
WorkbenchListFocusContextKey,
|
|
702
|
+
WorkbenchListScrollAtBottomContextKey?.negate()
|
|
703
|
+
)),
|
|
704
|
+
primary: 2048 | 18 ,
|
|
705
|
+
handler: accessor => {
|
|
706
|
+
const focused = accessor.get(IListService).lastFocusedList;
|
|
707
|
+
if (!focused) {
|
|
708
|
+
return;
|
|
709
|
+
}
|
|
710
|
+
focused.scrollTop += 10;
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
714
|
+
id: 'list.scrollLeft',
|
|
715
|
+
weight: 200 ,
|
|
716
|
+
when: WorkbenchListFocusContextKey,
|
|
717
|
+
handler: accessor => {
|
|
718
|
+
const focused = accessor.get(IListService).lastFocusedList;
|
|
719
|
+
if (!focused) {
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
focused.scrollLeft -= 10;
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
KeybindingsRegistry.registerCommandAndKeybindingRule({
|
|
726
|
+
id: 'list.scrollRight',
|
|
727
|
+
weight: 200 ,
|
|
728
|
+
when: WorkbenchListFocusContextKey,
|
|
729
|
+
handler: accessor => {
|
|
730
|
+
const focused = accessor.get(IListService).lastFocusedList;
|
|
731
|
+
if (!focused) {
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
focused.scrollLeft += 10;
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
registerAction2(class ToggleStickyScroll extends Action2 {
|
|
738
|
+
constructor() {
|
|
739
|
+
super({
|
|
740
|
+
id: 'tree.toggleStickyScroll',
|
|
741
|
+
title: {
|
|
742
|
+
value: ( localizeWithPath(
|
|
743
|
+
'vs/workbench/browser/actions/listCommands',
|
|
744
|
+
'toggleTreeStickyScroll',
|
|
745
|
+
"Toggle Tree Sticky Scroll"
|
|
746
|
+
)),
|
|
747
|
+
mnemonicTitle: ( localizeWithPath(
|
|
748
|
+
'vs/workbench/browser/actions/listCommands',
|
|
749
|
+
{ key: 'mitoggleTreeStickyScroll', comment: ['&& denotes a mnemonic'] },
|
|
750
|
+
"&&Toggle Tree Sticky Scroll"
|
|
751
|
+
)),
|
|
752
|
+
original: 'Toggle Tree Sticky Scroll',
|
|
753
|
+
},
|
|
754
|
+
category: 'View',
|
|
755
|
+
f1: true
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
run(accessor) {
|
|
759
|
+
const configurationService = accessor.get(IConfigurationService);
|
|
760
|
+
const newValue = !configurationService.getValue('workbench.tree.enableStickyScroll');
|
|
761
|
+
configurationService.updateValue('workbench.tree.enableStickyScroll', newValue);
|
|
762
|
+
}
|
|
763
|
+
});
|