@theia/editor 1.34.3 → 1.34.4

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 (100) hide show
  1. package/LICENSE +641 -641
  2. package/README.md +30 -30
  3. package/lib/browser/decorations/editor-decoration-style.d.ts +8 -8
  4. package/lib/browser/decorations/editor-decoration-style.js +36 -36
  5. package/lib/browser/decorations/editor-decoration.d.ts +106 -106
  6. package/lib/browser/decorations/editor-decoration.js +37 -37
  7. package/lib/browser/decorations/editor-decorator.d.ts +6 -6
  8. package/lib/browser/decorations/editor-decorator.js +43 -43
  9. package/lib/browser/decorations/index.d.ts +3 -3
  10. package/lib/browser/decorations/index.js +30 -30
  11. package/lib/browser/diff-navigator.d.ts +10 -10
  12. package/lib/browser/diff-navigator.js +19 -19
  13. package/lib/browser/editor-command.d.ts +102 -102
  14. package/lib/browser/editor-command.js +426 -426
  15. package/lib/browser/editor-contribution.d.ts +26 -26
  16. package/lib/browser/editor-contribution.js +198 -198
  17. package/lib/browser/editor-frontend-module.d.ts +5 -5
  18. package/lib/browser/editor-frontend-module.js +74 -74
  19. package/lib/browser/editor-generated-preference-schema.d.ts +249 -249
  20. package/lib/browser/editor-generated-preference-schema.js +2316 -2316
  21. package/lib/browser/editor-keybinding-contexts.d.ts +35 -35
  22. package/lib/browser/editor-keybinding-contexts.js +98 -98
  23. package/lib/browser/editor-keybinding.d.ts +5 -5
  24. package/lib/browser/editor-keybinding.js +55 -55
  25. package/lib/browser/editor-manager.d.ts +113 -113
  26. package/lib/browser/editor-manager.js +412 -412
  27. package/lib/browser/editor-menu.d.ts +48 -48
  28. package/lib/browser/editor-menu.js +210 -210
  29. package/lib/browser/editor-navigation-contribution.d.ts +67 -67
  30. package/lib/browser/editor-navigation-contribution.js +331 -331
  31. package/lib/browser/editor-preferences.d.ts +40 -40
  32. package/lib/browser/editor-preferences.js +165 -165
  33. package/lib/browser/editor-variable-contribution.d.ts +8 -8
  34. package/lib/browser/editor-variable-contribution.js +64 -64
  35. package/lib/browser/editor-widget-factory.d.ts +17 -17
  36. package/lib/browser/editor-widget-factory.js +91 -91
  37. package/lib/browser/editor-widget.d.ts +20 -20
  38. package/lib/browser/editor-widget.js +87 -87
  39. package/lib/browser/editor.d.ts +293 -293
  40. package/lib/browser/editor.js +103 -103
  41. package/lib/browser/index.d.ts +10 -10
  42. package/lib/browser/index.js +37 -37
  43. package/lib/browser/language-status/editor-language-status-service.d.ts +77 -77
  44. package/lib/browser/language-status/editor-language-status-service.js +251 -251
  45. package/lib/browser/navigation/navigation-location-service.d.ts +103 -103
  46. package/lib/browser/navigation/navigation-location-service.js +281 -281
  47. package/lib/browser/navigation/navigation-location-service.spec.d.ts +1 -1
  48. package/lib/browser/navigation/navigation-location-service.spec.js +184 -184
  49. package/lib/browser/navigation/navigation-location-similarity.d.ts +15 -15
  50. package/lib/browser/navigation/navigation-location-similarity.js +62 -62
  51. package/lib/browser/navigation/navigation-location-similarity.spec.d.ts +1 -1
  52. package/lib/browser/navigation/navigation-location-similarity.spec.js +32 -32
  53. package/lib/browser/navigation/navigation-location-updater.d.ts +35 -35
  54. package/lib/browser/navigation/navigation-location-updater.js +210 -210
  55. package/lib/browser/navigation/navigation-location-updater.spec.d.ts +1 -1
  56. package/lib/browser/navigation/navigation-location-updater.spec.js +177 -177
  57. package/lib/browser/navigation/navigation-location.d.ts +191 -191
  58. package/lib/browser/navigation/navigation-location.js +300 -300
  59. package/lib/browser/navigation/test/mock-navigation-location-updater.d.ts +15 -15
  60. package/lib/browser/navigation/test/mock-navigation-location-updater.js +38 -38
  61. package/lib/browser/quick-editor-service.d.ts +16 -16
  62. package/lib/browser/quick-editor-service.js +109 -109
  63. package/lib/common/language-selector.d.ts +13 -13
  64. package/lib/common/language-selector.js +90 -90
  65. package/lib/package.spec.js +25 -25
  66. package/package.json +5 -5
  67. package/src/browser/decorations/editor-decoration-style.ts +41 -41
  68. package/src/browser/decorations/editor-decoration.ts +127 -127
  69. package/src/browser/decorations/editor-decorator.ts +36 -36
  70. package/src/browser/decorations/index.ts +19 -19
  71. package/src/browser/diff-navigator.ts +28 -28
  72. package/src/browser/editor-command.ts +414 -414
  73. package/src/browser/editor-contribution.ts +185 -185
  74. package/src/browser/editor-frontend-module.ts +85 -85
  75. package/src/browser/editor-generated-preference-schema.ts +2539 -2539
  76. package/src/browser/editor-keybinding-contexts.ts +87 -87
  77. package/src/browser/editor-keybinding.ts +55 -55
  78. package/src/browser/editor-manager.ts +429 -429
  79. package/src/browser/editor-menu.ts +224 -224
  80. package/src/browser/editor-navigation-contribution.ts +331 -331
  81. package/src/browser/editor-preferences.ts +220 -220
  82. package/src/browser/editor-variable-contribution.ts +54 -54
  83. package/src/browser/editor-widget-factory.ts +82 -82
  84. package/src/browser/editor-widget.ts +98 -98
  85. package/src/browser/editor.ts +358 -358
  86. package/src/browser/index.ts +26 -26
  87. package/src/browser/language-status/editor-language-status-service.ts +271 -271
  88. package/src/browser/language-status/editor-language-status.css +98 -98
  89. package/src/browser/navigation/navigation-location-service.spec.ts +245 -245
  90. package/src/browser/navigation/navigation-location-service.ts +284 -284
  91. package/src/browser/navigation/navigation-location-similarity.spec.ts +46 -46
  92. package/src/browser/navigation/navigation-location-similarity.ts +58 -58
  93. package/src/browser/navigation/navigation-location-updater.spec.ts +197 -197
  94. package/src/browser/navigation/navigation-location-updater.ts +220 -220
  95. package/src/browser/navigation/navigation-location.ts +418 -418
  96. package/src/browser/navigation/test/mock-navigation-location-updater.ts +41 -41
  97. package/src/browser/quick-editor-service.ts +94 -94
  98. package/src/browser/style/index.css +19 -19
  99. package/src/common/language-selector.ts +104 -104
  100. 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 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 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 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_contexts_1 = require("./editor-keybinding-contexts");
