@codingame/monaco-vscode-keybindings-service-override 2.2.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/keybindings.js +1 -0
- package/package.json +9 -9
- package/vscode/src/vs/workbench/browser/contextkeys.js +3 -3
- package/vscode/src/vs/workbench/contrib/commands/common/commands.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.js +250 -0
- package/vscode/src/vs/workbench/contrib/preferences/common/smartSnippetInserter.js +126 -0
- package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +197 -7
- package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +2 -2
package/keybindings.js
CHANGED
|
@@ -26,6 +26,7 @@ import getServiceOverride$1, { initFile } from '@codingame/monaco-vscode-files-s
|
|
|
26
26
|
import { onRenderWorkbench } from 'vscode/lifecycle';
|
|
27
27
|
import 'vscode/vscode/vs/workbench/browser/workbench.contribution';
|
|
28
28
|
import './vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js';
|
|
29
|
+
import './vscode/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.js';
|
|
29
30
|
import './vscode/src/vs/workbench/contrib/commands/common/commands.contribution.js';
|
|
30
31
|
import { getService } from 'vscode/services';
|
|
31
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-keybindings-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@3.0.0",
|
|
22
22
|
"vscode-marked": "npm:marked@=3.0.2",
|
|
23
|
-
"@codingame/monaco-vscode-files-service-override": "
|
|
24
|
-
"@codingame/monaco-vscode-quickaccess-service-override": "
|
|
25
|
-
"@codingame/monaco-vscode-extensions-service-override": "
|
|
26
|
-
"@codingame/monaco-vscode-environment-service-override": "
|
|
27
|
-
"@codingame/monaco-vscode-layout-service-override": "
|
|
28
|
-
"@codingame/monaco-vscode-host-service-override": "
|
|
29
|
-
"@codingame/monaco-vscode-base-service-override": "
|
|
23
|
+
"@codingame/monaco-vscode-files-service-override": "3.0.0",
|
|
24
|
+
"@codingame/monaco-vscode-quickaccess-service-override": "3.0.0",
|
|
25
|
+
"@codingame/monaco-vscode-extensions-service-override": "3.0.0",
|
|
26
|
+
"@codingame/monaco-vscode-environment-service-override": "3.0.0",
|
|
27
|
+
"@codingame/monaco-vscode-layout-service-override": "3.0.0",
|
|
28
|
+
"@codingame/monaco-vscode-host-service-override": "3.0.0",
|
|
29
|
+
"@codingame/monaco-vscode-base-service-override": "3.0.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -3,7 +3,7 @@ import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
|
3
3
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
4
|
import { setConstant, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
5
5
|
import { IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsIOSContext, IsMobileContext, IsDevelopmentContext, ProductQualityContext, InputFocusedContext } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
|
|
6
|
-
import { RemoteNameContext, VirtualWorkspaceContext, TemporaryWorkspaceContext, HasWebFileSystemAccess, EmbedderIdentifierContext, ActiveEditorContext, ActiveEditorReadonlyContext, ActiveCompareEditorOriginalWriteableContext, ActiveEditorCanToggleReadonlyContext, ActiveEditorCanRevertContext, ActiveEditorCanSplitInGroupContext, ActiveEditorAvailableEditorIdsContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, SideBySideEditorActiveContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, DirtyWorkingCopiesContext, WorkbenchStateContext, WorkspaceFolderCountContext, OpenFolderWorkspaceSupportContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, SplitEditorsVertically, IsMainWindowFullscreenContext, IsAuxiliaryWindowFocusedContext, InEditorZenModeContext,
|
|
6
|
+
import { RemoteNameContext, VirtualWorkspaceContext, TemporaryWorkspaceContext, HasWebFileSystemAccess, EmbedderIdentifierContext, ActiveEditorContext, ActiveEditorReadonlyContext, ActiveCompareEditorOriginalWriteableContext, ActiveEditorCanToggleReadonlyContext, ActiveEditorCanRevertContext, ActiveEditorCanSplitInGroupContext, ActiveEditorAvailableEditorIdsContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, SideBySideEditorActiveContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, DirtyWorkingCopiesContext, WorkbenchStateContext, WorkspaceFolderCountContext, OpenFolderWorkspaceSupportContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, SplitEditorsVertically, IsMainWindowFullscreenContext, IsAuxiliaryWindowFocusedContext, InEditorZenModeContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, EditorTabsVisibleContext, SideBarVisibleContext, TitleBarVisibleContext, TitleBarStyleContext, PanelPositionContext, PanelVisibleContext, PanelMaximizedContext, PanelAlignmentContext, AuxiliaryBarVisibleContext, applyAvailableEditorIds } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
7
7
|
import { TEXT_DIFF_EDITOR_ID, SIDE_BY_SIDE_EDITOR_ID, EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
|
|
8
8
|
import { onDidRegisterWindow, addDisposableListener, EventType, trackFocus, getActiveWindow } from 'vscode/vscode/vs/base/browser/dom';
|
|
9
9
|
import { preferredSideBySideGroupDirection, IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
@@ -92,7 +92,7 @@ let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disp
|
|
|
92
92
|
this.isMainWindowFullscreenContext = IsMainWindowFullscreenContext.bindTo(this.contextKeyService);
|
|
93
93
|
this.isAuxiliaryWindowFocusedContext = IsAuxiliaryWindowFocusedContext.bindTo(this.contextKeyService);
|
|
94
94
|
this.inZenModeContext = InEditorZenModeContext.bindTo(this.contextKeyService);
|
|
95
|
-
this.
|
|
95
|
+
this.isMainEditorCenteredLayoutContext = IsMainEditorCenteredLayoutContext.bindTo(this.contextKeyService);
|
|
96
96
|
this.mainEditorAreaVisibleContext = MainEditorAreaVisibleContext.bindTo(this.contextKeyService);
|
|
97
97
|
this.editorTabsVisibleContext = EditorTabsVisibleContext.bindTo(this.contextKeyService);
|
|
98
98
|
this.sideBarVisibleContext = SideBarVisibleContext.bindTo(this.contextKeyService);
|
|
@@ -142,7 +142,7 @@ let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disp
|
|
|
142
142
|
this.isMainWindowFullscreenContext.set(isFullscreen(mainWindow));
|
|
143
143
|
}
|
|
144
144
|
}));
|
|
145
|
-
this._register(this.layoutService.
|
|
145
|
+
this._register(this.layoutService.onDidChangeMainEditorCenteredLayout(centered => this.isMainEditorCenteredLayoutContext.set(centered)));
|
|
146
146
|
this._register(this.layoutService.onDidChangePanelPosition(position => this.panelPositionContext.set(position)));
|
|
147
147
|
this._register(this.layoutService.onDidChangePanelAlignment(alignment => this.panelAlignmentContext.set(alignment)));
|
|
148
148
|
this._register(this.paneCompositeService.onDidPaneCompositeClose(() => this.updateSideBarContextKeys()));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
1
|
+
import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
2
2
|
import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
3
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
|
|
4
4
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
@@ -8,11 +8,11 @@ class RunCommands extends Action2 {
|
|
|
8
8
|
constructor() {
|
|
9
9
|
super({
|
|
10
10
|
id: 'runCommands',
|
|
11
|
-
title:
|
|
11
|
+
title: ( localize2WithPath(
|
|
12
12
|
'vs/workbench/contrib/commands/common/commands.contribution',
|
|
13
13
|
'runCommands',
|
|
14
14
|
"Run Commands"
|
|
15
|
-
)),
|
|
15
|
+
)),
|
|
16
16
|
f1: false,
|
|
17
17
|
metadata: {
|
|
18
18
|
description: ( localizeWithPath(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { localize2WithPath } from 'vscode/vscode/vs/nls';
|
|
2
2
|
import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
3
|
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
4
4
|
import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
|
|
@@ -9,11 +9,11 @@ class ToggleKeybindingsLogAction extends Action2 {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super({
|
|
11
11
|
id: 'workbench.action.toggleKeybindingsLog',
|
|
12
|
-
title:
|
|
12
|
+
title: ( localize2WithPath(
|
|
13
13
|
'vs/workbench/contrib/keybindings/browser/keybindings.contribution',
|
|
14
14
|
'toggleKeybindingsLog',
|
|
15
15
|
"Toggle Keyboard Shortcuts Troubleshooting"
|
|
16
|
-
)),
|
|
16
|
+
)),
|
|
17
17
|
category: Categories.Developer,
|
|
18
18
|
f1: true
|
|
19
19
|
});
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
4
|
+
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
|
|
5
|
+
import { Disposable, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
6
|
+
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
7
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
8
|
+
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
9
|
+
import { registerEditorContribution } from 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
10
|
+
import { SnippetController2 } from 'vscode/vscode/vs/editor/contrib/snippet/browser/snippetController2';
|
|
11
|
+
import { SmartSnippetInserter } from '../common/smartSnippetInserter.js';
|
|
12
|
+
import { DefineKeybindingOverlayWidget } from 'vscode/vscode/vs/workbench/contrib/preferences/browser/keybindingWidgets';
|
|
13
|
+
import { parseTree } from 'vscode/vscode/vs/base/common/json';
|
|
14
|
+
import { WindowsNativeResolvedKeybinding } from '../../../services/keybinding/common/windowsKeyboardMapper.js';
|
|
15
|
+
import { themeColorFromId } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
16
|
+
import { overviewRulerError, overviewRulerInfo } from 'vscode/vscode/vs/editor/common/core/editorColorRegistry';
|
|
17
|
+
import { OverviewRulerLane } from 'vscode/vscode/vs/editor/common/model';
|
|
18
|
+
import { KeybindingParser } from 'vscode/vscode/vs/base/common/keybindingParser';
|
|
19
|
+
import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
|
|
20
|
+
import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
21
|
+
import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
|
|
22
|
+
import { DEFINE_KEYBINDING_EDITOR_CONTRIB_ID } from 'vscode/vscode/vs/workbench/services/preferences/common/preferences';
|
|
23
|
+
|
|
24
|
+
var KeybindingEditorDecorationsRenderer_1;
|
|
25
|
+
const NLS_KB_LAYOUT_ERROR_MESSAGE = ( localizeWithPath(
|
|
26
|
+
'vs/workbench/contrib/preferences/browser/keybindingsEditorContribution',
|
|
27
|
+
'defineKeybinding.kbLayoutErrorMessage',
|
|
28
|
+
"You won't be able to produce this key combination under your current keyboard layout."
|
|
29
|
+
));
|
|
30
|
+
let DefineKeybindingEditorContribution = class DefineKeybindingEditorContribution extends Disposable {
|
|
31
|
+
constructor(_editor, _instantiationService, _userDataProfileService) {
|
|
32
|
+
super();
|
|
33
|
+
this._editor = _editor;
|
|
34
|
+
this._instantiationService = _instantiationService;
|
|
35
|
+
this._userDataProfileService = _userDataProfileService;
|
|
36
|
+
this._keybindingDecorationRenderer = this._register(( new MutableDisposable()));
|
|
37
|
+
this._defineWidget = this._register(this._instantiationService.createInstance(DefineKeybindingOverlayWidget, this._editor));
|
|
38
|
+
this._register(this._editor.onDidChangeModel(e => this._update()));
|
|
39
|
+
this._update();
|
|
40
|
+
}
|
|
41
|
+
_update() {
|
|
42
|
+
this._keybindingDecorationRenderer.value = isInterestingEditorModel(this._editor, this._userDataProfileService)
|
|
43
|
+
? this._instantiationService.createInstance(KeybindingEditorDecorationsRenderer, this._editor)
|
|
44
|
+
: undefined;
|
|
45
|
+
}
|
|
46
|
+
showDefineKeybindingWidget() {
|
|
47
|
+
if (isInterestingEditorModel(this._editor, this._userDataProfileService)) {
|
|
48
|
+
this._defineWidget.start().then(keybinding => this._onAccepted(keybinding));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
_onAccepted(keybinding) {
|
|
52
|
+
this._editor.focus();
|
|
53
|
+
if (keybinding && this._editor.hasModel()) {
|
|
54
|
+
const regexp = ( new RegExp(/\\/g));
|
|
55
|
+
const backslash = regexp.test(keybinding);
|
|
56
|
+
if (backslash) {
|
|
57
|
+
keybinding = keybinding.slice(0, -1) + '\\\\';
|
|
58
|
+
}
|
|
59
|
+
let snippetText = [
|
|
60
|
+
'{',
|
|
61
|
+
'\t"key": ' + JSON.stringify(keybinding) + ',',
|
|
62
|
+
'\t"command": "${1:commandId}",',
|
|
63
|
+
'\t"when": "${2:editorTextFocus}"',
|
|
64
|
+
'}$0'
|
|
65
|
+
].join('\n');
|
|
66
|
+
const smartInsertInfo = SmartSnippetInserter.insertSnippet(this._editor.getModel(), this._editor.getPosition());
|
|
67
|
+
snippetText = smartInsertInfo.prepend + snippetText + smartInsertInfo.append;
|
|
68
|
+
this._editor.setPosition(smartInsertInfo.position);
|
|
69
|
+
SnippetController2.get(this._editor)?.insert(snippetText, { overwriteBefore: 0, overwriteAfter: 0 });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
DefineKeybindingEditorContribution = ( __decorate([
|
|
74
|
+
( __param(1, IInstantiationService)),
|
|
75
|
+
( __param(2, IUserDataProfileService))
|
|
76
|
+
], DefineKeybindingEditorContribution));
|
|
77
|
+
let KeybindingEditorDecorationsRenderer = KeybindingEditorDecorationsRenderer_1 = class KeybindingEditorDecorationsRenderer extends Disposable {
|
|
78
|
+
constructor(_editor, _keybindingService) {
|
|
79
|
+
super();
|
|
80
|
+
this._editor = _editor;
|
|
81
|
+
this._keybindingService = _keybindingService;
|
|
82
|
+
this._dec = this._editor.createDecorationsCollection();
|
|
83
|
+
this._updateDecorations = this._register(( new RunOnceScheduler(() => this._updateDecorationsNow(), 500)));
|
|
84
|
+
const model = assertIsDefined(this._editor.getModel());
|
|
85
|
+
this._register(model.onDidChangeContent(() => this._updateDecorations.schedule()));
|
|
86
|
+
this._register(this._keybindingService.onDidUpdateKeybindings(() => this._updateDecorations.schedule()));
|
|
87
|
+
this._register({
|
|
88
|
+
dispose: () => {
|
|
89
|
+
this._dec.clear();
|
|
90
|
+
this._updateDecorations.cancel();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
this._updateDecorations.schedule();
|
|
94
|
+
}
|
|
95
|
+
_updateDecorationsNow() {
|
|
96
|
+
const model = assertIsDefined(this._editor.getModel());
|
|
97
|
+
const newDecorations = [];
|
|
98
|
+
const root = parseTree(model.getValue());
|
|
99
|
+
if (root && Array.isArray(root.children)) {
|
|
100
|
+
for (let i = 0, len = root.children.length; i < len; i++) {
|
|
101
|
+
const entry = root.children[i];
|
|
102
|
+
const dec = this._getDecorationForEntry(model, entry);
|
|
103
|
+
if (dec !== null) {
|
|
104
|
+
newDecorations.push(dec);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
this._dec.set(newDecorations);
|
|
109
|
+
}
|
|
110
|
+
_getDecorationForEntry(model, entry) {
|
|
111
|
+
if (!Array.isArray(entry.children)) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
for (let i = 0, len = entry.children.length; i < len; i++) {
|
|
115
|
+
const prop = entry.children[i];
|
|
116
|
+
if (prop.type !== 'property') {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (!Array.isArray(prop.children) || prop.children.length !== 2) {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const key = prop.children[0];
|
|
123
|
+
if (key.value !== 'key') {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const value = prop.children[1];
|
|
127
|
+
if (value.type !== 'string') {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
const resolvedKeybindings = this._keybindingService.resolveUserBinding(value.value);
|
|
131
|
+
if (resolvedKeybindings.length === 0) {
|
|
132
|
+
return this._createDecoration(true, null, null, model, value);
|
|
133
|
+
}
|
|
134
|
+
const resolvedKeybinding = resolvedKeybindings[0];
|
|
135
|
+
let usLabel = null;
|
|
136
|
+
if (resolvedKeybinding instanceof WindowsNativeResolvedKeybinding) {
|
|
137
|
+
usLabel = resolvedKeybinding.getUSLabel();
|
|
138
|
+
}
|
|
139
|
+
if (!resolvedKeybinding.isWYSIWYG()) {
|
|
140
|
+
const uiLabel = resolvedKeybinding.getLabel();
|
|
141
|
+
if (typeof uiLabel === 'string' && value.value.toLowerCase() === uiLabel.toLowerCase()) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
return this._createDecoration(false, resolvedKeybinding.getLabel(), usLabel, model, value);
|
|
145
|
+
}
|
|
146
|
+
if (/abnt_|oem_/.test(value.value)) {
|
|
147
|
+
return this._createDecoration(false, resolvedKeybinding.getLabel(), usLabel, model, value);
|
|
148
|
+
}
|
|
149
|
+
const expectedUserSettingsLabel = resolvedKeybinding.getUserSettingsLabel();
|
|
150
|
+
if (typeof expectedUserSettingsLabel === 'string' && !KeybindingEditorDecorationsRenderer_1._userSettingsFuzzyEquals(value.value, expectedUserSettingsLabel)) {
|
|
151
|
+
return this._createDecoration(false, resolvedKeybinding.getLabel(), usLabel, model, value);
|
|
152
|
+
}
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
static _userSettingsFuzzyEquals(a, b) {
|
|
158
|
+
a = a.trim().toLowerCase();
|
|
159
|
+
b = b.trim().toLowerCase();
|
|
160
|
+
if (a === b) {
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
const aKeybinding = KeybindingParser.parseKeybinding(a);
|
|
164
|
+
const bKeybinding = KeybindingParser.parseKeybinding(b);
|
|
165
|
+
if (aKeybinding === null && bKeybinding === null) {
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
if (!aKeybinding || !bKeybinding) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
return aKeybinding.equals(bKeybinding);
|
|
172
|
+
}
|
|
173
|
+
_createDecoration(isError, uiLabel, usLabel, model, keyNode) {
|
|
174
|
+
let msg;
|
|
175
|
+
let className;
|
|
176
|
+
let overviewRulerColor;
|
|
177
|
+
if (isError) {
|
|
178
|
+
msg = ( new MarkdownString()).appendText(NLS_KB_LAYOUT_ERROR_MESSAGE);
|
|
179
|
+
className = 'keybindingError';
|
|
180
|
+
overviewRulerColor = themeColorFromId(overviewRulerError);
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
if (usLabel && uiLabel !== usLabel) {
|
|
184
|
+
msg = ( new MarkdownString(( localizeWithPath(
|
|
185
|
+
'vs/workbench/contrib/preferences/browser/keybindingsEditorContribution',
|
|
186
|
+
{
|
|
187
|
+
key: 'defineKeybinding.kbLayoutLocalAndUSMessage',
|
|
188
|
+
comment: [
|
|
189
|
+
'Please translate maintaining the stars (*) around the placeholders such that they will be rendered in bold.',
|
|
190
|
+
'The placeholders will contain a keyboard combination e.g. Ctrl+Shift+/'
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
"**{0}** for your current keyboard layout (**{1}** for US standard).",
|
|
194
|
+
uiLabel,
|
|
195
|
+
usLabel
|
|
196
|
+
))));
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
msg = ( new MarkdownString(( localizeWithPath(
|
|
200
|
+
'vs/workbench/contrib/preferences/browser/keybindingsEditorContribution',
|
|
201
|
+
{
|
|
202
|
+
key: 'defineKeybinding.kbLayoutLocalMessage',
|
|
203
|
+
comment: [
|
|
204
|
+
'Please translate maintaining the stars (*) around the placeholder such that it will be rendered in bold.',
|
|
205
|
+
'The placeholder will contain a keyboard combination e.g. Ctrl+Shift+/'
|
|
206
|
+
]
|
|
207
|
+
},
|
|
208
|
+
"**{0}** for your current keyboard layout.",
|
|
209
|
+
uiLabel
|
|
210
|
+
))));
|
|
211
|
+
}
|
|
212
|
+
className = 'keybindingInfo';
|
|
213
|
+
overviewRulerColor = themeColorFromId(overviewRulerInfo);
|
|
214
|
+
}
|
|
215
|
+
const startPosition = model.getPositionAt(keyNode.offset);
|
|
216
|
+
const endPosition = model.getPositionAt(keyNode.offset + keyNode.length);
|
|
217
|
+
const range = ( new Range(
|
|
218
|
+
startPosition.lineNumber,
|
|
219
|
+
startPosition.column,
|
|
220
|
+
endPosition.lineNumber,
|
|
221
|
+
endPosition.column
|
|
222
|
+
));
|
|
223
|
+
return {
|
|
224
|
+
range: range,
|
|
225
|
+
options: {
|
|
226
|
+
description: 'keybindings-widget',
|
|
227
|
+
stickiness: 1 ,
|
|
228
|
+
className: className,
|
|
229
|
+
hoverMessage: msg,
|
|
230
|
+
overviewRuler: {
|
|
231
|
+
color: overviewRulerColor,
|
|
232
|
+
position: OverviewRulerLane.Right
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
KeybindingEditorDecorationsRenderer = KeybindingEditorDecorationsRenderer_1 = ( __decorate([
|
|
239
|
+
( __param(1, IKeybindingService))
|
|
240
|
+
], KeybindingEditorDecorationsRenderer));
|
|
241
|
+
function isInterestingEditorModel(editor, userDataProfileService) {
|
|
242
|
+
const model = editor.getModel();
|
|
243
|
+
if (!model) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
return isEqual(model.uri, userDataProfileService.currentProfile.keybindingsResource);
|
|
247
|
+
}
|
|
248
|
+
registerEditorContribution(DEFINE_KEYBINDING_EDITOR_CONTRIB_ID, DefineKeybindingEditorContribution, 1 );
|
|
249
|
+
|
|
250
|
+
export { KeybindingEditorDecorationsRenderer };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { createScanner } from 'vscode/vscode/vs/base/common/json';
|
|
2
|
+
import { Position } from 'vscode/vscode/vs/editor/common/core/position';
|
|
3
|
+
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
4
|
+
|
|
5
|
+
class SmartSnippetInserter {
|
|
6
|
+
static hasOpenBrace(scanner) {
|
|
7
|
+
while (scanner.scan() !== 17 ) {
|
|
8
|
+
const kind = scanner.getToken();
|
|
9
|
+
if (kind === 1 ) {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
static offsetToPosition(model, offset) {
|
|
16
|
+
let offsetBeforeLine = 0;
|
|
17
|
+
const eolLength = model.getEOL().length;
|
|
18
|
+
const lineCount = model.getLineCount();
|
|
19
|
+
for (let lineNumber = 1; lineNumber <= lineCount; lineNumber++) {
|
|
20
|
+
const lineTotalLength = model.getLineLength(lineNumber) + eolLength;
|
|
21
|
+
const offsetAfterLine = offsetBeforeLine + lineTotalLength;
|
|
22
|
+
if (offsetAfterLine > offset) {
|
|
23
|
+
return ( new Position(lineNumber, offset - offsetBeforeLine + 1));
|
|
24
|
+
}
|
|
25
|
+
offsetBeforeLine = offsetAfterLine;
|
|
26
|
+
}
|
|
27
|
+
return ( new Position(lineCount, model.getLineMaxColumn(lineCount)));
|
|
28
|
+
}
|
|
29
|
+
static insertSnippet(model, _position) {
|
|
30
|
+
const desiredPosition = model.getValueLengthInRange(( new Range(1, 1, _position.lineNumber, _position.column)));
|
|
31
|
+
let State;
|
|
32
|
+
( (function(State) {
|
|
33
|
+
State[State["INVALID"] = 0] = "INVALID";
|
|
34
|
+
State[State["AFTER_OBJECT"] = 1] = "AFTER_OBJECT";
|
|
35
|
+
State[State["BEFORE_OBJECT"] = 2] = "BEFORE_OBJECT";
|
|
36
|
+
})(State || (State = {})));
|
|
37
|
+
let currentState = State.INVALID;
|
|
38
|
+
let lastValidPos = -1;
|
|
39
|
+
let lastValidState = State.INVALID;
|
|
40
|
+
const scanner = createScanner(model.getValue());
|
|
41
|
+
let arrayLevel = 0;
|
|
42
|
+
let objLevel = 0;
|
|
43
|
+
const checkRangeStatus = (pos, state) => {
|
|
44
|
+
if (state !== State.INVALID && arrayLevel === 1 && objLevel === 0) {
|
|
45
|
+
currentState = state;
|
|
46
|
+
lastValidPos = pos;
|
|
47
|
+
lastValidState = state;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
if (currentState !== State.INVALID) {
|
|
51
|
+
currentState = State.INVALID;
|
|
52
|
+
lastValidPos = scanner.getTokenOffset();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
while (scanner.scan() !== 17 ) {
|
|
57
|
+
const currentPos = scanner.getPosition();
|
|
58
|
+
const kind = scanner.getToken();
|
|
59
|
+
let goodKind = false;
|
|
60
|
+
switch (kind) {
|
|
61
|
+
case 3 :
|
|
62
|
+
goodKind = true;
|
|
63
|
+
arrayLevel++;
|
|
64
|
+
checkRangeStatus(currentPos, State.BEFORE_OBJECT);
|
|
65
|
+
break;
|
|
66
|
+
case 4 :
|
|
67
|
+
goodKind = true;
|
|
68
|
+
arrayLevel--;
|
|
69
|
+
checkRangeStatus(currentPos, State.INVALID);
|
|
70
|
+
break;
|
|
71
|
+
case 5 :
|
|
72
|
+
goodKind = true;
|
|
73
|
+
checkRangeStatus(currentPos, State.BEFORE_OBJECT);
|
|
74
|
+
break;
|
|
75
|
+
case 1 :
|
|
76
|
+
goodKind = true;
|
|
77
|
+
objLevel++;
|
|
78
|
+
checkRangeStatus(currentPos, State.INVALID);
|
|
79
|
+
break;
|
|
80
|
+
case 2 :
|
|
81
|
+
goodKind = true;
|
|
82
|
+
objLevel--;
|
|
83
|
+
checkRangeStatus(currentPos, State.AFTER_OBJECT);
|
|
84
|
+
break;
|
|
85
|
+
case 15 :
|
|
86
|
+
case 14 :
|
|
87
|
+
goodKind = true;
|
|
88
|
+
}
|
|
89
|
+
if (currentPos >= desiredPosition && (currentState !== State.INVALID || lastValidPos !== -1)) {
|
|
90
|
+
let acceptPosition;
|
|
91
|
+
let acceptState;
|
|
92
|
+
if (currentState !== State.INVALID) {
|
|
93
|
+
acceptPosition = (goodKind ? currentPos : scanner.getTokenOffset());
|
|
94
|
+
acceptState = currentState;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
acceptPosition = lastValidPos;
|
|
98
|
+
acceptState = lastValidState;
|
|
99
|
+
}
|
|
100
|
+
if (acceptState === State.AFTER_OBJECT) {
|
|
101
|
+
return {
|
|
102
|
+
position: this.offsetToPosition(model, acceptPosition),
|
|
103
|
+
prepend: ',',
|
|
104
|
+
append: ''
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
scanner.setPosition(acceptPosition);
|
|
109
|
+
return {
|
|
110
|
+
position: this.offsetToPosition(model, acceptPosition),
|
|
111
|
+
prepend: '',
|
|
112
|
+
append: this.hasOpenBrace(scanner) ? ',' : ''
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const modelLineCount = model.getLineCount();
|
|
118
|
+
return {
|
|
119
|
+
position: ( new Position(modelLineCount, model.getLineMaxColumn(modelLineCount))),
|
|
120
|
+
prepend: '\n[',
|
|
121
|
+
append: ']'
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { SmartSnippetInserter };
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
1
2
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
2
3
|
import { isFalsyOrWhitespace } from 'vscode/vscode/vs/base/common/strings';
|
|
3
4
|
import { joinPath } from 'vscode/vscode/vs/base/common/resources';
|
|
4
5
|
import { ExtensionsRegistry } from 'vscode/vscode/vs/workbench/services/extensions/common/extensionsRegistry';
|
|
5
6
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
6
7
|
import { MenuId, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
7
|
-
import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
8
|
+
import { DisposableStore, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
8
9
|
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
9
10
|
import { index } from 'vscode/vscode/vs/base/common/arrays';
|
|
10
11
|
import { isProposedApiEnabled } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
12
|
+
import { Extensions } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionFeatures';
|
|
13
|
+
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
14
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
15
|
+
import { platform } from 'vscode/vscode/vs/base/common/process';
|
|
16
|
+
import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
|
|
17
|
+
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
11
18
|
|
|
12
19
|
const apiMenus = [
|
|
13
20
|
{
|
|
@@ -141,6 +148,15 @@ const apiMenus = [
|
|
|
141
148
|
"The debug toolbar menu"
|
|
142
149
|
))
|
|
143
150
|
},
|
|
151
|
+
{
|
|
152
|
+
key: 'notebook/variables/context',
|
|
153
|
+
id: MenuId.NotebookVariablesContext,
|
|
154
|
+
description: ( localizeWithPath(
|
|
155
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
156
|
+
'menus.notebookVariablesContext',
|
|
157
|
+
"The notebook variables view context menu"
|
|
158
|
+
))
|
|
159
|
+
},
|
|
144
160
|
{
|
|
145
161
|
key: 'menuBar/home',
|
|
146
162
|
id: MenuId.MenubarHomeMenu,
|
|
@@ -179,6 +195,16 @@ const apiMenus = [
|
|
|
179
195
|
"The Source Control menu"
|
|
180
196
|
))
|
|
181
197
|
},
|
|
198
|
+
{
|
|
199
|
+
key: 'scm/sourceControl/title',
|
|
200
|
+
id: MenuId.SCMSourceControlTitle,
|
|
201
|
+
description: ( localizeWithPath(
|
|
202
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
203
|
+
'menus.scmSourceControlTitle',
|
|
204
|
+
"The Source Control title menu"
|
|
205
|
+
)),
|
|
206
|
+
proposed: 'contribSourceControlTitleMenu'
|
|
207
|
+
},
|
|
182
208
|
{
|
|
183
209
|
key: 'scm/resourceState/context',
|
|
184
210
|
id: MenuId.SCMResourceContext,
|
|
@@ -235,6 +261,16 @@ const apiMenus = [
|
|
|
235
261
|
)),
|
|
236
262
|
proposed: 'contribSourceControlHistoryItemGroupMenu'
|
|
237
263
|
},
|
|
264
|
+
{
|
|
265
|
+
key: 'scm/incomingChanges/context',
|
|
266
|
+
id: MenuId.SCMIncomingChangesContext,
|
|
267
|
+
description: ( localizeWithPath(
|
|
268
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
269
|
+
'menus.incomingChangesContext',
|
|
270
|
+
"The Source Control incoming changes context menu"
|
|
271
|
+
)),
|
|
272
|
+
proposed: 'contribSourceControlHistoryItemGroupMenu'
|
|
273
|
+
},
|
|
238
274
|
{
|
|
239
275
|
key: 'scm/outgoingChanges',
|
|
240
276
|
id: MenuId.SCMOutgoingChanges,
|
|
@@ -245,6 +281,16 @@ const apiMenus = [
|
|
|
245
281
|
)),
|
|
246
282
|
proposed: 'contribSourceControlHistoryItemGroupMenu'
|
|
247
283
|
},
|
|
284
|
+
{
|
|
285
|
+
key: 'scm/outgoingChanges/context',
|
|
286
|
+
id: MenuId.SCMOutgoingChangesContext,
|
|
287
|
+
description: ( localizeWithPath(
|
|
288
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
289
|
+
'menus.outgoingChangesContext',
|
|
290
|
+
"The Source Control outgoing changes context menu"
|
|
291
|
+
)),
|
|
292
|
+
proposed: 'contribSourceControlHistoryItemGroupMenu'
|
|
293
|
+
},
|
|
248
294
|
{
|
|
249
295
|
key: 'scm/incomingChanges/allChanges/context',
|
|
250
296
|
id: MenuId.SCMIncomingChangesAllChangesContext,
|
|
@@ -465,6 +511,16 @@ const apiMenus = [
|
|
|
465
511
|
"The contributed interactive cell title menu"
|
|
466
512
|
)),
|
|
467
513
|
},
|
|
514
|
+
{
|
|
515
|
+
key: 'issue/reporter',
|
|
516
|
+
id: MenuId.IssueReporter,
|
|
517
|
+
description: ( localizeWithPath(
|
|
518
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
519
|
+
'issue.reporter',
|
|
520
|
+
"The contributed issue reporter menu"
|
|
521
|
+
)),
|
|
522
|
+
proposed: 'contribIssueReporter'
|
|
523
|
+
},
|
|
468
524
|
{
|
|
469
525
|
key: 'testing/item/context',
|
|
470
526
|
id: MenuId.TestItem,
|
|
@@ -595,6 +651,17 @@ const apiMenus = [
|
|
|
595
651
|
supportsSubmenus: false,
|
|
596
652
|
proposed: 'inlineCompletionsAdditions'
|
|
597
653
|
},
|
|
654
|
+
{
|
|
655
|
+
key: 'editor/inlineEdit/actions',
|
|
656
|
+
id: MenuId.InlineEditActions,
|
|
657
|
+
description: ( localizeWithPath(
|
|
658
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
659
|
+
'inlineEdit.actions',
|
|
660
|
+
"The actions shown when hovering on an inline edit"
|
|
661
|
+
)),
|
|
662
|
+
supportsSubmenus: false,
|
|
663
|
+
proposed: 'inlineEdit'
|
|
664
|
+
},
|
|
598
665
|
{
|
|
599
666
|
key: 'editor/content',
|
|
600
667
|
id: MenuId.EditorContent,
|
|
@@ -1103,7 +1170,7 @@ var schema;
|
|
|
1103
1170
|
};
|
|
1104
1171
|
})(schema || (schema = {})));
|
|
1105
1172
|
const _commandRegistrations = ( new DisposableStore());
|
|
1106
|
-
const commandsExtensionPoint =
|
|
1173
|
+
const commandsExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
1107
1174
|
extensionPoint: 'commands',
|
|
1108
1175
|
jsonSchema: schema.commandsContribution,
|
|
1109
1176
|
activationEventsGenerator: (contribs, result) => {
|
|
@@ -1113,7 +1180,7 @@ const commandsExtensionPoint = ( ExtensionsRegistry.registerExtensionPoint({
|
|
|
1113
1180
|
}
|
|
1114
1181
|
}
|
|
1115
1182
|
}
|
|
1116
|
-
})
|
|
1183
|
+
});
|
|
1117
1184
|
commandsExtensionPoint.setHandler(extensions => {
|
|
1118
1185
|
function handleCommand(userFriendlyCommand, extension) {
|
|
1119
1186
|
if (!schema.isValidCommand(userFriendlyCommand, extension.collector)) {
|
|
@@ -1178,10 +1245,10 @@ commandsExtensionPoint.setHandler(extensions => {
|
|
|
1178
1245
|
}
|
|
1179
1246
|
});
|
|
1180
1247
|
const _submenus = ( new Map());
|
|
1181
|
-
const submenusExtensionPoint =
|
|
1248
|
+
const submenusExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
1182
1249
|
extensionPoint: 'submenus',
|
|
1183
1250
|
jsonSchema: schema.submenusContribution
|
|
1184
|
-
})
|
|
1251
|
+
});
|
|
1185
1252
|
submenusExtensionPoint.setHandler(extensions => {
|
|
1186
1253
|
_submenus.clear();
|
|
1187
1254
|
for (const extension of extensions) {
|
|
@@ -1241,11 +1308,11 @@ submenusExtensionPoint.setHandler(extensions => {
|
|
|
1241
1308
|
const _apiMenusByKey = ( new Map(( apiMenus.map(menu => ([menu.key, menu])))));
|
|
1242
1309
|
const _menuRegistrations = ( new DisposableStore());
|
|
1243
1310
|
const _submenuMenuItems = ( new Map());
|
|
1244
|
-
const menusExtensionPoint =
|
|
1311
|
+
const menusExtensionPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
1245
1312
|
extensionPoint: 'menus',
|
|
1246
1313
|
jsonSchema: schema.menusContribution,
|
|
1247
1314
|
deps: [submenusExtensionPoint]
|
|
1248
|
-
})
|
|
1315
|
+
});
|
|
1249
1316
|
menusExtensionPoint.setHandler(extensions => {
|
|
1250
1317
|
_menuRegistrations.clear();
|
|
1251
1318
|
_submenuMenuItems.clear();
|
|
@@ -1364,5 +1431,128 @@ menusExtensionPoint.setHandler(extensions => {
|
|
|
1364
1431
|
}
|
|
1365
1432
|
}
|
|
1366
1433
|
});
|
|
1434
|
+
let CommandsTableRenderer = class CommandsTableRenderer extends Disposable {
|
|
1435
|
+
constructor(_keybindingService) {
|
|
1436
|
+
super();
|
|
1437
|
+
this._keybindingService = _keybindingService;
|
|
1438
|
+
this.type = 'table';
|
|
1439
|
+
}
|
|
1440
|
+
shouldRender(manifest) {
|
|
1441
|
+
return !!manifest.contributes?.commands;
|
|
1442
|
+
}
|
|
1443
|
+
render(manifest) {
|
|
1444
|
+
const rawCommands = manifest.contributes?.commands || [];
|
|
1445
|
+
const commands = ( rawCommands.map(c => ({
|
|
1446
|
+
id: c.command,
|
|
1447
|
+
title: c.title,
|
|
1448
|
+
keybindings: [],
|
|
1449
|
+
menus: []
|
|
1450
|
+
})));
|
|
1451
|
+
const byId = index(commands, c => c.id);
|
|
1452
|
+
const menus = manifest.contributes?.menus || {};
|
|
1453
|
+
for (const context in menus) {
|
|
1454
|
+
for (const menu of menus[context]) {
|
|
1455
|
+
if (menu.command) {
|
|
1456
|
+
let command = byId[menu.command];
|
|
1457
|
+
if (command) {
|
|
1458
|
+
command.menus.push(context);
|
|
1459
|
+
}
|
|
1460
|
+
else {
|
|
1461
|
+
command = { id: menu.command, title: '', keybindings: [], menus: [context] };
|
|
1462
|
+
byId[command.id] = command;
|
|
1463
|
+
commands.push(command);
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
const rawKeybindings = manifest.contributes?.keybindings ? (Array.isArray(manifest.contributes.keybindings) ? manifest.contributes.keybindings : [manifest.contributes.keybindings]) : [];
|
|
1469
|
+
rawKeybindings.forEach(rawKeybinding => {
|
|
1470
|
+
const keybinding = this.resolveKeybinding(rawKeybinding);
|
|
1471
|
+
if (!keybinding) {
|
|
1472
|
+
return;
|
|
1473
|
+
}
|
|
1474
|
+
let command = byId[rawKeybinding.command];
|
|
1475
|
+
if (command) {
|
|
1476
|
+
command.keybindings.push(keybinding);
|
|
1477
|
+
}
|
|
1478
|
+
else {
|
|
1479
|
+
command = { id: rawKeybinding.command, title: '', keybindings: [keybinding], menus: [] };
|
|
1480
|
+
byId[command.id] = command;
|
|
1481
|
+
commands.push(command);
|
|
1482
|
+
}
|
|
1483
|
+
});
|
|
1484
|
+
if (!commands.length) {
|
|
1485
|
+
return { data: { headers: [], rows: [] }, dispose: () => { } };
|
|
1486
|
+
}
|
|
1487
|
+
const headers = [
|
|
1488
|
+
( localizeWithPath(
|
|
1489
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
1490
|
+
'command name',
|
|
1491
|
+
"ID"
|
|
1492
|
+
)),
|
|
1493
|
+
( localizeWithPath(
|
|
1494
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
1495
|
+
'command title',
|
|
1496
|
+
"Title"
|
|
1497
|
+
)),
|
|
1498
|
+
( localizeWithPath(
|
|
1499
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
1500
|
+
'keyboard shortcuts',
|
|
1501
|
+
"Keyboard Shortcuts"
|
|
1502
|
+
)),
|
|
1503
|
+
( localizeWithPath(
|
|
1504
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
1505
|
+
'menuContexts',
|
|
1506
|
+
"Menu Contexts"
|
|
1507
|
+
))
|
|
1508
|
+
];
|
|
1509
|
+
const rows = ( commands.sort((a, b) => a.id.localeCompare(b.id))
|
|
1510
|
+
.map(command => {
|
|
1511
|
+
return [
|
|
1512
|
+
( new MarkdownString()).appendMarkdown(`\`${command.id}\``),
|
|
1513
|
+
typeof command.title === 'string' ? command.title : command.title.value,
|
|
1514
|
+
command.keybindings,
|
|
1515
|
+
( new MarkdownString()).appendMarkdown(`${( command.menus.map(menu => `\`${menu}\``)).join(' ')}`),
|
|
1516
|
+
];
|
|
1517
|
+
}));
|
|
1518
|
+
return {
|
|
1519
|
+
data: {
|
|
1520
|
+
headers,
|
|
1521
|
+
rows
|
|
1522
|
+
},
|
|
1523
|
+
dispose: () => { }
|
|
1524
|
+
};
|
|
1525
|
+
}
|
|
1526
|
+
resolveKeybinding(rawKeyBinding) {
|
|
1527
|
+
let key;
|
|
1528
|
+
switch (platform) {
|
|
1529
|
+
case 'win32':
|
|
1530
|
+
key = rawKeyBinding.win;
|
|
1531
|
+
break;
|
|
1532
|
+
case 'linux':
|
|
1533
|
+
key = rawKeyBinding.linux;
|
|
1534
|
+
break;
|
|
1535
|
+
case 'darwin':
|
|
1536
|
+
key = rawKeyBinding.mac;
|
|
1537
|
+
break;
|
|
1538
|
+
}
|
|
1539
|
+
return this._keybindingService.resolveUserBinding(key ?? rawKeyBinding.key)[0];
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
CommandsTableRenderer = ( __decorate([
|
|
1543
|
+
( __param(0, IKeybindingService))
|
|
1544
|
+
], CommandsTableRenderer));
|
|
1545
|
+
( Registry.as(Extensions.ExtensionFeaturesRegistry)).registerExtensionFeature({
|
|
1546
|
+
id: 'commands',
|
|
1547
|
+
label: ( localizeWithPath(
|
|
1548
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
1549
|
+
'commands',
|
|
1550
|
+
"Commands"
|
|
1551
|
+
)),
|
|
1552
|
+
access: {
|
|
1553
|
+
canToggle: false,
|
|
1554
|
+
},
|
|
1555
|
+
renderer: ( new SyncDescriptor(CommandsTableRenderer)),
|
|
1556
|
+
});
|
|
1367
1557
|
|
|
1368
1558
|
export { commandsExtensionPoint };
|
|
@@ -167,7 +167,7 @@ const keybindingType = {
|
|
|
167
167
|
},
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
|
-
const keybindingsExtPoint =
|
|
170
|
+
const keybindingsExtPoint = ExtensionsRegistry.registerExtensionPoint({
|
|
171
171
|
extensionPoint: 'keybindings',
|
|
172
172
|
deps: [commandsExtensionPoint],
|
|
173
173
|
jsonSchema: {
|
|
@@ -184,7 +184,7 @@ const keybindingsExtPoint = ( ExtensionsRegistry.registerExtensionPoint({
|
|
|
184
184
|
}
|
|
185
185
|
]
|
|
186
186
|
}
|
|
187
|
-
})
|
|
187
|
+
});
|
|
188
188
|
const NUMPAD_PRINTABLE_SCANCODES = [
|
|
189
189
|
90 ,
|
|
190
190
|
91 ,
|