@theia/monaco 1.28.0-next.1 → 1.28.0-next.13
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/README.md +56 -0
- package/lib/browser/monaco-color-registry.d.ts.map +1 -1
- package/lib/browser/monaco-color-registry.js +3 -2
- package/lib/browser/monaco-color-registry.js.map +1 -1
- package/lib/browser/monaco-diff-editor.d.ts.map +1 -1
- package/lib/browser/monaco-diff-editor.js +4 -0
- package/lib/browser/monaco-diff-editor.js.map +1 -1
- package/lib/browser/monaco-editor.d.ts.map +1 -1
- package/lib/browser/monaco-editor.js +4 -1
- package/lib/browser/monaco-editor.js.map +1 -1
- package/lib/browser/monaco-frontend-application-contribution.d.ts.map +1 -1
- package/lib/browser/monaco-frontend-application-contribution.js +5 -2
- package/lib/browser/monaco-frontend-application-contribution.js.map +1 -1
- package/lib/browser/monaco-indexed-db.d.ts +1 -1
- package/lib/browser/monaco-indexed-db.d.ts.map +1 -1
- package/lib/browser/monaco-quick-input-service.js.map +1 -1
- package/lib/browser/monaco-text-model-service.d.ts.map +1 -1
- package/lib/browser/monaco-text-model-service.js +15 -17
- package/lib/browser/monaco-text-model-service.js.map +1 -1
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.d.ts +1 -1
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.d.ts.map +1 -1
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.js +38 -6
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.js.map +1 -1
- package/lib/browser/textmate/monaco-textmate-service.d.ts +3 -3
- package/lib/browser/textmate/monaco-textmate-service.d.ts.map +1 -1
- package/lib/browser/textmate/monaco-textmate-service.js +8 -30
- package/lib/browser/textmate/monaco-textmate-service.js.map +1 -1
- package/lib/browser/textmate/monaco-theme-registry.d.ts +2 -7
- package/lib/browser/textmate/monaco-theme-registry.d.ts.map +1 -1
- package/lib/browser/textmate/monaco-theme-registry.js +9 -3
- package/lib/browser/textmate/monaco-theme-registry.js.map +1 -1
- package/lib/browser/textmate/monaco-theme-types.d.ts +11 -0
- package/lib/browser/textmate/monaco-theme-types.d.ts.map +1 -1
- package/lib/browser/textmate/monaco-theme-types.js +3 -0
- package/lib/browser/textmate/monaco-theme-types.js.map +1 -1
- package/package.json +10 -10
- package/src/browser/monaco-color-registry.ts +2 -1
- package/src/browser/monaco-diff-editor.ts +4 -0
- package/src/browser/monaco-editor.ts +4 -1
- package/src/browser/monaco-frontend-application-contribution.ts +5 -2
- package/src/browser/monaco-indexed-db.ts +1 -1
- package/src/browser/monaco-quick-input-service.ts +1 -1
- package/src/browser/monaco-text-model-service.ts +15 -16
- package/src/browser/textmate/monaco-textmate-frontend-bindings.ts +36 -6
- package/src/browser/textmate/monaco-textmate-service.ts +6 -29
- package/src/browser/textmate/monaco-theme-registry.ts +7 -10
- package/src/browser/textmate/monaco-theme-types.ts +12 -0
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { injectable, inject, named } from '@theia/core/shared/inversify';
|
|
18
|
-
import { Registry
|
|
18
|
+
import { Registry } from 'vscode-textmate';
|
|
19
19
|
import { ILogger, ContributionProvider, DisposableCollection, Disposable } from '@theia/core';
|
|
20
20
|
import { FrontendApplicationContribution, isBasicWasmSupported } from '@theia/core/lib/browser';
|
|
21
21
|
import { ThemeService } from '@theia/core/lib/browser/theming';
|
|
@@ -31,9 +31,7 @@ import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/stan
|
|
|
31
31
|
import { ILanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/languages/language';
|
|
32
32
|
import { TokenizationSupportAdapter } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneLanguages';
|
|
33
33
|
import { LanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/languageService';
|
|
34
|
-
|
|
35
|
-
export const OnigasmPromise = Symbol('OnigasmPromise');
|
|
36
|
-
export type OnigasmPromise = Promise<IOnigLib>;
|
|
34
|
+
import { OnigasmPromise, TextmateRegistryFactory } from './monaco-theme-types';
|
|
37
35
|
|
|
38
36
|
@injectable()
|
|
39
37
|
export class MonacoTextmateService implements FrontendApplicationContribution {
|
|
@@ -67,6 +65,9 @@ export class MonacoTextmateService implements FrontendApplicationContribution {
|
|
|
67
65
|
@inject(EditorPreferences)
|
|
68
66
|
protected readonly preferences: EditorPreferences;
|
|
69
67
|
|
|
68
|
+
@inject(TextmateRegistryFactory)
|
|
69
|
+
protected readonly registryFactory: TextmateRegistryFactory;
|
|
70
|
+
|
|
70
71
|
initialize(): void {
|
|
71
72
|
if (!isBasicWasmSupported) {
|
|
72
73
|
console.log('Textmate support deactivated because WebAssembly is not detected.');
|
|
@@ -81,31 +82,7 @@ export class MonacoTextmateService implements FrontendApplicationContribution {
|
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
this.grammarRegistry =
|
|
85
|
-
getOnigLib: () => this.onigasmPromise,
|
|
86
|
-
theme: this.monacoThemeRegistry.getThemeData(this.currentEditorTheme),
|
|
87
|
-
loadGrammar: async (scopeName: string) => {
|
|
88
|
-
const provider = this.textmateRegistry.getProvider(scopeName);
|
|
89
|
-
if (provider) {
|
|
90
|
-
const definition = await provider.getGrammarDefinition();
|
|
91
|
-
let rawGrammar: IRawGrammar;
|
|
92
|
-
if (typeof definition.content === 'string') {
|
|
93
|
-
rawGrammar = parseRawGrammar(definition.content, definition.format === 'json' ? 'grammar.json' : 'grammar.plist');
|
|
94
|
-
} else {
|
|
95
|
-
rawGrammar = definition.content as IRawGrammar;
|
|
96
|
-
}
|
|
97
|
-
return rawGrammar;
|
|
98
|
-
}
|
|
99
|
-
return undefined;
|
|
100
|
-
},
|
|
101
|
-
getInjections: (scopeName: string) => {
|
|
102
|
-
const provider = this.textmateRegistry.getProvider(scopeName);
|
|
103
|
-
if (provider && provider.getInjections) {
|
|
104
|
-
return provider.getInjections(scopeName);
|
|
105
|
-
}
|
|
106
|
-
return [];
|
|
107
|
-
}
|
|
108
|
-
});
|
|
85
|
+
this.grammarRegistry = this.registryFactory(this.monacoThemeRegistry.getThemeData(this.currentEditorTheme));
|
|
109
86
|
|
|
110
87
|
this.tokenizerOption.lineLimit = this.preferences['editor.maxTokenizationLineLength'];
|
|
111
88
|
this.preferences.onPreferenceChanged(e => {
|
|
@@ -17,22 +17,20 @@
|
|
|
17
17
|
|
|
18
18
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
19
19
|
|
|
20
|
-
import { injectable } from '@theia/core/shared/inversify';
|
|
21
|
-
import {
|
|
20
|
+
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
21
|
+
import { IRawThemeSetting } from 'vscode-textmate';
|
|
22
22
|
import * as monaco from '@theia/monaco-editor-core';
|
|
23
|
-
import {
|
|
23
|
+
import { IStandaloneThemeService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
|
|
24
24
|
import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
25
25
|
import { StandaloneThemeService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneThemeService';
|
|
26
26
|
import { Color } from '@theia/monaco-editor-core/esm/vs/base/common/color';
|
|
27
|
-
|
|
28
|
-
export interface ThemeMix extends IRawTheme, monaco.editor.IStandaloneThemeData { }
|
|
29
|
-
export interface MixStandaloneTheme extends IStandaloneTheme {
|
|
30
|
-
themeData: ThemeMix
|
|
31
|
-
}
|
|
27
|
+
import { MixStandaloneTheme, TextmateRegistryFactory, ThemeMix } from './monaco-theme-types';
|
|
32
28
|
|
|
33
29
|
@injectable()
|
|
34
30
|
export class MonacoThemeRegistry {
|
|
35
31
|
|
|
32
|
+
@inject(TextmateRegistryFactory) protected readonly registryFactory: TextmateRegistryFactory;
|
|
33
|
+
|
|
36
34
|
initializeDefaultThemes(): void {
|
|
37
35
|
this.register(require('../../../data/monaco-themes/vscode/dark_theia.json'), {
|
|
38
36
|
'./dark_vs.json': require('../../../data/monaco-themes/vscode/dark_vs.json'),
|
|
@@ -129,8 +127,7 @@ export class MonacoThemeRegistry {
|
|
|
129
127
|
}
|
|
130
128
|
});
|
|
131
129
|
|
|
132
|
-
const reg =
|
|
133
|
-
reg.setTheme(result);
|
|
130
|
+
const reg = this.registryFactory(result);
|
|
134
131
|
result.encodedTokensColors = reg.getColorMap();
|
|
135
132
|
// index 0 has to be set to null as it is 'undefined' by default, but monaco code expects it to be null
|
|
136
133
|
// eslint-disable-next-line no-null/no-null
|
|
@@ -15,6 +15,18 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import * as monaco from '@theia/monaco-editor-core';
|
|
18
|
+
import { IStandaloneTheme } from '@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
|
|
19
|
+
import { IOnigLib, IRawTheme, Registry } from 'vscode-textmate';
|
|
20
|
+
|
|
21
|
+
export interface ThemeMix extends IRawTheme, monaco.editor.IStandaloneThemeData { }
|
|
22
|
+
export interface MixStandaloneTheme extends IStandaloneTheme {
|
|
23
|
+
themeData: ThemeMix
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const OnigasmPromise = Symbol('OnigasmPromise');
|
|
27
|
+
export type OnigasmPromise = Promise<IOnigLib>;
|
|
28
|
+
export const TextmateRegistryFactory = Symbol('TextmateRegistryFactory');
|
|
29
|
+
export type TextmateRegistryFactory = (currentTheme?: ThemeMix) => Registry;
|
|
18
30
|
|
|
19
31
|
export type MonacoThemeColor = monaco.editor.IColors;
|
|
20
32
|
export interface MonacoTokenRule extends monaco.editor.ITokenThemeRule { };
|