@theia/monaco 1.18.0-next.d3501165 → 1.19.0
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/LICENSE +642 -0
- 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 +1 -0
- package/lib/browser/monaco-quick-input-service.d.ts.map +1 -1
- package/lib/browser/monaco-quick-input-service.js +24 -1
- package/lib/browser/monaco-quick-input-service.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 +14 -12
- 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 +16 -1
- package/src/browser/style/index.css +33 -1
- package/src/browser/workspace-symbol-command.ts +17 -8
|
@@ -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.localize('vscode/menubar/mSelection', '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.localize('vscode/gotoSymbolQuickAccess/gotoSymbol', '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.localize('vscode/gotoError/miGotoNextProblem', 'Next Problem'),
|
|
106
|
+
order: '1'
|
|
107
|
+
});
|
|
108
|
+
registry.registerMenuAction(MonacoMenus.MARKERS_GROUP, {
|
|
109
|
+
commandId: 'editor.action.marker.prevInFiles',
|
|
110
|
+
label: nls.localize('vscode/gotoError/miGotoPreviousProblem', '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.localize('vscode/goToCommands/peek.submenu', 'Peek'));
|
|
71
117
|
|
|
72
118
|
for (const item of MenuRegistry.getMenuItems(monaco.actions.MenuId.EditorContextPeek)) {
|
|
73
119
|
if (!monaco.actions.isIMenuItem(item)) {
|
|
@@ -182,8 +182,17 @@ export class MonacoQuickInputService implements QuickInputService {
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
input(options?: InputOptions, token?: CancellationToken): Promise<string | undefined> {
|
|
185
|
-
|
|
185
|
+
let inputOptions: monaco.quickInput.IInputOptions | undefined;
|
|
186
|
+
if (options) {
|
|
187
|
+
const { validateInput, ...props } = options;
|
|
188
|
+
inputOptions = { ...props };
|
|
189
|
+
if (validateInput) {
|
|
190
|
+
inputOptions.validateInput = async input => validateInput(input);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return this.monacoService.input(inputOptions, token);
|
|
186
194
|
}
|
|
195
|
+
|
|
187
196
|
pick<T extends QuickPickItem, O extends PickOptions<T>>(picks: T[] | Promise<T[]>, options?: O, token?: CancellationToken):
|
|
188
197
|
Promise<(O extends { canPickMany: true; } ? T[] : T) | undefined> {
|
|
189
198
|
return this.monacoService.pick(picks, options, token);
|
|
@@ -261,6 +270,12 @@ export class MonacoQuickInputService implements QuickInputService {
|
|
|
261
270
|
return item;
|
|
262
271
|
});
|
|
263
272
|
}
|
|
273
|
+
|
|
274
|
+
createQuickPick<T extends QuickPickItem>(): QuickPick<T> {
|
|
275
|
+
const quickPick = this.monacoService.createQuickPick<MonacoQuickPickItem<T>>();
|
|
276
|
+
return this.wrapQuickPick(quickPick);
|
|
277
|
+
}
|
|
278
|
+
|
|
264
279
|
wrapQuickPick<T extends QuickPickItem>(wrapped: monaco.quickInput.IQuickPick<MonacoQuickPickItem<T>>): QuickPick<T> {
|
|
265
280
|
return new MonacoQuickPick(wrapped, this.keybindingRegistry);
|
|
266
281
|
}
|
|
@@ -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;
|
|
@@ -140,7 +147,24 @@
|
|
|
140
147
|
}
|
|
141
148
|
|
|
142
149
|
.quick-input-list .monaco-list-row.focused {
|
|
143
|
-
background-color: var(--theia-
|
|
150
|
+
background-color: var(--theia-quickInputList-focusBackground) !important;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.quick-input-list .monaco-keybinding > .monaco-keybinding-key {
|
|
154
|
+
color: inherit !important;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.quick-input-list .monaco-list-row.focused,
|
|
158
|
+
.quick-input-list .monaco-list-row.focused .monaco-highlighted-label,
|
|
159
|
+
.quick-input-list .monaco-list-row.focused .monaco-highlighted-label .codicon,
|
|
160
|
+
.quick-input-list .monaco-list-row.focused .quick-input-list-entry .quick-input-list-separator,
|
|
161
|
+
.quick-input-list .monaco-list-row.focused .monaco-highlighted-label .monaco-keybinding .monaco-keybinding-key,
|
|
162
|
+
.quick-input-list .monaco-list-row.focused .monaco-highlighted-label .monaco-keybinding .monaco-keybinding-key-separator {
|
|
163
|
+
color: var(--theia-quickInputList-focusForeground) !important;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.quick-input-list .monaco-list-row.focused .monaco-highlighted-label .highlight {
|
|
167
|
+
color: var(--theia-list-focusHighlightForeground) !important;
|
|
144
168
|
}
|
|
145
169
|
|
|
146
170
|
.monaco-list-rows
|
|
@@ -204,3 +228,11 @@
|
|
|
204
228
|
.monaco-editor .find-widget .matchesCount {
|
|
205
229
|
font-family: var(--theia-ui-font-family);
|
|
206
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
|
+
}
|
|
@@ -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.toLocalizedCommand({
|
|
36
36
|
id: 'languages.workspace.symbol',
|
|
37
37
|
label: 'Go to Symbol in Workspace...'
|
|
38
|
-
};
|
|
38
|
+
}, 'vscode/search.contribution/showTriggerActions');
|
|
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.localize('vscode/search.contribution/symbolsQuickAccess', '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();
|