@theia/editor 1.53.0-next.4 → 1.53.0-next.55

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.
Files changed (48) hide show
  1. package/README.md +30 -30
  2. package/lib/browser/editor-manager.d.ts.map +1 -1
  3. package/lib/browser/editor-manager.js +11 -4
  4. package/lib/browser/editor-manager.js.map +1 -1
  5. package/lib/browser/editor-variable-contribution.d.ts.map +1 -1
  6. package/lib/browser/editor-variable-contribution.js +9 -1
  7. package/lib/browser/editor-variable-contribution.js.map +1 -1
  8. package/lib/browser/editor.d.ts +5 -2
  9. package/lib/browser/editor.d.ts.map +1 -1
  10. package/lib/browser/editor.js.map +1 -1
  11. package/lib/browser/navigation/navigation-location-service.js +3 -3
  12. package/package.json +5 -5
  13. package/src/browser/decorations/editor-decoration-style.ts +41 -41
  14. package/src/browser/decorations/editor-decoration.ts +127 -127
  15. package/src/browser/decorations/editor-decorator.ts +36 -36
  16. package/src/browser/decorations/index.ts +19 -19
  17. package/src/browser/diff-navigator.ts +27 -27
  18. package/src/browser/editor-command.ts +393 -393
  19. package/src/browser/editor-contribution.ts +185 -185
  20. package/src/browser/editor-frontend-module.ts +90 -90
  21. package/src/browser/editor-generated-preference-schema.ts +2956 -2956
  22. package/src/browser/editor-keybinding.ts +55 -55
  23. package/src/browser/editor-language-quick-pick-service.ts +68 -68
  24. package/src/browser/editor-linenumber-contribution.ts +88 -88
  25. package/src/browser/editor-manager.ts +462 -452
  26. package/src/browser/editor-menu.ts +224 -224
  27. package/src/browser/editor-navigation-contribution.ts +343 -343
  28. package/src/browser/editor-preferences.ts +226 -226
  29. package/src/browser/editor-variable-contribution.ts +62 -54
  30. package/src/browser/editor-widget-factory.ts +82 -82
  31. package/src/browser/editor-widget.ts +139 -139
  32. package/src/browser/editor.ts +366 -362
  33. package/src/browser/index.ts +26 -26
  34. package/src/browser/language-status/editor-language-status-service.ts +271 -271
  35. package/src/browser/language-status/editor-language-status.css +101 -101
  36. package/src/browser/navigation/navigation-location-service.spec.ts +245 -245
  37. package/src/browser/navigation/navigation-location-service.ts +284 -284
  38. package/src/browser/navigation/navigation-location-similarity.spec.ts +46 -46
  39. package/src/browser/navigation/navigation-location-similarity.ts +58 -58
  40. package/src/browser/navigation/navigation-location-updater.spec.ts +197 -197
  41. package/src/browser/navigation/navigation-location-updater.ts +220 -220
  42. package/src/browser/navigation/navigation-location.ts +418 -418
  43. package/src/browser/navigation/test/mock-navigation-location-updater.ts +41 -41
  44. package/src/browser/quick-editor-service.ts +94 -94
  45. package/src/browser/style/index.css +19 -19
  46. package/src/browser/undo-redo-service.ts +120 -120
  47. package/src/common/language-selector.ts +104 -104
  48. package/src/package.spec.ts +28 -28