29
- const editor_keybinding_1 = require("./editor-keybinding");
30
- const editor_preferences_1 = require("./editor-preferences");
31
- const editor_widget_factory_1 = require("./editor-widget-factory");
32
- const editor_navigation_contribution_1 = require("./editor-navigation-contribution");
33
- const navigation_location_updater_1 = require("./navigation/navigation-location-updater");
34
- const navigation_location_service_1 = require("./navigation/navigation-location-service");
35
- const navigation_location_similarity_1 = require("./navigation/navigation-location-similarity");
36
- const editor_variable_contribution_1 = require("./editor-variable-contribution");
37
- const quick_access_1 = require("@theia/core/lib/browser/quick-input/quick-access");
38
- const quick_editor_service_1 = require("./quick-editor-service");
39
- const editor_language_status_service_1 = require("./language-status/editor-language-status-service");
40
- exports.default = new inversify_1.ContainerModule(bind => {
41
- (0, editor_preferences_1.bindEditorPreferences)(bind);
42
- bind(editor_widget_factory_1.EditorWidgetFactory).toSelf().inSingletonScope();
43
- bind(browser_1.WidgetFactory).toService(editor_widget_factory_1.EditorWidgetFactory);
44
- bind(editor_manager_1.EditorManager).toSelf().inSingletonScope();
45
- bind(browser_1.OpenHandler).toService(editor_manager_1.EditorManager);
46
- bind(editor_command_1.EditorCommandContribution).toSelf().inSingletonScope();
47
- bind(common_1.CommandContribution).toService(editor_command_1.EditorCommandContribution);
48
- bind(editor_menu_1.EditorMenuContribution).toSelf().inSingletonScope();
49
- bind(common_1.MenuContribution).toService(editor_menu_1.EditorMenuContribution);
50
- bind(editor_keybinding_contexts_1.StrictEditorTextFocusContext).toSelf().inSingletonScope();
51
- bind(browser_1.KeybindingContext).toService(editor_keybinding_contexts_1.StrictEditorTextFocusContext);
52
- bind(browser_1.KeybindingContext).to(editor_keybinding_contexts_1.EditorTextFocusContext).inSingletonScope();
53
- bind(browser_1.KeybindingContext).to(editor_keybinding_contexts_1.DiffEditorTextFocusContext).inSingletonScope();
54
- bind(editor_keybinding_1.EditorKeybindingContribution).toSelf().inSingletonScope();
55
- bind(browser_1.KeybindingContribution).toService(editor_keybinding_1.EditorKeybindingContribution);
56
- bind(editor_contribution_1.EditorContribution).toSelf().inSingletonScope();
57
- bind(browser_1.FrontendApplicationContribution).toService(editor_contribution_1.EditorContribution);
58
- bind(editor_language_status_service_1.EditorLanguageStatusService).toSelf().inSingletonScope();
59
- bind(editor_navigation_contribution_1.EditorNavigationContribution).toSelf().inSingletonScope();
60
- bind(browser_1.FrontendApplicationContribution).toService(editor_navigation_contribution_1.EditorNavigationContribution);
61
- bind(navigation_location_service_1.NavigationLocationService).toSelf().inSingletonScope();
62
- bind(navigation_location_updater_1.NavigationLocationUpdater).toSelf().inSingletonScope();
63
- bind(navigation_location_similarity_1.NavigationLocationSimilarity).toSelf().inSingletonScope();
64
- bind(browser_2.VariableContribution).to(editor_variable_contribution_1.EditorVariableContribution).inSingletonScope();
65
- [common_1.CommandContribution, browser_1.KeybindingContribution, common_1.MenuContribution].forEach(serviceIdentifier => {
66
- bind(serviceIdentifier).toService(editor_contribution_1.EditorContribution);
67
- });
68
- bind(quick_editor_service_1.QuickEditorService).toSelf().inSingletonScope();
69
- bind(quick_access_1.QuickAccessContribution).to(quick_editor_service_1.QuickEditorService);
70
- bind(editor_manager_1.CurrentEditorAccess).toSelf().inSingletonScope();
71
- bind(editor_manager_1.ActiveEditorAccess).toSelf().inSingletonScope();
72
- bind(editor_manager_1.EditorAccess).to(editor_manager_1.CurrentEditorAccess).inSingletonScope().whenTargetNamed(editor_manager_1.EditorAccess.CURRENT);
73
- bind(editor_manager_1.EditorAccess).to(editor_manager_1.ActiveEditorAccess).inSingletonScope().whenTargetNamed(editor_manager_1.EditorAccess.ACTIVE);
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 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_contexts_1 = require("./editor-keybinding-contexts");
29
+ const editor_keybinding_1 = require("./editor-keybinding");
30
+ const editor_preferences_1 = require("./editor-preferences");
31
+ const editor_widget_factory_1 = require("./editor-widget-factory");
32
+ const editor_navigation_contribution_1 = require("./editor-navigation-contribution");
33
+ const navigation_location_updater_1 = require("./navigation/navigation-location-updater");
34
+ const navigation_location_service_1 = require("./navigation/navigation-location-service");
35
+ const navigation_location_similarity_1 = require("./navigation/navigation-location-similarity");
36
+ const editor_variable_contribution_1 = require("./editor-variable-contribution");
37
+ const quick_access_1 = require("@theia/core/lib/browser/quick-input/quick-access");
38
+ const quick_editor_service_1 = require("./quick-editor-service");
39
+ const editor_language_status_service_1 = require("./language-status/editor-language-status-service");
40
+ exports.default = new inversify_1.ContainerModule(bind => {
41
+ (0, editor_preferences_1.bindEditorPreferences)(bind);
42
+ bind(editor_widget_factory_1.EditorWidgetFactory).toSelf().inSingletonScope();
43
+ bind(browser_1.WidgetFactory).toService(editor_widget_factory_1.EditorWidgetFactory);
44
+ bind(editor_manager_1.EditorManager).toSelf().inSingletonScope();
45
+ bind(browser_1.OpenHandler).toService(editor_manager_1.EditorManager);
46
+ bind(editor_command_1.EditorCommandContribution).toSelf().inSingletonScope();
47
+ bind(common_1.CommandContribution).toService(editor_command_1.EditorCommandContribution);
48
+ bind(editor_menu_1.EditorMenuContribution).toSelf().inSingletonScope();
49
+ bind(common_1.MenuContribution).toService(editor_menu_1.EditorMenuContribution);
50
+ bind(editor_keybinding_contexts_1.StrictEditorTextFocusContext).toSelf().inSingletonScope();
51
+ bind(browser_1.KeybindingContext).toService(editor_keybinding_contexts_1.StrictEditorTextFocusContext);
52
+ bind(browser_1.KeybindingContext).to(editor_keybinding_contexts_1.EditorTextFocusContext).inSingletonScope();
53
+ bind(browser_1.KeybindingContext).to(editor_keybinding_contexts_1.DiffEditorTextFocusContext).inSingletonScope();
54
+ bind(editor_keybinding_1.EditorKeybindingContribution).toSelf().inSingletonScope();
55
+ bind(browser_1.KeybindingContribution).toService(editor_keybinding_1.EditorKeybindingContribution);
56
+ bind(editor_contribution_1.EditorContribution).toSelf().inSingletonScope();
57
+ bind(browser_1.FrontendApplicationContribution).toService(editor_contribution_1.EditorContribution);
58
+ bind(editor_language_status_service_1.EditorLanguageStatusService).toSelf().inSingletonScope();
59
+ bind(editor_navigation_contribution_1.EditorNavigationContribution).toSelf().inSingletonScope();
60
+ bind(browser_1.FrontendApplicationContribution).toService(editor_navigation_contribution_1.EditorNavigationContribution);
61
+ bind(navigation_location_service_1.NavigationLocationService).toSelf().inSingletonScope();
62
+ bind(navigation_location_updater_1.NavigationLocationUpdater).toSelf().inSingletonScope();
63
+ bind(navigation_location_similarity_1.NavigationLocationSimilarity).toSelf().inSingletonScope();
64
+ bind(browser_2.VariableContribution).to(editor_variable_contribution_1.EditorVariableContribution).inSingletonScope();
65
+ [common_1.CommandContribution, browser_1.KeybindingContribution, common_1.MenuContribution].forEach(serviceIdentifier => {
66
+ bind(serviceIdentifier).toService(editor_contribution_1.EditorContribution);
67
+ });
68
+ bind(quick_editor_service_1.QuickEditorService).toSelf().inSingletonScope();
69
+ bind(quick_access_1.QuickAccessContribution).to(quick_editor_service_1.QuickEditorService);
70
+ bind(editor_manager_1.CurrentEditorAccess).toSelf().inSingletonScope();
71
+ bind(editor_manager_1.ActiveEditorAccess).toSelf().inSingletonScope();
72
+ bind(editor_manager_1.EditorAccess).to(editor_manager_1.CurrentEditorAccess).inSingletonScope().whenTargetNamed(editor_manager_1.EditorAccess.CURRENT);
73
+ bind(editor_manager_1.EditorAccess).to(editor_manager_1.ActiveEditorAccess).inSingletonScope().whenTargetNamed(editor_manager_1.EditorAccess.ACTIVE);
74
+ });
75
75
  //# sourceMappingURL=editor-frontend-module.js.map