@theia/editor 1.45.1 → 1.46.0-next.72

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