@theia/editor 1.20.0 → 1.21.0-next.14
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/lib/browser/editor-contribution.d.ts +5 -3
- package/lib/browser/editor-contribution.d.ts.map +1 -1
- package/lib/browser/editor-contribution.js +36 -9
- package/lib/browser/editor-contribution.js.map +1 -1
- package/lib/browser/editor-frontend-module.js +1 -1
- package/lib/browser/editor-frontend-module.js.map +1 -1
- package/package.json +4 -4
- package/src/browser/editor-contribution.ts +40 -12
- package/src/browser/editor-frontend-module.ts +1 -1
|
@@ -16,15 +16,16 @@
|
|
|
16
16
|
import { EditorManager } from './editor-manager';
|
|
17
17
|
import { TextEditor } from './editor';
|
|
18
18
|
import { StatusBar } from '@theia/core/lib/browser/status-bar/status-bar';
|
|
19
|
-
import { FrontendApplicationContribution, QuickInputService, KeybindingRegistry, KeybindingContribution } from '@theia/core/lib/browser';
|
|
19
|
+
import { FrontendApplicationContribution, QuickInputService, KeybindingRegistry, KeybindingContribution, ApplicationShell } from '@theia/core/lib/browser';
|
|
20
20
|
import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
|
|
21
|
-
import { DisposableCollection } from '@theia/core';
|
|
21
|
+
import { DisposableCollection, MenuContribution, MenuModelRegistry } from '@theia/core';
|
|
22
22
|
import { CommandRegistry, CommandContribution } from '@theia/core/lib/common';
|
|
23
23
|
import { LanguageService } from '@theia/core/lib/browser/language-service';
|
|
24
|
-
export declare class EditorContribution implements FrontendApplicationContribution, CommandContribution, KeybindingContribution {
|
|
24
|
+
export declare class EditorContribution implements FrontendApplicationContribution, CommandContribution, KeybindingContribution, MenuContribution {
|
|
25
25
|
protected readonly statusBar: StatusBar;
|
|
26
26
|
protected readonly editorManager: EditorManager;
|
|
27
27
|
protected readonly languages: LanguageService;
|
|
28
|
+
protected readonly shell: ApplicationShell;
|
|
28
29
|
protected readonly contextKeyService: ContextKeyService;
|
|
29
30
|
protected readonly quickInputService: QuickInputService;
|
|
30
31
|
onStart(): void;
|
|
@@ -36,5 +37,6 @@ export declare class EditorContribution implements FrontendApplicationContributi
|
|
|
36
37
|
protected setCursorPositionStatus(editor: TextEditor | undefined): void;
|
|
37
38
|
registerCommands(commands: CommandRegistry): void;
|
|
38
39
|
registerKeybindings(keybindings: KeybindingRegistry): void;
|
|
40
|
+
registerMenus(registry: MenuModelRegistry): void;
|
|
39
41
|
}
|
|
40
42
|
//# sourceMappingURL=editor-contribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/editor-contribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAsB,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,
|
|
1
|
+
{"version":3,"file":"editor-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/editor-contribution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,OAAO,EAAsB,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAC9F,OAAO,EACH,+BAA+B,EAC/B,iBAAiB,EAAE,kBAAkB,EAAE,sBAAsB,EAA8B,gBAAgB,EAC9G,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAChF,OAAO,EAAkB,oBAAoB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAExG,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAM3E,qBACa,kBAAmB,YAAW,+BAA+B,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,gBAAgB;IAElH,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IACpC,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IAC9C,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IAC7C,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IAGrE,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAGxD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAExD,OAAO,IAAI,IAAI;IAOf,SAAS,CAAC,qBAAqB,IAAI,IAAI;IAkBvC,SAAS,CAAC,QAAQ,CAAC,+BAA+B,uBAA8B;IAChF,SAAS,CAAC,eAAe,IAAI,IAAI;IAiBjC,SAAS,CAAC,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,IAAI;IAgBpE,SAAS,CAAC,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,IAAI;IAcpE,SAAS,CAAC,uBAAuB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,IAAI;IAevE,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI;IAwBjD,mBAAmB,CAAC,WAAW,EAAE,kBAAkB,GAAG,IAAI;IAe1D,aAAa,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;CAsBnD"}
|
|
@@ -35,6 +35,8 @@ const editor_command_1 = require("./editor-command");
|
|
|
35
35
|
const language_service_1 = require("@theia/core/lib/browser/language-service");
|
|
36
36
|
const supported_encodings_1 = require("@theia/core/lib/browser/supported-encodings");
|
|
37
37
|
const nls_1 = require("@theia/core/lib/common/nls");
|
|
38
|
+
const current_widget_command_adapter_1 = require("@theia/core/lib/browser/shell/current-widget-command-adapter");
|
|
39
|
+
const editor_widget_1 = require("./editor-widget");
|
|
38
40
|
let EditorContribution = class EditorContribution {
|
|
39
41
|
constructor() {
|
|
40
42
|
this.toDisposeOnCurrentEditorChanged = new core_1.DisposableCollection();
|
|
@@ -122,15 +124,14 @@ let EditorContribution = class EditorContribution {
|
|
|
122
124
|
commands.registerCommand(editor_command_1.EditorCommands.SHOW_ALL_OPENED_EDITORS, {
|
|
123
125
|
execute: () => { var _a; return (_a = this.quickInputService) === null || _a === void 0 ? void 0 : _a.open('edt '); }
|
|
124
126
|
});
|
|
125
|
-
const splitHandlerFactory = (splitMode) => ({
|
|
126
|
-
isEnabled: ()
|
|
127
|
-
isVisible: ()
|
|
128
|
-
execute: async () => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
const oldEditorState = currentEditor.editor.storeViewState();
|
|
127
|
+
const splitHandlerFactory = (splitMode) => new current_widget_command_adapter_1.CurrentWidgetCommandAdapter(this.shell, {
|
|
128
|
+
isEnabled: title => (title === null || title === void 0 ? void 0 : title.owner) instanceof editor_widget_1.EditorWidget,
|
|
129
|
+
isVisible: title => (title === null || title === void 0 ? void 0 : title.owner) instanceof editor_widget_1.EditorWidget,
|
|
130
|
+
execute: async (title) => {
|
|
131
|
+
if ((title === null || title === void 0 ? void 0 : title.owner) instanceof editor_widget_1.EditorWidget) {
|
|
132
|
+
const selection = title.owner.editor.selection;
|
|
133
|
+
const newEditor = await this.editorManager.openToSide(title.owner.editor.uri, { selection, widgetOptions: { mode: splitMode, ref: title.owner } });
|
|
134
|
+
const oldEditorState = title.owner.editor.storeViewState();
|
|
134
135
|
newEditor.editor.restoreViewState(oldEditorState);
|
|
135
136
|
}
|
|
136
137
|
}
|
|
@@ -156,6 +157,28 @@ let EditorContribution = class EditorContribution {
|
|
|
156
157
|
keybinding: 'ctrlcmd+k ctrlcmd+\\',
|
|
157
158
|
});
|
|
158
159
|
}
|
|
160
|
+
registerMenus(registry) {
|
|
161
|
+
registry.registerMenuAction(browser_1.SHELL_TABBAR_CONTEXT_SPLIT, {
|
|
162
|
+
commandId: editor_command_1.EditorCommands.SPLIT_EDITOR_UP.id,
|
|
163
|
+
label: nls_1.nls.localizeByDefault('Split Up'),
|
|
164
|
+
order: '1',
|
|
165
|
+
});
|
|
166
|
+
registry.registerMenuAction(browser_1.SHELL_TABBAR_CONTEXT_SPLIT, {
|
|
167
|
+
commandId: editor_command_1.EditorCommands.SPLIT_EDITOR_DOWN.id,
|
|
168
|
+
label: nls_1.nls.localizeByDefault('Split Down'),
|
|
169
|
+
order: '2',
|
|
170
|
+
});
|
|
171
|
+
registry.registerMenuAction(browser_1.SHELL_TABBAR_CONTEXT_SPLIT, {
|
|
172
|
+
commandId: editor_command_1.EditorCommands.SPLIT_EDITOR_LEFT.id,
|
|
173
|
+
label: nls_1.nls.localizeByDefault('Split Left'),
|
|
174
|
+
order: '3',
|
|
175
|
+
});
|
|
176
|
+
registry.registerMenuAction(browser_1.SHELL_TABBAR_CONTEXT_SPLIT, {
|
|
177
|
+
commandId: editor_command_1.EditorCommands.SPLIT_EDITOR_RIGHT.id,
|
|
178
|
+
label: nls_1.nls.localizeByDefault('Split Right'),
|
|
179
|
+
order: '4',
|
|
180
|
+
});
|
|
181
|
+
}
|
|
159
182
|
};
|
|
160
183
|
__decorate([
|
|
161
184
|
inversify_1.inject(status_bar_1.StatusBar),
|
|
@@ -169,6 +192,10 @@ __decorate([
|
|
|
169
192
|
inversify_1.inject(language_service_1.LanguageService),
|
|
170
193
|
__metadata("design:type", language_service_1.LanguageService)
|
|
171
194
|
], EditorContribution.prototype, "languages", void 0);
|
|
195
|
+
__decorate([
|
|
196
|
+
inversify_1.inject(browser_1.ApplicationShell),
|
|
197
|
+
__metadata("design:type", browser_1.ApplicationShell)
|
|
198
|
+
], EditorContribution.prototype, "shell", void 0);
|
|
172
199
|
__decorate([
|
|
173
200
|
inversify_1.inject(context_key_service_1.ContextKeyService),
|
|
174
201
|
__metadata("design:type", context_key_service_1.ContextKeyService)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-contribution.js","sourceRoot":"","sources":["../../src/browser/editor-contribution.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,qDAAiD;AAEjD,4DAA4E;AAC5E,8EAA8F;AAC9F,
|
|
1
|
+
{"version":3,"file":"editor-contribution.js","sourceRoot":"","sources":["../../src/browser/editor-contribution.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,qDAAiD;AAEjD,4DAA4E;AAC5E,8EAA8F;AAC9F,qDAGiC;AACjC,qFAAgF;AAChF,sCAAwG;AACxG,qDAAkD;AAElD,+EAA2E;AAC3E,qFAAkF;AAClF,oDAAiD;AACjD,iHAA2G;AAC3G,mDAA+C;AAG/C,IAAa,kBAAkB,GAA/B,MAAa,kBAAkB;IAA/B;QAsCuB,oCAA+B,GAAG,IAAI,2BAAoB,EAAE,CAAC;IA4HpF,CAAC;IArJG,OAAO;QACH,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAE7B,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,aAAa,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IAC5E,CAAC;IAES,qBAAqB;QAC3B,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAU,cAAc,EAAE,KAAK,CAAC,CAAC;QACtF,MAAM,wBAAwB,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAU,0BAA0B,EAAE,KAAK,CAAC,CAAC;QAC9G,MAAM,iBAAiB,GAAG,GAAG,EAAE;YAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;YACvC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;Y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,CAAC,uCAAiB,CAAC;8BACY,uCAAiB;6DAAC;AAGxD;IADC,kBAAM,CAAC,2BAAiB,CAAC;IAAE,oBAAQ,EAAE;;6DACkB;AAX/C,kBAAkB;IAD9B,sBAAU,EAAE;GACA,kBAAkB,CAkK9B;AAlKY,gDAAkB"}
|
|
@@ -59,7 +59,7 @@ exports.default = new inversify_1.ContainerModule(bind => {
|
|
|
59
59
|
bind(navigation_location_updater_1.NavigationLocationUpdater).toSelf().inSingletonScope();
|
|
60
60
|
bind(navigation_location_similarity_1.NavigationLocationSimilarity).toSelf().inSingletonScope();
|
|
61
61
|
bind(browser_2.VariableContribution).to(editor_variable_contribution_1.EditorVariableContribution).inSingletonScope();
|
|
62
|
-
[common_1.CommandContribution, browser_1.KeybindingContribution].forEach(serviceIdentifier => {
|
|
62
|
+
[common_1.CommandContribution, browser_1.KeybindingContribution, common_1.MenuContribution].forEach(serviceIdentifier => {
|
|
63
63
|
bind(serviceIdentifier).toService(editor_contribution_1.EditorContribution);
|
|
64
64
|
});
|
|
65
65
|
bind(quick_editor_service_1.QuickEditorService).toSelf().inSingletonScope();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-frontend-module.js","sourceRoot":"","sources":["../../src/browser/editor-frontend-module.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;AAElF,6CAA2C;AAE3C,4DAA+D;AAC/D,mDAA+E;AAC/E,qDAAiJ;AACjJ,kEAA4E;AAC5E,qDAAwG;AACxG,+DAA2D;AAC3D,+CAAuD;AACvD,qDAA6D;AAC7D,6EAAgI;AAChI,2DAAmE;AACnE,6DAA6D;AAC7D,mEAA8D;AAC9D,qFAAgF;AAChF,0FAAqF;AACrF,0FAAqF;AACrF,gGAA2F;AAC3F,iFAA4E;AAC5E,mFAA2F;AAC3F,iEAA4D;AAE5D,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,0CAAqB,CAAC,IAAI,CAAC,CAAC;IAE5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|
4
4
|
"description": "Theia - Editor Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.
|
|
7
|
-
"@theia/variable-resolver": "1.
|
|
6
|
+
"@theia/core": "1.21.0-next.14+afd980a4d4f",
|
|
7
|
+
"@theia/variable-resolver": "1.21.0-next.14+afd980a4d4f",
|
|
8
8
|
"@types/base64-arraybuffer": "0.1.0",
|
|
9
9
|
"base64-arraybuffer": "^0.1.5"
|
|
10
10
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"nyc": {
|
|
47
47
|
"extends": "../../configs/nyc.json"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "afd980a4d4ff6b48d70fc0ce1e459f6496c62624"
|
|
50
50
|
}
|
|
@@ -18,21 +18,27 @@ import { EditorManager } from './editor-manager';
|
|
|
18
18
|
import { TextEditor } from './editor';
|
|
19
19
|
import { injectable, inject, optional } from '@theia/core/shared/inversify';
|
|
20
20
|
import { StatusBarAlignment, StatusBar } from '@theia/core/lib/browser/status-bar/status-bar';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
FrontendApplicationContribution, DiffUris, DockLayout,
|
|
23
|
+
QuickInputService, KeybindingRegistry, KeybindingContribution, SHELL_TABBAR_CONTEXT_SPLIT, ApplicationShell
|
|
24
|
+
} from '@theia/core/lib/browser';
|
|
22
25
|
import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
|
|
23
|
-
import { CommandHandler, DisposableCollection } from '@theia/core';
|
|
26
|
+
import { CommandHandler, DisposableCollection, MenuContribution, MenuModelRegistry } from '@theia/core';
|
|
24
27
|
import { EditorCommands } from './editor-command';
|
|
25
28
|
import { CommandRegistry, CommandContribution } from '@theia/core/lib/common';
|
|
26
29
|
import { LanguageService } from '@theia/core/lib/browser/language-service';
|
|
27
30
|
import { SUPPORTED_ENCODINGS } from '@theia/core/lib/browser/supported-encodings';
|
|
28
31
|
import { nls } from '@theia/core/lib/common/nls';
|
|
32
|
+
import { CurrentWidgetCommandAdapter } from '@theia/core/lib/browser/shell/current-widget-command-adapter';
|
|
33
|
+
import { EditorWidget } from './editor-widget';
|
|
29
34
|
|
|
30
35
|
@injectable()
|
|
31
|
-
export class EditorContribution implements FrontendApplicationContribution, CommandContribution, KeybindingContribution {
|
|
36
|
+
export class EditorContribution implements FrontendApplicationContribution, CommandContribution, KeybindingContribution, MenuContribution {
|
|
32
37
|
|
|
33
38
|
@inject(StatusBar) protected readonly statusBar: StatusBar;
|
|
34
39
|
@inject(EditorManager) protected readonly editorManager: EditorManager;
|
|
35
40
|
@inject(LanguageService) protected readonly languages: LanguageService;
|
|
41
|
+
@inject(ApplicationShell) protected readonly shell: ApplicationShell;
|
|
36
42
|
|
|
37
43
|
@inject(ContextKeyService)
|
|
38
44
|
protected readonly contextKeyService: ContextKeyService;
|
|
@@ -132,15 +138,14 @@ export class EditorContribution implements FrontendApplicationContribution, Comm
|
|
|
132
138
|
commands.registerCommand(EditorCommands.SHOW_ALL_OPENED_EDITORS, {
|
|
133
139
|
execute: () => this.quickInputService?.open('edt ')
|
|
134
140
|
});
|
|
135
|
-
const splitHandlerFactory = (splitMode: DockLayout.InsertMode): CommandHandler => ({
|
|
136
|
-
isEnabled:
|
|
137
|
-
isVisible:
|
|
138
|
-
execute: async
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
const
|
|
143
|
-
const oldEditorState = currentEditor.editor.storeViewState();
|
|
141
|
+
const splitHandlerFactory = (splitMode: DockLayout.InsertMode): CommandHandler => new CurrentWidgetCommandAdapter(this.shell, {
|
|
142
|
+
isEnabled: title => title?.owner instanceof EditorWidget,
|
|
143
|
+
isVisible: title => title?.owner instanceof EditorWidget,
|
|
144
|
+
execute: async title => {
|
|
145
|
+
if (title?.owner instanceof EditorWidget) {
|
|
146
|
+
const selection = title.owner.editor.selection;
|
|
147
|
+
const newEditor = await this.editorManager.openToSide(title.owner.editor.uri, { selection, widgetOptions: { mode: splitMode, ref: title.owner } });
|
|
148
|
+
const oldEditorState = title.owner.editor.storeViewState();
|
|
144
149
|
newEditor.editor.restoreViewState(oldEditorState);
|
|
145
150
|
}
|
|
146
151
|
}
|
|
@@ -167,4 +172,27 @@ export class EditorContribution implements FrontendApplicationContribution, Comm
|
|
|
167
172
|
keybinding: 'ctrlcmd+k ctrlcmd+\\',
|
|
168
173
|
});
|
|
169
174
|
}
|
|
175
|
+
|
|
176
|
+
registerMenus(registry: MenuModelRegistry): void {
|
|
177
|
+
registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
|
|
178
|
+
commandId: EditorCommands.SPLIT_EDITOR_UP.id,
|
|
179
|
+
label: nls.localizeByDefault('Split Up'),
|
|
180
|
+
order: '1',
|
|
181
|
+
});
|
|
182
|
+
registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
|
|
183
|
+
commandId: EditorCommands.SPLIT_EDITOR_DOWN.id,
|
|
184
|
+
label: nls.localizeByDefault('Split Down'),
|
|
185
|
+
order: '2',
|
|
186
|
+
});
|
|
187
|
+
registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
|
|
188
|
+
commandId: EditorCommands.SPLIT_EDITOR_LEFT.id,
|
|
189
|
+
label: nls.localizeByDefault('Split Left'),
|
|
190
|
+
order: '3',
|
|
191
|
+
});
|
|
192
|
+
registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
|
|
193
|
+
commandId: EditorCommands.SPLIT_EDITOR_RIGHT.id,
|
|
194
|
+
label: nls.localizeByDefault('Split Right'),
|
|
195
|
+
order: '4',
|
|
196
|
+
});
|
|
197
|
+
}
|
|
170
198
|
}
|
|
@@ -69,7 +69,7 @@ export default new ContainerModule(bind => {
|
|
|
69
69
|
|
|
70
70
|
bind(VariableContribution).to(EditorVariableContribution).inSingletonScope();
|
|
71
71
|
|
|
72
|
-
[CommandContribution, KeybindingContribution].forEach(serviceIdentifier => {
|
|
72
|
+
[CommandContribution, KeybindingContribution, MenuContribution].forEach(serviceIdentifier => {
|
|
73
73
|
bind(serviceIdentifier).toService(EditorContribution);
|
|
74
74
|
});
|
|
75
75
|
bind(QuickEditorService).toSelf().inSingletonScope();
|