@@ -1,185 +1,185 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2017 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { EditorManager } from './editor-manager';
18
- import { TextEditor } from './editor';
19
- import { injectable, inject, optional } from '@theia/core/shared/inversify';
20
- import { StatusBarAlignment, StatusBar } from '@theia/core/lib/browser/status-bar/status-bar';
21
- import {
22
- FrontendApplicationContribution, DiffUris, DockLayout,
23
- QuickInputService, KeybindingRegistry, KeybindingContribution, SHELL_TABBAR_CONTEXT_SPLIT, ApplicationShell
24
- } from '@theia/core/lib/browser';
25
- import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
26
- import { CommandHandler, DisposableCollection, MenuContribution, MenuModelRegistry } from '@theia/core';
27
- import { EditorCommands } from './editor-command';
28
- import { CommandRegistry, CommandContribution } from '@theia/core/lib/common';
29
- import { SUPPORTED_ENCODINGS } from '@theia/core/lib/browser/supported-encodings';
30
- import { nls } from '@theia/core/lib/common/nls';
31
- import { CurrentWidgetCommandAdapter } from '@theia/core/lib/browser/shell/current-widget-command-adapter';
32
- import { EditorWidget } from './editor-widget';
33
- import { EditorLanguageStatusService } from './language-status/editor-language-status-service';
34
-
35
- @injectable()
36
- export class EditorContribution implements FrontendApplicationContribution, CommandContribution, KeybindingContribution, MenuContribution {
37
-
38
- @inject(StatusBar) protected readonly statusBar: StatusBar;
39
- @inject(EditorManager) protected readonly editorManager: EditorManager;
40
- @inject(EditorLanguageStatusService) protected readonly languageStatusService: EditorLanguageStatusService;
41
- @inject(ApplicationShell) protected readonly shell: ApplicationShell;
42
-
43
- @inject(ContextKeyService)
44
- protected readonly contextKeyService: ContextKeyService;
45
-
46
- @inject(QuickInputService) @optional()
47
- protected readonly quickInputService: QuickInputService;
48
-
49
- onStart(): void {
50
- this.initEditorContextKeys();
51
-
52
- this.updateStatusBar();
53
- this.editorManager.onCurrentEditorChanged(() => this.updateStatusBar());
54
- }
55
-
56
- protected initEditorContextKeys(): void {
57
- const editorIsOpen = this.contextKeyService.createKey<boolean>('editorIsOpen', false);
58
- const textCompareEditorVisible = this.contextKeyService.createKey<boolean>('textCompareEditorVisible', false);
59
- const updateContextKeys = () => {
60
- const widgets = this.editorManager.all;
61
- editorIsOpen.set(!!widgets.length);
62
- textCompareEditorVisible.set(widgets.some(widget => DiffUris.isDiffUri(widget.editor.uri)));
63
- };
64
- updateContextKeys();
65
- for (const widget of this.editorManager.all) {
66
- widget.disposed.connect(updateContextKeys);
67
- }
68
- this.editorManager.onCreated(widget => {
69
- updateContextKeys();
70
- widget.disposed.connect(updateContextKeys);
71
- });
72
- }
73
-
74
- protected readonly toDisposeOnCurrentEditorChanged = new DisposableCollection();
75
- protected updateStatusBar(): void {
76
- this.toDisposeOnCurrentEditorChanged.dispose();
77
-
78
- const widget = this.editorManager.currentEditor;
79
- const editor = widget && widget.editor;
80
- this.updateLanguageStatus(editor);
81
- this.updateEncodingStatus(editor);
82
- this.setCursorPositionStatus(editor);
83
- if (editor) {
84
- this.toDisposeOnCurrentEditorChanged.pushAll([
85
- editor.onLanguageChanged(() => this.updateLanguageStatus(editor)),
86
- editor.onEncodingChanged(() => this.updateEncodingStatus(editor)),
87
- editor.onCursorPositionChanged(() => this.setCursorPositionStatus(editor))
88
- ]);
89
- }
90
- }
91
-
92
- protected updateLanguageStatus(editor: TextEditor | undefined): void {
93
- this.languageStatusService.updateLanguageStatus(editor);
94
- }
95
-
96
- protected updateEncodingStatus(editor: TextEditor | undefined): void {
97
- if (!editor) {
98
- this.statusBar.removeElement('editor-status-encoding');
99
- return;
100
- }
101
- this.statusBar.setElement('editor-status-encoding', {
102
- text: SUPPORTED_ENCODINGS[editor.getEncoding()].labelShort,
103
- alignment: StatusBarAlignment.RIGHT,
104
- priority: 10,
105
- command: EditorCommands.CHANGE_ENCODING.id,
106
- tooltip: nls.localizeByDefault('Select Encoding')
107
- });
108
- }
109
-
110
- protected setCursorPositionStatus(editor: TextEditor | undefined): void {
111
- if (!editor) {
112
- this.statusBar.removeElement('editor-status-cursor-position');
113
- return;
114
- }
115
- const { cursor } = editor;
116
- this.statusBar.setElement('editor-status-cursor-position', {
117
- text: nls.localizeByDefault('Ln {0}, Col {1}', cursor.line + 1, editor.getVisibleColumn(cursor)),
118
- alignment: StatusBarAlignment.RIGHT,
119
- priority: 100,
120
- tooltip: EditorCommands.GOTO_LINE_COLUMN.label,
121
- command: EditorCommands.GOTO_LINE_COLUMN.id
122
- });
123
- }
124
-
125
- registerCommands(commands: CommandRegistry): void {
126
- commands.registerCommand(EditorCommands.SHOW_ALL_OPENED_EDITORS, {
127
- execute: () => this.quickInputService?.open('edt ')
128
- });
129
- const splitHandlerFactory = (splitMode: DockLayout.InsertMode): CommandHandler => new CurrentWidgetCommandAdapter(this.shell, {
130
- isEnabled: title => title?.owner instanceof EditorWidget,
131
- execute: async title => {
132
- if (title?.owner instanceof EditorWidget) {
133
- const selection = title.owner.editor.selection;
134
- const newEditor = await this.editorManager.openToSide(title.owner.editor.uri, { selection, widgetOptions: { mode: splitMode, ref: title.owner } });
135
- const oldEditorState = title.owner.editor.storeViewState();
136
- newEditor.editor.restoreViewState(oldEditorState);
137
- }
138
- }
139
- });
140
- commands.registerCommand(EditorCommands.SPLIT_EDITOR_HORIZONTAL, splitHandlerFactory('split-right'));
141
- commands.registerCommand(EditorCommands.SPLIT_EDITOR_VERTICAL, splitHandlerFactory('split-bottom'));
142
- commands.registerCommand(EditorCommands.SPLIT_EDITOR_RIGHT, splitHandlerFactory('split-right'));
143
- commands.registerCommand(EditorCommands.SPLIT_EDITOR_DOWN, splitHandlerFactory('split-bottom'));
144
- commands.registerCommand(EditorCommands.SPLIT_EDITOR_UP, splitHandlerFactory('split-top'));
145
- commands.registerCommand(EditorCommands.SPLIT_EDITOR_LEFT, splitHandlerFactory('split-left'));
146
- }
147
-
148
- registerKeybindings(keybindings: KeybindingRegistry): void {
149
- keybindings.registerKeybinding({
150
- command: EditorCommands.SHOW_ALL_OPENED_EDITORS.id,
151
- keybinding: 'ctrlcmd+k ctrlcmd+p'
152
- });
153
- keybindings.registerKeybinding({
154
- command: EditorCommands.SPLIT_EDITOR_HORIZONTAL.id,
155
- keybinding: 'ctrlcmd+\\',
156
- });
157
- keybindings.registerKeybinding({
158
- command: EditorCommands.SPLIT_EDITOR_VERTICAL.id,
159
- keybinding: 'ctrlcmd+k ctrlcmd+\\',
160
- });
161
- }
162
-
163
- registerMenus(registry: MenuModelRegistry): void {
164
- registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
165
- commandId: EditorCommands.SPLIT_EDITOR_UP.id,
166
- label: nls.localizeByDefault('Split Up'),
167
- order: '1',
168
- });
169
- registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
170
- commandId: EditorCommands.SPLIT_EDITOR_DOWN.id,
171
- label: nls.localizeByDefault('Split Down'),
172
- order: '2',
173
- });
174
- registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
175
- commandId: EditorCommands.SPLIT_EDITOR_LEFT.id,
176
- label: nls.localizeByDefault('Split Left'),
177
- order: '3',
178
- });
179
- registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
180
- commandId: EditorCommands.SPLIT_EDITOR_RIGHT.id,
181
- label: nls.localizeByDefault('Split Right'),
182
- order: '4',
183
- });
184
- }
185
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2017 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { EditorManager } from './editor-manager';
18
+ import { TextEditor } from './editor';
19
+ import { injectable, inject, optional } from '@theia/core/shared/inversify';
20
+ import { StatusBarAlignment, StatusBar } from '@theia/core/lib/browser/status-bar/status-bar';
21
+ import {
22
+ FrontendApplicationContribution, DiffUris, DockLayout,
23
+ QuickInputService, KeybindingRegistry, KeybindingContribution, SHELL_TABBAR_CONTEXT_SPLIT, ApplicationShell
24
+ } from '@theia/core/lib/browser';
25
+ import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
26
+ import { CommandHandler, DisposableCollection, MenuContribution, MenuModelRegistry } from '@theia/core';
27
+ import { EditorCommands } from './editor-command';
28
+ import { CommandRegistry, CommandContribution } from '@theia/core/lib/common';
29
+ import { SUPPORTED_ENCODINGS } from '@theia/core/lib/browser/supported-encodings';
30
+ import { nls } from '@theia/core/lib/common/nls';
31
+ import { CurrentWidgetCommandAdapter } from '@theia/core/lib/browser/shell/current-widget-command-adapter';
32
+ import { EditorWidget } from './editor-widget';
33
+ import { EditorLanguageStatusService } from './language-status/editor-language-status-service';
34
+
35
+ @injectable()
36
+ export class EditorContribution implements FrontendApplicationContribution, CommandContribution, KeybindingContribution, MenuContribution {
37
+
38
+ @inject(StatusBar) protected readonly statusBar: StatusBar;
39
+ @inject(EditorManager) protected readonly editorManager: EditorManager;
40
+ @inject(EditorLanguageStatusService) protected readonly languageStatusService: EditorLanguageStatusService;
41
+ @inject(ApplicationShell) protected readonly shell: ApplicationShell;
42
+
43
+ @inject(ContextKeyService)
44
+ protected readonly contextKeyService: ContextKeyService;
45
+
46
+ @inject(QuickInputService) @optional()
47
+ protected readonly quickInputService: QuickInputService;
48
+
49
+ onStart(): void {
50
+ this.initEditorContextKeys();
51
+
52
+ this.updateStatusBar();
53
+ this.editorManager.onCurrentEditorChanged(() => this.updateStatusBar());
54
+ }
55
+
56
+ protected initEditorContextKeys(): void {
57
+ const editorIsOpen = this.contextKeyService.createKey<boolean>('editorIsOpen', false);
58
+ const textCompareEditorVisible = this.contextKeyService.createKey<boolean>('textCompareEditorVisible', false);
59
+ const updateContextKeys = () => {
60
+ const widgets = this.editorManager.all;
61
+ editorIsOpen.set(!!widgets.length);
62
+ textCompareEditorVisible.set(widgets.some(widget => DiffUris.isDiffUri(widget.editor.uri)));
63
+ };
64
+ updateContextKeys();
65
+ for (const widget of this.editorManager.all) {
66
+ widget.disposed.connect(updateContextKeys);
67
+ }
68
+ this.editorManager.onCreated(widget => {
69
+ updateContextKeys();
70
+ widget.disposed.connect(updateContextKeys);
71
+ });
72
+ }
73
+
74
+ protected readonly toDisposeOnCurrentEditorChanged = new DisposableCollection();
75
+ protected updateStatusBar(): void {
76
+ this.toDisposeOnCurrentEditorChanged.dispose();
77
+
78
+ const widget = this.editorManager.currentEditor;
79
+ const editor = widget && widget.editor;
80
+ this.updateLanguageStatus(editor);
81
+ this.updateEncodingStatus(editor);
82
+ this.setCursorPositionStatus(editor);
83
+ if (editor) {
84
+ this.toDisposeOnCurrentEditorChanged.pushAll([
85
+ editor.onLanguageChanged(() => this.updateLanguageStatus(editor)),
86
+ editor.onEncodingChanged(() => this.updateEncodingStatus(editor)),
87
+ editor.onCursorPositionChanged(() => this.setCursorPositionStatus(editor))
88
+ ]);
89
+ }
90
+ }
91
+
92
+ protected updateLanguageStatus(editor: TextEditor | undefined): void {
93
+ this.languageStatusService.updateLanguageStatus(editor);
94
+ }
95
+
96
+ protected updateEncodingStatus(editor: TextEditor | undefined): void {
97
+ if (!editor) {
98
+ this.statusBar.removeElement('editor-status-encoding');
99
+ return;
100
+ }
101
+ this.statusBar.setElement('editor-status-encoding', {
102
+ text: SUPPORTED_ENCODINGS[editor.getEncoding()].labelShort,
103
+ alignment: StatusBarAlignment.RIGHT,
104
+ priority: 10,
105
+ command: EditorCommands.CHANGE_ENCODING.id,
106
+ tooltip: nls.localizeByDefault('Select Encoding')
107
+ });
108
+ }
109
+
110
+ protected setCursorPositionStatus(editor: TextEditor | undefined): void {
111
+ if (!editor) {
112
+ this.statusBar.removeElement('editor-status-cursor-position');
113
+ return;
114
+ }
115
+ const { cursor } = editor;
116
+ this.statusBar.setElement('editor-status-cursor-position', {
117
+ text: nls.localizeByDefault('Ln {0}, Col {1}', cursor.line + 1, editor.getVisibleColumn(cursor)),
118
+ alignment: StatusBarAlignment.RIGHT,
119
+ priority: 100,
120
+ tooltip: EditorCommands.GOTO_LINE_COLUMN.label,
121
+ command: EditorCommands.GOTO_LINE_COLUMN.id
122
+ });
123
+ }
124
+
125
+ registerCommands(commands: CommandRegistry): void {
126
+ commands.registerCommand(EditorCommands.SHOW_ALL_OPENED_EDITORS, {
127
+ execute: () => this.quickInputService?.open('edt ')
128
+ });
129
+ const splitHandlerFactory = (splitMode: DockLayout.InsertMode): CommandHandler => new CurrentWidgetCommandAdapter(this.shell, {
130
+ isEnabled: title => title?.owner instanceof EditorWidget,
131
+ execute: async title => {
132
+ if (title?.owner instanceof EditorWidget) {
133
+ const selection = title.owner.editor.selection;
134
+ const newEditor = await this.editorManager.openToSide(title.owner.editor.uri, { selection, widgetOptions: { mode: splitMode, ref: title.owner } });
135
+ const oldEditorState = title.owner.editor.storeViewState();
136
+ newEditor.editor.restoreViewState(oldEditorState);
137
+ }
138
+ }
139
+ });
140
+ commands.registerCommand(EditorCommands.SPLIT_EDITOR_HORIZONTAL, splitHandlerFactory('split-right'));
141
+ commands.registerCommand(EditorCommands.SPLIT_EDITOR_VERTICAL, splitHandlerFactory('split-bottom'));
142
+ commands.registerCommand(EditorCommands.SPLIT_EDITOR_RIGHT, splitHandlerFactory('split-right'));
143
+ commands.registerCommand(EditorCommands.SPLIT_EDITOR_DOWN, splitHandlerFactory('split-bottom'));
144
+ commands.registerCommand(EditorCommands.SPLIT_EDITOR_UP, splitHandlerFactory('split-top'));
145
+ commands.registerCommand(EditorCommands.SPLIT_EDITOR_LEFT, splitHandlerFactory('split-left'));
146
+ }
147
+
148
+ registerKeybindings(keybindings: KeybindingRegistry): void {
149
+ keybindings.registerKeybinding({
150
+ command: EditorCommands.SHOW_ALL_OPENED_EDITORS.id,
151
+ keybinding: 'ctrlcmd+k ctrlcmd+p'
152
+ });
153
+ keybindings.registerKeybinding({
154
+ command: EditorCommands.SPLIT_EDITOR_HORIZONTAL.id,
155
+ keybinding: 'ctrlcmd+\\',
156
+ });
157
+ keybindings.registerKeybinding({
158
+ command: EditorCommands.SPLIT_EDITOR_VERTICAL.id,
159
+ keybinding: 'ctrlcmd+k ctrlcmd+\\',
160
+ });
161
+ }
162
+
163
+ registerMenus(registry: MenuModelRegistry): void {
164
+ registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
165
+ commandId: EditorCommands.SPLIT_EDITOR_UP.id,
166
+ label: nls.localizeByDefault('Split Up'),
167
+ order: '1',
168
+ });
169
+ registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
170
+ commandId: EditorCommands.SPLIT_EDITOR_DOWN.id,
171
+ label: nls.localizeByDefault('Split Down'),
172
+ order: '2',
173
+ });
174
+ registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
175
+ commandId: EditorCommands.SPLIT_EDITOR_LEFT.id,
176
+ label: nls.localizeByDefault('Split Left'),
177
+ order: '3',
178
+ });
179
+ registry.registerMenuAction(SHELL_TABBAR_CONTEXT_SPLIT, {
180
+ commandId: EditorCommands.SPLIT_EDITOR_RIGHT.id,
181
+ label: nls.localizeByDefault('Split Right'),
182
+ order: '4',
183
+ });
184
+ }
185
+ }
@@ -1,90 +1,90 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2018 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import '../../src/browser/style/index.css';
18
- import '../../src/browser/language-status/editor-language-status.css';
19
-
20
- import { ContainerModule } from '@theia/core/shared/inversify';
21
- import { CommandContribution, MenuContribution } from '@theia/core/lib/common';
22
- import { OpenHandler, WidgetFactory, FrontendApplicationContribution, KeybindingContribution } from '@theia/core/lib/browser';
23
- import { VariableContribution } from '@theia/variable-resolver/lib/browser';
24
- import { EditorManager, EditorAccess, ActiveEditorAccess, CurrentEditorAccess } from './editor-manager';
25
- import { EditorContribution } from './editor-contribution';
26
- import { EditorMenuContribution } from './editor-menu';
27
- import { EditorCommandContribution } from './editor-command';
28
- import { EditorKeybindingContribution } from './editor-keybinding';
29
- import { bindEditorPreferences } from './editor-preferences';
30
- import { EditorWidgetFactory } from './editor-widget-factory';
31
- import { EditorNavigationContribution } from './editor-navigation-contribution';
32
- import { NavigationLocationUpdater } from './navigation/navigation-location-updater';
33
- import { NavigationLocationService } from './navigation/navigation-location-service';
34
- import { NavigationLocationSimilarity } from './navigation/navigation-location-similarity';
35
- import { EditorVariableContribution } from './editor-variable-contribution';
36
- import { QuickAccessContribution } from '@theia/core/lib/browser/quick-input/quick-access';
37
- import { QuickEditorService } from './quick-editor-service';
38
- import { EditorLanguageStatusService } from './language-status/editor-language-status-service';
39
- import { EditorLineNumberContribution } from './editor-linenumber-contribution';
40
- import { UndoRedoService } from './undo-redo-service';
41
- import { EditorLanguageQuickPickService } from './editor-language-quick-pick-service';
42
-
43
- export default new ContainerModule(bind => {
44
- bindEditorPreferences(bind);
45
-
46
- bind(EditorWidgetFactory).toSelf().inSingletonScope();
47
- bind(WidgetFactory).toService(EditorWidgetFactory);
48
-
49
- bind(EditorManager).toSelf().inSingletonScope();
50
- bind(OpenHandler).toService(EditorManager);
51
-
52
- bind(EditorCommandContribution).toSelf().inSingletonScope();
53
- bind(CommandContribution).toService(EditorCommandContribution);
54
-
55
- bind(EditorMenuContribution).toSelf().inSingletonScope();
56
- bind(MenuContribution).toService(EditorMenuContribution);
57
-
58
- bind(EditorKeybindingContribution).toSelf().inSingletonScope();
59
- bind(KeybindingContribution).toService(EditorKeybindingContribution);
60
-
61
- bind(EditorContribution).toSelf().inSingletonScope();
62
- bind(FrontendApplicationContribution).toService(EditorContribution);
63
- bind(EditorLanguageStatusService).toSelf().inSingletonScope();
64
-
65
- bind(EditorLineNumberContribution).toSelf().inSingletonScope();
66
- bind(FrontendApplicationContribution).toService(EditorLineNumberContribution);
67
-
68
- bind(EditorNavigationContribution).toSelf().inSingletonScope();
69
- bind(FrontendApplicationContribution).toService(EditorNavigationContribution);
70
- bind(NavigationLocationService).toSelf().inSingletonScope();
71
- bind(NavigationLocationUpdater).toSelf().inSingletonScope();
72
- bind(NavigationLocationSimilarity).toSelf().inSingletonScope();
73
-
74
- bind(VariableContribution).to(EditorVariableContribution).inSingletonScope();
75
-
76
- [CommandContribution, KeybindingContribution, MenuContribution].forEach(serviceIdentifier => {
77
- bind(serviceIdentifier).toService(EditorContribution);
78
- });
79
- bind(QuickEditorService).toSelf().inSingletonScope();
80
- bind(QuickAccessContribution).to(QuickEditorService);
81
-
82
- bind(CurrentEditorAccess).toSelf().inSingletonScope();
83
- bind(ActiveEditorAccess).toSelf().inSingletonScope();
84
- bind(EditorAccess).to(CurrentEditorAccess).inSingletonScope().whenTargetNamed(EditorAccess.CURRENT);
85
- bind(EditorAccess).to(ActiveEditorAccess).inSingletonScope().whenTargetNamed(EditorAccess.ACTIVE);
86
-
87
- bind(UndoRedoService).toSelf().inSingletonScope();
88
-
89
- bind(EditorLanguageQuickPickService).toSelf().inSingletonScope();
90
- });
1
+ // *****************************************************************************
2
+ // Copyright (C) 2018 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import '../../src/browser/style/index.css';
18
+ import '../../src/browser/language-status/editor-language-status.css';
19
+
20
+ import { ContainerModule } from '@theia/core/shared/inversify';
21
+ import { CommandContribution, MenuContribution } from '@theia/core/lib/common';
22
+ import { OpenHandler, WidgetFactory, FrontendApplicationContribution, KeybindingContribution } from '@theia/core/lib/browser';
23
+ import { VariableContribution } from '@theia/variable-resolver/lib/browser';
24
+ import { EditorManager, EditorAccess, ActiveEditorAccess, CurrentEditorAccess } from './editor-manager';
25
+ import { EditorContribution } from './editor-contribution';
26
+ import { EditorMenuContribution } from './editor-menu';
27
+ import { EditorCommandContribution } from './editor-command';
28
+ import { EditorKeybindingContribution } from './editor-keybinding';
29
+ import { bindEditorPreferences } from './editor-preferences';
30
+ import { EditorWidgetFactory } from './editor-widget-factory';
31
+ import { EditorNavigationContribution } from './editor-navigation-contribution';
32
+ import { NavigationLocationUpdater } from './navigation/navigation-location-updater';
33
+ import { NavigationLocationService } from './navigation/navigation-location-service';
34
+ import { NavigationLocationSimilarity } from './navigation/navigation-location-similarity';
35
+ import { EditorVariableContribution } from './editor-variable-contribution';
36
+ import { QuickAccessContribution } from '@theia/core/lib/browser/quick-input/quick-access';
37
+ import { QuickEditorService } from './quick-editor-service';
38
+ import { EditorLanguageStatusService } from './language-status/editor-language-status-service';
39
+ import { EditorLineNumberContribution } from './editor-linenumber-contribution';
40
+ import { UndoRedoService } from './undo-redo-service';
41
+ import { EditorLanguageQuickPickService } from './editor-language-quick-pick-service';
42
+
43
+ export default new ContainerModule(bind => {
44
+ bindEditorPreferences(bind);
45
+
46
+ bind(EditorWidgetFactory).toSelf().inSingletonScope();
47
+ bind(WidgetFactory).toService(EditorWidgetFactory);
48
+
49
+ bind(EditorManager).toSelf().inSingletonScope();
50
+ bind(OpenHandler).toService(EditorManager);
51
+
52
+ bind(EditorCommandContribution).toSelf().inSingletonScope();
53
+ bind(CommandContribution).toService(EditorCommandContribution);
54
+
55
+ bind(EditorMenuContribution).toSelf().inSingletonScope();
56
+ bind(MenuContribution).toService(EditorMenuContribution);
57
+
58
+ bind(EditorKeybindingContribution).toSelf().inSingletonScope();
59
+ bind(KeybindingContribution).toService(EditorKeybindingContribution);
60
+
61
+ bind(EditorContribution).toSelf().inSingletonScope();
62
+ bind(FrontendApplicationContribution).toService(EditorContribution);
63
+ bind(EditorLanguageStatusService).toSelf().inSingletonScope();
64
+
65
+ bind(EditorLineNumberContribution).toSelf().inSingletonScope();
66
+ bind(FrontendApplicationContribution).toService(EditorLineNumberContribution);
67
+
68
+ bind(EditorNavigationContribution).toSelf().inSingletonScope();
69
+ bind(FrontendApplicationContribution).toService(EditorNavigationContribution);
70
+ bind(NavigationLocationService).toSelf().inSingletonScope();
71
+ bind(NavigationLocationUpdater).toSelf().inSingletonScope();
72
+ bind(NavigationLocationSimilarity).toSelf().inSingletonScope();
73
+
74
+ bind(VariableContribution).to(EditorVariableContribution).inSingletonScope();
75
+
76
+ [CommandContribution, KeybindingContribution, MenuContribution].forEach(serviceIdentifier => {
77
+ bind(serviceIdentifier).toService(EditorContribution);
78
+ });
79
+ bind(QuickEditorService).toSelf().inSingletonScope();
80
+ bind(QuickAccessContribution).to(QuickEditorService);
81
+
82
+ bind(CurrentEditorAccess).toSelf().inSingletonScope();
83
+ bind(ActiveEditorAccess).toSelf().inSingletonScope();
84
+ bind(EditorAccess).to(CurrentEditorAccess).inSingletonScope().whenTargetNamed(EditorAccess.CURRENT);
85
+ bind(EditorAccess).to(ActiveEditorAccess).inSingletonScope().whenTargetNamed(EditorAccess.ACTIVE);
86
+
87
+ bind(UndoRedoService).toSelf().inSingletonScope();
88
+
89
+ bind(EditorLanguageQuickPickService).toSelf().inSingletonScope();
90
+ });