@theia/monaco 1.18.0 → 1.21.0-next.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/monaco-nls.json +1379 -0
- package/lib/browser/monaco-command.d.ts +11 -2
- package/lib/browser/monaco-command.d.ts.map +1 -1
- package/lib/browser/monaco-command.js +29 -17
- package/lib/browser/monaco-command.js.map +1 -1
- package/lib/browser/monaco-editor-model.d.ts +1 -2
- package/lib/browser/monaco-editor-model.d.ts.map +1 -1
- package/lib/browser/monaco-editor-model.js +1 -1
- package/lib/browser/monaco-editor-model.js.map +1 -1
- package/lib/browser/monaco-editor-provider.d.ts.map +1 -1
- package/lib/browser/monaco-editor-provider.js.map +1 -1
- package/lib/browser/monaco-frontend-module.js +1 -1
- package/lib/browser/monaco-frontend-module.js.map +1 -1
- package/lib/browser/monaco-languages.d.ts +2 -3
- package/lib/browser/monaco-languages.d.ts.map +1 -1
- package/lib/browser/monaco-languages.js.map +1 -1
- package/lib/browser/monaco-loader.d.ts.map +1 -1
- package/lib/browser/monaco-loader.js +30 -2
- package/lib/browser/monaco-loader.js.map +1 -1
- package/lib/browser/monaco-menu.d.ts +1 -0
- package/lib/browser/monaco-menu.d.ts.map +1 -1
- package/lib/browser/monaco-menu.js +45 -2
- package/lib/browser/monaco-menu.js.map +1 -1
- package/lib/browser/monaco-quick-input-service.d.ts.map +1 -1
- package/lib/browser/monaco-quick-input-service.js +5 -1
- package/lib/browser/monaco-quick-input-service.js.map +1 -1
- package/lib/browser/monaco-status-bar-contribution.d.ts.map +1 -1
- package/lib/browser/monaco-status-bar-contribution.js +5 -3
- package/lib/browser/monaco-status-bar-contribution.js.map +1 -1
- package/lib/browser/monaco-workspace.d.ts +1 -1
- package/lib/browser/monaco-workspace.d.ts.map +1 -1
- package/lib/browser/monaco-workspace.js +2 -2
- package/lib/browser/monaco-workspace.js.map +1 -1
- package/lib/browser/workspace-symbol-command.d.ts +3 -3
- package/lib/browser/workspace-symbol-command.d.ts.map +1 -1
- package/lib/browser/workspace-symbol-command.js +13 -4
- package/lib/browser/workspace-symbol-command.js.map +1 -1
- package/package.json +9 -9
- package/src/browser/monaco-command.ts +33 -19
- package/src/browser/monaco-editor-model.ts +1 -2
- package/src/browser/monaco-editor-provider.ts +1 -1
- package/src/browser/monaco-frontend-module.ts +1 -1
- package/src/browser/monaco-languages.ts +2 -4
- package/src/browser/monaco-loader.ts +31 -2
- package/src/browser/monaco-menu.ts +49 -3
- package/src/browser/monaco-quick-input-service.ts +11 -2
- package/src/browser/monaco-status-bar-contribution.ts +6 -4
- package/src/browser/monaco-workspace.ts +2 -2
- package/src/browser/style/index.css +22 -0
- package/src/browser/workspace-symbol-command.ts +17 -8
- package/src/typings/monaco/index.d.ts +8 -3
|
@@ -18,12 +18,13 @@ import { injectable, inject, optional } from '@theia/core/shared/inversify';
|
|
|
18
18
|
import { Position, Location } from '@theia/core/shared/vscode-languageserver-types';
|
|
19
19
|
import { CommandContribution, CommandRegistry, CommandHandler } from '@theia/core/lib/common/command';
|
|
20
20
|
import { CommonCommands, QuickInputService, ApplicationShell } from '@theia/core/lib/browser';
|
|
21
|
-
import { EditorCommands, EditorManager } from '@theia/editor/lib/browser';
|
|
21
|
+
import { EditorCommands, EditorManager, EditorWidget } from '@theia/editor/lib/browser';
|
|
22
22
|
import { MonacoEditor } from './monaco-editor';
|
|
23
23
|
import { MonacoCommandRegistry, MonacoEditorCommandHandler } from './monaco-command-registry';
|
|
24
24
|
import { MonacoEditorService } from './monaco-editor-service';
|
|
25
25
|
import { MonacoTextModelService } from './monaco-text-model-service';
|
|
26
26
|
import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter';
|
|
27
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
27
28
|
|
|
28
29
|
export namespace MonacoCommands {
|
|
29
30
|
|
|
@@ -191,6 +192,7 @@ export class MonacoEditorCommandHandlers implements CommandContribution {
|
|
|
191
192
|
this.monacoCommandRegistry.registerHandler(EditorCommands.CONFIG_EOL.id, this.newConfigEolHandler());
|
|
192
193
|
this.monacoCommandRegistry.registerHandler(EditorCommands.INDENT_USING_SPACES.id, this.newConfigTabSizeHandler(true));
|
|
193
194
|
this.monacoCommandRegistry.registerHandler(EditorCommands.INDENT_USING_TABS.id, this.newConfigTabSizeHandler(false));
|
|
195
|
+
this.monacoCommandRegistry.registerHandler(EditorCommands.REVERT_EDITOR.id, this.newRevertActiveEditorHandler());
|
|
194
196
|
this.monacoCommandRegistry.registerHandler(EditorCommands.REVERT_AND_CLOSE.id, this.newRevertAndCloseActiveEditorHandler());
|
|
195
197
|
}
|
|
196
198
|
|
|
@@ -214,11 +216,10 @@ export class MonacoEditorCommandHandlers implements CommandContribution {
|
|
|
214
216
|
}
|
|
215
217
|
protected configureIndentation(editor: MonacoEditor): void {
|
|
216
218
|
const items = [true, false].map(useSpaces => ({
|
|
217
|
-
label: `Indent Using ${useSpaces ? 'Spaces' : 'Tabs'}
|
|
219
|
+
label: nls.localize(`vscode/indentation/indentUsing${useSpaces ? 'Spaces' : 'Tabs'}`, `Indent Using ${useSpaces ? 'Spaces' : 'Tabs'}`),
|
|
218
220
|
execute: () => this.configureTabSize(editor, useSpaces)
|
|
219
|
-
})
|
|
220
|
-
);
|
|
221
|
-
this.quickInputService?.showQuickPick(items, { placeholder: 'Select Action' });
|
|
221
|
+
}));
|
|
222
|
+
this.quickInputService?.showQuickPick(items, { placeholder: nls.localizeByDefault('Select Action') });
|
|
222
223
|
}
|
|
223
224
|
|
|
224
225
|
protected newConfigEolHandler(): MonacoEditorCommandHandler {
|
|
@@ -234,7 +235,7 @@ export class MonacoEditorCommandHandlers implements CommandContribution {
|
|
|
234
235
|
execute: () => this.setEol(editor, lineEnding)
|
|
235
236
|
})
|
|
236
237
|
);
|
|
237
|
-
this.quickInputService?.showQuickPick(items, { placeholder: 'Select End of Line Sequence' });
|
|
238
|
+
this.quickInputService?.showQuickPick(items, { placeholder: nls.localizeByDefault('Select End of Line Sequence') });
|
|
238
239
|
}
|
|
239
240
|
|
|
240
241
|
protected setEol(editor: MonacoEditor, lineEnding: string): void {
|
|
@@ -260,7 +261,7 @@ export class MonacoEditorCommandHandlers implements CommandContribution {
|
|
|
260
261
|
const sizes = Array.from(Array(8), (_, x) => x + 1);
|
|
261
262
|
const tabSizeOptions = sizes.map(size =>
|
|
262
263
|
({
|
|
263
|
-
label: size === tabSize ?
|
|
264
|
+
label: size === tabSize ? size + ' ' + nls.localizeByDefault('Configured Tab Size') : size.toString(),
|
|
264
265
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
265
266
|
execute: () => model.updateOptions({
|
|
266
267
|
tabSize: size || tabSize,
|
|
@@ -268,27 +269,40 @@ export class MonacoEditorCommandHandlers implements CommandContribution {
|
|
|
268
269
|
})
|
|
269
270
|
})
|
|
270
271
|
);
|
|
271
|
-
this.quickInputService?.showQuickPick(tabSizeOptions, { placeholder: 'Select Tab Size for Current File' });
|
|
272
|
+
this.quickInputService?.showQuickPick(tabSizeOptions, { placeholder: nls.localizeByDefault('Select Tab Size for Current File') });
|
|
272
273
|
}
|
|
273
274
|
}
|
|
274
275
|
|
|
276
|
+
protected newRevertActiveEditorHandler(): MonacoEditorCommandHandler {
|
|
277
|
+
return {
|
|
278
|
+
execute: () => this.revertEditor(this.getActiveEditor().editor),
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
275
282
|
protected newRevertAndCloseActiveEditorHandler(): MonacoEditorCommandHandler {
|
|
276
283
|
return {
|
|
277
|
-
execute: async () => this.revertAndCloseActiveEditor()
|
|
284
|
+
execute: async () => this.revertAndCloseActiveEditor(this.getActiveEditor())
|
|
278
285
|
};
|
|
279
286
|
}
|
|
280
287
|
|
|
281
|
-
protected
|
|
282
|
-
const
|
|
288
|
+
protected getActiveEditor(): { widget?: EditorWidget, editor?: MonacoEditor } {
|
|
289
|
+
const widget = this.editorManager.currentEditor;
|
|
290
|
+
return { widget, editor: widget && MonacoEditor.getCurrent(this.editorManager) };
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
protected async revertEditor(editor?: MonacoEditor): Promise<void> {
|
|
283
294
|
if (editor) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
295
|
+
return editor.document.revert();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
protected async revertAndCloseActiveEditor(current: { widget?: EditorWidget, editor?: MonacoEditor }): Promise<void> {
|
|
300
|
+
if (current.editor && current.widget) {
|
|
301
|
+
try {
|
|
302
|
+
await this.revertEditor(current.editor);
|
|
303
|
+
current.widget.close();
|
|
304
|
+
} catch (error) {
|
|
305
|
+
await this.shell.closeWidget(current.widget.id, { save: false });
|
|
292
306
|
}
|
|
293
307
|
}
|
|
294
308
|
}
|
|
@@ -14,14 +14,13 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import { Position } from '@theia/core/shared/vscode-languageserver-types';
|
|
17
|
+
import { Position, Range } from '@theia/core/shared/vscode-languageserver-types';
|
|
18
18
|
import { TextDocumentSaveReason, TextDocumentContentChangeEvent } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
19
19
|
import { TextEditorDocument, EncodingMode, FindMatchesOptions, FindMatch, EditorPreferences, DEFAULT_WORD_SEPARATORS } from '@theia/editor/lib/browser';
|
|
20
20
|
import { DisposableCollection, Disposable } from '@theia/core/lib/common/disposable';
|
|
21
21
|
import { Emitter, Event } from '@theia/core/lib/common/event';
|
|
22
22
|
import { CancellationTokenSource, CancellationToken } from '@theia/core/lib/common/cancellation';
|
|
23
23
|
import { Resource, ResourceError, ResourceVersion } from '@theia/core/lib/common/resource';
|
|
24
|
-
import { Range } from '@theia/core/shared/vscode-languageserver-types';
|
|
25
24
|
import { Saveable, SaveOptions } from '@theia/core/lib/browser/saveable';
|
|
26
25
|
import { MonacoToProtocolConverter } from './monaco-to-protocol-converter';
|
|
27
26
|
import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter';
|
|
@@ -19,7 +19,7 @@ import URI from '@theia/core/lib/common/uri';
|
|
|
19
19
|
import { EditorPreferenceChange, EditorPreferences, TextEditor, DiffNavigator } from '@theia/editor/lib/browser';
|
|
20
20
|
import { DiffUris } from '@theia/core/lib/browser/diff-uris';
|
|
21
21
|
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
22
|
-
import { DisposableCollection, deepClone, Disposable
|
|
22
|
+
import { DisposableCollection, deepClone, Disposable } from '@theia/core/lib/common';
|
|
23
23
|
import { TextDocumentSaveReason } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
24
24
|
import { MonacoCommandServiceFactory } from './monaco-command-service';
|
|
25
25
|
import { MonacoContextMenuService } from './monaco-context-menu';
|
|
@@ -86,7 +86,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
|
86
86
|
bind(MonacoLanguages).toSelf().inSingletonScope();
|
|
87
87
|
rebind(LanguageService).toService(MonacoLanguages);
|
|
88
88
|
bind(WorkspaceSymbolCommand).toSelf().inSingletonScope();
|
|
89
|
-
for (const identifier of [CommandContribution, KeybindingContribution, QuickAccessContribution]) {
|
|
89
|
+
for (const identifier of [CommandContribution, KeybindingContribution, MenuContribution, QuickAccessContribution]) {
|
|
90
90
|
bind(identifier).toService(WorkspaceSymbolCommand);
|
|
91
91
|
}
|
|
92
92
|
|
|
@@ -14,16 +14,14 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import { Diagnostic } from '@theia/core/shared/vscode-languageserver-types';
|
|
17
|
+
import { Diagnostic, SymbolInformation } from '@theia/core/shared/vscode-languageserver-types';
|
|
18
18
|
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
19
19
|
import { ProblemManager } from '@theia/markers/lib/browser/problem/problem-manager';
|
|
20
20
|
import URI from '@theia/core/lib/common/uri';
|
|
21
|
-
import { Mutable } from '@theia/core/lib/common/types';
|
|
21
|
+
import { MaybePromise, Mutable } from '@theia/core/lib/common/types';
|
|
22
22
|
import { Disposable } from '@theia/core/lib/common/disposable';
|
|
23
|
-
import { MaybePromise } from '@theia/core/lib/common/types';
|
|
24
23
|
import { CancellationToken } from '@theia/core/lib/common/cancellation';
|
|
25
24
|
import { WorkspaceSymbolParams } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
26
|
-
import { SymbolInformation } from '@theia/core/shared/vscode-languageserver-types';
|
|
27
25
|
import { Language, LanguageService } from '@theia/core/lib/browser/language-service';
|
|
28
26
|
import { MonacoDiagnosticCollection } from './monaco-diagnostic-collection';
|
|
29
27
|
import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter';
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
18
|
|
|
19
|
-
import { nls } from '@theia/core/lib/
|
|
19
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
20
20
|
|
|
21
21
|
export function loadVsRequire(context: any): Promise<any> {
|
|
22
22
|
// Monaco uses a custom amd loader that over-rides node's require.
|
|
@@ -48,11 +48,15 @@ export function loadVsRequire(context: any): Promise<any> {
|
|
|
48
48
|
|
|
49
49
|
export function loadMonaco(vsRequire: any): Promise<void> {
|
|
50
50
|
return new Promise<void>(resolve => {
|
|
51
|
-
if (nls.locale
|
|
51
|
+
if (nls.locale) {
|
|
52
52
|
vsRequire.config({
|
|
53
53
|
'vs/nls': {
|
|
54
54
|
availableLanguages: {
|
|
55
55
|
'*': nls.locale
|
|
56
|
+
},
|
|
57
|
+
loadBundle: (_name: string, _language: string, callback: (err: unknown, messages: Record<string, string[]>) => void) => {
|
|
58
|
+
// The `monaco-nls.json` is build using the `translate-monaco.js` script file
|
|
59
|
+
callback(undefined, createMessageBundle(require('../../data/monaco-nls.json')));
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
62
|
});
|
|
@@ -162,3 +166,28 @@ export function clearMonacoQuickAccessProviders(): void {
|
|
|
162
166
|
// Clear Monaco QuickAccessRegistry as it currently includes monaco internal providers and not Theia's providers
|
|
163
167
|
registry.clear();
|
|
164
168
|
}
|
|
169
|
+
|
|
170
|
+
function createMessageBundle(bundle: Record<string, Record<string, string>>): Record<string, string[]> {
|
|
171
|
+
const result: Record<string, string[]> = {};
|
|
172
|
+
for (const [fullName, items] of Object.entries(bundle)) {
|
|
173
|
+
const nameIndex = fullName.lastIndexOf('/');
|
|
174
|
+
let name = fullName;
|
|
175
|
+
if (nameIndex >= 0) {
|
|
176
|
+
name = fullName.substring(nameIndex + 1);
|
|
177
|
+
}
|
|
178
|
+
const array: string[] = [];
|
|
179
|
+
const keys = Object.keys(items);
|
|
180
|
+
for (let i = 0; i < keys.length; i++) {
|
|
181
|
+
let key = keys[i];
|
|
182
|
+
if (key.startsWith('_duplicate/')) {
|
|
183
|
+
const index = Number(key.substring('_duplicate/'.length));
|
|
184
|
+
key = keys[index];
|
|
185
|
+
keys[i] = key;
|
|
186
|
+
}
|
|
187
|
+
const fullItemName = `vscode/${name}/${key}`;
|
|
188
|
+
array.push(nls.localize(fullItemName, items[key]));
|
|
189
|
+
}
|
|
190
|
+
result[fullName] = array;
|
|
191
|
+
}
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
18
18
|
import { MenuContribution, MenuModelRegistry, MAIN_MENU_BAR, MenuPath } from '@theia/core/lib/common';
|
|
19
|
-
import { EDITOR_CONTEXT_MENU } from '@theia/editor/lib/browser';
|
|
19
|
+
import { EditorMainMenu, EDITOR_CONTEXT_MENU } from '@theia/editor/lib/browser';
|
|
20
20
|
import { MonacoCommandRegistry } from './monaco-command-registry';
|
|
21
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
21
22
|
import MenuRegistry = monaco.actions.MenuRegistry;
|
|
22
23
|
|
|
23
24
|
export interface MonacoActionGroup {
|
|
@@ -27,6 +28,7 @@ export interface MonacoActionGroup {
|
|
|
27
28
|
export namespace MonacoMenus {
|
|
28
29
|
export const SELECTION = [...MAIN_MENU_BAR, '3_selection'];
|
|
29
30
|
export const PEEK_CONTEXT_SUBMENU: MenuPath = [...EDITOR_CONTEXT_MENU, 'navigation', 'peek_submenu'];
|
|
31
|
+
export const MARKERS_GROUP = [...EditorMainMenu.GO, '5_markers_group'];
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
@injectable()
|
|
@@ -50,7 +52,7 @@ export class MonacoEditorMenuContribution implements MenuContribution {
|
|
|
50
52
|
|
|
51
53
|
this.registerPeekSubmenu(registry);
|
|
52
54
|
|
|
53
|
-
registry.registerSubmenu(MonacoMenus.SELECTION, 'Selection');
|
|
55
|
+
registry.registerSubmenu(MonacoMenus.SELECTION, nls.localizeByDefault('Selection'));
|
|
54
56
|
for (const item of MenuRegistry.getMenuItems(monaco.actions.MenuId.MenubarSelectionMenu)) {
|
|
55
57
|
if (!monaco.actions.isIMenuItem(item)) {
|
|
56
58
|
continue;
|
|
@@ -64,10 +66,54 @@ export class MonacoEditorMenuContribution implements MenuContribution {
|
|
|
64
66
|
registry.registerMenuAction(menuPath, { commandId, order, label });
|
|
65
67
|
}
|
|
66
68
|
}
|
|
69
|
+
|
|
70
|
+
// Builtin monaco language features commands.
|
|
71
|
+
registry.registerMenuAction(EditorMainMenu.LANGUAGE_FEATURES_GROUP, {
|
|
72
|
+
commandId: 'editor.action.quickOutline',
|
|
73
|
+
label: nls.localizeByDefault('Go to Symbol in Editor...'),
|
|
74
|
+
order: '1'
|
|
75
|
+
});
|
|
76
|
+
registry.registerMenuAction(EditorMainMenu.LANGUAGE_FEATURES_GROUP, {
|
|
77
|
+
commandId: 'editor.action.revealDefinition',
|
|
78
|
+
order: '2'
|
|
79
|
+
});
|
|
80
|
+
registry.registerMenuAction(EditorMainMenu.LANGUAGE_FEATURES_GROUP, {
|
|
81
|
+
commandId: 'editor.action.revealDeclaration',
|
|
82
|
+
order: '3'
|
|
83
|
+
});
|
|
84
|
+
registry.registerMenuAction(EditorMainMenu.LANGUAGE_FEATURES_GROUP, {
|
|
85
|
+
commandId: 'editor.action.goToTypeDefinition',
|
|
86
|
+
order: '4'
|
|
87
|
+
});
|
|
88
|
+
registry.registerMenuAction(EditorMainMenu.LANGUAGE_FEATURES_GROUP, {
|
|
89
|
+
commandId: 'editor.action.goToImplementation',
|
|
90
|
+
order: '5'
|
|
91
|
+
});
|
|
92
|
+
registry.registerMenuAction(EditorMainMenu.LANGUAGE_FEATURES_GROUP, {
|
|
93
|
+
commandId: 'editor.action.goToReferences',
|
|
94
|
+
order: '6'
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
registry.registerMenuAction(EditorMainMenu.LOCATION_GROUP, {
|
|
98
|
+
commandId: 'editor.action.jumpToBracket',
|
|
99
|
+
order: '2'
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Builtin monaco problem commands.
|
|
103
|
+
registry.registerMenuAction(MonacoMenus.MARKERS_GROUP, {
|
|
104
|
+
commandId: 'editor.action.marker.nextInFiles',
|
|
105
|
+
label: nls.localizeByDefault('Next Problem'),
|
|
106
|
+
order: '1'
|
|
107
|
+
});
|
|
108
|
+
registry.registerMenuAction(MonacoMenus.MARKERS_GROUP, {
|
|
109
|
+
commandId: 'editor.action.marker.prevInFiles',
|
|
110
|
+
label: nls.localizeByDefault('Previous Problem'),
|
|
111
|
+
order: '2'
|
|
112
|
+
});
|
|
67
113
|
}
|
|
68
114
|
|
|
69
115
|
protected registerPeekSubmenu(registry: MenuModelRegistry): void {
|
|
70
|
-
registry.registerSubmenu(MonacoMenus.PEEK_CONTEXT_SUBMENU, 'Peek');
|
|
116
|
+
registry.registerSubmenu(MonacoMenus.PEEK_CONTEXT_SUBMENU, nls.localizeByDefault('Peek'));
|
|
71
117
|
|
|
72
118
|
for (const item of MenuRegistry.getMenuItems(monaco.actions.MenuId.EditorContextPeek)) {
|
|
73
119
|
if (!monaco.actions.isIMenuItem(item)) {
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
import {
|
|
19
19
|
InputBox, InputOptions, KeybindingRegistry, PickOptions,
|
|
20
|
-
QuickInputButton, QuickInputService, QuickPick, QuickPickItem,
|
|
20
|
+
QuickInputButton, QuickInputService, QuickPick, QuickPickItem,
|
|
21
|
+
QuickPickItemButtonEvent, QuickPickItemHighlights, QuickPickOptions, QuickPickSeparator
|
|
21
22
|
} from '@theia/core/lib/browser';
|
|
22
23
|
import { CancellationToken, Event } from '@theia/core/lib/common';
|
|
23
24
|
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
@@ -251,7 +252,15 @@ export class MonacoQuickInputService implements QuickInputService {
|
|
|
251
252
|
});
|
|
252
253
|
wrapped.onDidTriggerItemButton((evt: QuickPickItemButtonEvent<T>) => {
|
|
253
254
|
if (options.onDidTriggerItemButton) {
|
|
254
|
-
|
|
255
|
+
// https://github.com/theia-ide/vscode/blob/standalone/0.23.x/src/vs/base/parts/quickinput/browser/quickInput.ts#L1387
|
|
256
|
+
options.onDidTriggerItemButton(
|
|
257
|
+
{
|
|
258
|
+
...evt,
|
|
259
|
+
removeItem: () => {
|
|
260
|
+
wrapped.items = wrapped.items.filter(item => item !== evt.item);
|
|
261
|
+
wrapped.activeItems = wrapped.activeItems.filter(item => item !== evt.item);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
255
264
|
}
|
|
256
265
|
});
|
|
257
266
|
wrapped.onDidChangeSelection((selectedItems: Array<T>) => {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
17
|
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
18
|
-
import { DisposableCollection } from '@theia/core';
|
|
18
|
+
import { DisposableCollection, nls } from '@theia/core';
|
|
19
19
|
import { FrontendApplicationContribution, FrontendApplication, StatusBar, StatusBarAlignment } from '@theia/core/lib/browser';
|
|
20
20
|
import { EditorCommands, EditorManager, EditorWidget } from '@theia/editor/lib/browser';
|
|
21
21
|
import { MonacoEditor } from './monaco-editor';
|
|
@@ -66,13 +66,15 @@ export class MonacoStatusBarContribution implements FrontendApplicationContribut
|
|
|
66
66
|
if (editor && editorModel) {
|
|
67
67
|
const modelOptions = editorModel.getOptions();
|
|
68
68
|
const tabSize = modelOptions.tabSize;
|
|
69
|
-
const useSpaceOrTab = modelOptions.insertSpaces
|
|
69
|
+
const useSpaceOrTab = modelOptions.insertSpaces
|
|
70
|
+
? nls.localizeByDefault('Spaces: {0}', tabSize)
|
|
71
|
+
: nls.localizeByDefault('Tab Size: {0}', tabSize);
|
|
70
72
|
this.statusBar.setElement('editor-status-tabbing-config', {
|
|
71
73
|
text: `${useSpaceOrTab}: ${tabSize}`,
|
|
72
74
|
alignment: StatusBarAlignment.RIGHT,
|
|
73
75
|
priority: 10,
|
|
74
76
|
command: EditorCommands.CONFIG_INDENTATION.id,
|
|
75
|
-
tooltip: 'Select Indentation'
|
|
77
|
+
tooltip: nls.localizeByDefault('Select Indentation')
|
|
76
78
|
});
|
|
77
79
|
}
|
|
78
80
|
}
|
|
@@ -91,7 +93,7 @@ export class MonacoStatusBarContribution implements FrontendApplicationContribut
|
|
|
91
93
|
alignment: StatusBarAlignment.RIGHT,
|
|
92
94
|
priority: 11,
|
|
93
95
|
command: EditorCommands.CONFIG_EOL.id,
|
|
94
|
-
tooltip: 'Select End
|
|
96
|
+
tooltip: nls.localizeByDefault('Select End of Line Sequence')
|
|
95
97
|
});
|
|
96
98
|
}
|
|
97
99
|
}
|
|
@@ -205,14 +205,14 @@ export class MonacoWorkspace {
|
|
|
205
205
|
* Applies given edits to the given model.
|
|
206
206
|
* The model is saved if no editors is opened for it.
|
|
207
207
|
*/
|
|
208
|
-
applyBackgroundEdit(model: MonacoEditorModel, editOperations: monaco.editor.IIdentifiedSingleEditOperation[]): Promise<void> {
|
|
208
|
+
applyBackgroundEdit(model: MonacoEditorModel, editOperations: monaco.editor.IIdentifiedSingleEditOperation[], shouldSave = true): Promise<void> {
|
|
209
209
|
return this.suppressOpenIfDirty(model, async () => {
|
|
210
210
|
const editor = MonacoEditor.findByDocument(this.editorManager, model)[0];
|
|
211
211
|
const cursorState = editor && editor.getControl().getSelections() || [];
|
|
212
212
|
model.textEditorModel.pushStackElement();
|
|
213
213
|
model.textEditorModel.pushEditOperations(cursorState, editOperations, () => cursorState);
|
|
214
214
|
model.textEditorModel.pushStackElement();
|
|
215
|
-
if (!editor) {
|
|
215
|
+
if (!editor && shouldSave) {
|
|
216
216
|
await model.save();
|
|
217
217
|
}
|
|
218
218
|
});
|
|
@@ -99,6 +99,13 @@
|
|
|
99
99
|
font-family: sans-serif;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
.monaco-editor .monaco-list .monaco-list-row.focused,
|
|
103
|
+
.monaco-editor .monaco-list .monaco-list-row.focused,
|
|
104
|
+
.monaco-editor .monaco-list .monaco-list-row.focused .suggest-icon {
|
|
105
|
+
color: var(--theia-list-activeSelectionForeground) !important;
|
|
106
|
+
background-color: var(--theia-list-activeSelectionBackground) !important;
|
|
107
|
+
}
|
|
108
|
+
|
|
102
109
|
/* Monaco Quick Input */
|
|
103
110
|
.quick-input-widget {
|
|
104
111
|
width: 600px !important;
|
|
@@ -221,3 +228,18 @@
|
|
|
221
228
|
.monaco-editor .find-widget .matchesCount {
|
|
222
229
|
font-family: var(--theia-ui-font-family);
|
|
223
230
|
}
|
|
231
|
+
|
|
232
|
+
.monaco-editor .monaco-action-bar .action-label.codicon {
|
|
233
|
+
color: var(--theia-foreground);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.monaco-editor .monaco-action-bar .action-item.active {
|
|
237
|
+
transform: none;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.monaco-editor .peekview-widget .monaco-list-row.focused.selected .label-name,
|
|
241
|
+
.monaco-editor .peekview-widget .monaco-list-row.focused.selected .label-description,
|
|
242
|
+
.monaco-editor .peekview-widget .monaco-list-row.focused.selected .monaco-highlighted-label,
|
|
243
|
+
.monaco-editor .peekview-widget .monaco-list-row.focused.selected .codicon {
|
|
244
|
+
color: var(--theia-list-activeSelectionForeground) !important;
|
|
245
|
+
}
|
|
@@ -17,25 +17,25 @@
|
|
|
17
17
|
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
18
18
|
import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
|
|
19
19
|
import { KeybindingContribution, KeybindingRegistry, OpenerService, LabelProvider } from '@theia/core/lib/browser';
|
|
20
|
-
|
|
21
20
|
import { QuickAccessContribution, QuickAccessProvider, QuickInputService, QuickAccessRegistry, QuickPicks, QuickPickItem, findMatches } from '@theia/core/lib/browser/quick-input';
|
|
22
21
|
import {
|
|
23
|
-
CommandRegistry, CommandHandler, Command, SelectionService, CancellationToken
|
|
22
|
+
CommandRegistry, CommandHandler, Command, SelectionService, CancellationToken,
|
|
23
|
+
CommandContribution, MenuContribution, MenuModelRegistry, nls
|
|
24
24
|
} from '@theia/core/lib/common';
|
|
25
|
-
import { CommandContribution } from '@theia/core/lib/common';
|
|
26
25
|
import { Range, Position, SymbolInformation } from '@theia/core/shared/vscode-languageserver-types';
|
|
27
26
|
import { WorkspaceSymbolParams } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
28
27
|
import { MonacoLanguages, WorkspaceSymbolProvider } from './monaco-languages';
|
|
29
28
|
import URI from '@theia/core/lib/common/uri';
|
|
29
|
+
import { EditorMainMenu } from '@theia/editor/lib/browser';
|
|
30
30
|
|
|
31
31
|
@injectable()
|
|
32
|
-
export class WorkspaceSymbolCommand implements QuickAccessProvider, CommandContribution, KeybindingContribution, CommandHandler, QuickAccessContribution {
|
|
32
|
+
export class WorkspaceSymbolCommand implements QuickAccessProvider, CommandContribution, KeybindingContribution, MenuContribution, CommandHandler, QuickAccessContribution {
|
|
33
33
|
public static readonly PREFIX = '#';
|
|
34
34
|
|
|
35
|
-
private command
|
|
35
|
+
private command = Command.toDefaultLocalizedCommand({
|
|
36
36
|
id: 'languages.workspace.symbol',
|
|
37
37
|
label: 'Go to Symbol in Workspace...'
|
|
38
|
-
};
|
|
38
|
+
});
|
|
39
39
|
|
|
40
40
|
@inject(MonacoLanguages) protected readonly languages: MonacoLanguages;
|
|
41
41
|
@inject(OpenerService) protected readonly openerService: OpenerService;
|
|
@@ -56,6 +56,13 @@ export class WorkspaceSymbolCommand implements QuickAccessProvider, CommandContr
|
|
|
56
56
|
commands.registerCommand(this.command, this);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
registerMenus(menus: MenuModelRegistry): void {
|
|
60
|
+
menus.registerMenuAction(EditorMainMenu.WORKSPACE_GROUP, {
|
|
61
|
+
commandId: this.command.id,
|
|
62
|
+
order: '2'
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
59
66
|
private isElectron(): boolean {
|
|
60
67
|
return environment.electron.is();
|
|
61
68
|
}
|
|
@@ -72,7 +79,7 @@ export class WorkspaceSymbolCommand implements QuickAccessProvider, CommandContr
|
|
|
72
79
|
getInstance: () => this,
|
|
73
80
|
prefix: WorkspaceSymbolCommand.PREFIX,
|
|
74
81
|
placeholder: '',
|
|
75
|
-
helpEntries: [{ description: 'Go to Symbol in Workspace', needsEditor: false }]
|
|
82
|
+
helpEntries: [{ description: nls.localizeByDefault('Go to Symbol in Workspace'), needsEditor: false }]
|
|
76
83
|
});
|
|
77
84
|
}
|
|
78
85
|
|
|
@@ -100,7 +107,9 @@ export class WorkspaceSymbolCommand implements QuickAccessProvider, CommandContr
|
|
|
100
107
|
const filteredSymbols = symbols.filter(el => el && el.length !== 0);
|
|
101
108
|
if (filteredSymbols.length === 0) {
|
|
102
109
|
items.push({
|
|
103
|
-
label: filter.length === 0
|
|
110
|
+
label: filter.length === 0
|
|
111
|
+
? nls.localize('theia/monaco/typeToSearchForSymbols', 'Type to search for symbols')
|
|
112
|
+
: nls.localize('theia/monaco/noSymbolsMatching', 'No symbols matching'),
|
|
104
113
|
});
|
|
105
114
|
}
|
|
106
115
|
}).catch();
|
|
@@ -904,7 +904,7 @@ declare module monaco.services {
|
|
|
904
904
|
removeDecorationType: monaco.editor.ICodeEditorService['removeDecorationType'];
|
|
905
905
|
resolveDecorationOptions: monaco.editor.ICodeEditorService['resolveDecorationOptions'];
|
|
906
906
|
/**
|
|
907
|
-
* It respects inline and
|
|
907
|
+
* It respects inline and embedded editors in comparison to `getActiveCodeEditor`
|
|
908
908
|
* which only respect standalone and diff modified editors.
|
|
909
909
|
*/
|
|
910
910
|
getFocusedCodeEditor(): monaco.editor.ICodeEditor | undefined;
|
|
@@ -997,7 +997,7 @@ declare module monaco.services {
|
|
|
997
997
|
private readonly _instantiatedModes: { [modeId: string]: IMode; };
|
|
998
998
|
private readonly _onLanguagesMaybeChanged: Emitter<void>;
|
|
999
999
|
readonly onDidCreateMode: monaco.IEvent<IMode>;
|
|
1000
|
-
createByFilepathOrFirstLine(
|
|
1000
|
+
createByFilepathOrFirstLine(resource: monaco.Uri | null, firstLine?: string): ILanguageSelection;
|
|
1001
1001
|
getLanguageIdentifier(modeId: string | LanguageId): LanguageIdentifier | null;
|
|
1002
1002
|
}
|
|
1003
1003
|
|
|
@@ -1917,6 +1917,11 @@ declare module monaco.quickInput {
|
|
|
1917
1917
|
button: IQuickInputButton;
|
|
1918
1918
|
item: T;
|
|
1919
1919
|
}
|
|
1920
|
+
|
|
1921
|
+
// https://github.com/theia-ide/vscode/blob/standalone/0.23.x/src/vs/base/parts/quickinput/common/quickInput.ts#L324
|
|
1922
|
+
export interface IQuickPickItemButtonContext<T extends IQuickPickItem> extends IQuickPickItemButtonEvent<T> {
|
|
1923
|
+
removeItem(): void;
|
|
1924
|
+
}
|
|
1920
1925
|
}
|
|
1921
1926
|
|
|
1922
1927
|
declare module monaco.quickOpen {
|
|
@@ -2346,7 +2351,7 @@ declare module monaco.list {
|
|
|
2346
2351
|
private user: string,
|
|
2347
2352
|
container: HTMLElement,
|
|
2348
2353
|
virtualDelegate: IListVirtualDelegate<T>,
|
|
2349
|
-
renderers: IListRenderer<any
|
|
2354
|
+
renderers: IListRenderer<any, any>[],
|
|
2350
2355
|
private _options: IListOptions<T> = DefaultOptions
|
|
2351
2356
|
)
|
|
2352
2357
|
|