@theia/monaco 1.28.0-next.9 → 1.29.0-next.10
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 +4 -3
- package/lib/browser/monaco-color-registry.js.map +1 -1
- package/lib/browser/monaco-command.js +3 -3
- package/lib/browser/monaco-command.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 +15 -2
- package/lib/browser/monaco-frontend-application-contribution.js.map +1 -1
- package/lib/browser/monaco-indexed-db.d.ts +4 -1
- package/lib/browser/monaco-indexed-db.d.ts.map +1 -1
- package/lib/browser/monaco-indexed-db.js +18 -8
- package/lib/browser/monaco-indexed-db.js.map +1 -1
- package/lib/browser/monaco-quick-input-service.d.ts.map +1 -1
- package/lib/browser/monaco-quick-input-service.js +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/monaco-theming-service.d.ts +2 -3
- package/lib/browser/monaco-theming-service.d.ts.map +1 -1
- package/lib/browser/monaco-theming-service.js +3 -3
- package/lib/browser/monaco-theming-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/lib/browser/textmate/textmate-tokenizer.d.ts +0 -8
- package/lib/browser/textmate/textmate-tokenizer.d.ts.map +1 -1
- package/lib/browser/textmate/textmate-tokenizer.js +7 -20
- package/lib/browser/textmate/textmate-tokenizer.js.map +1 -1
- package/package.json +11 -11
- package/src/browser/monaco-color-registry.ts +3 -2
- package/src/browser/monaco-command.ts +3 -3
- 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 +16 -2
- package/src/browser/monaco-indexed-db.ts +16 -9
- package/src/browser/monaco-quick-input-service.ts +2 -3
- package/src/browser/monaco-text-model-service.ts +15 -16
- package/src/browser/monaco-theming-service.ts +3 -3
- 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
- package/src/browser/textmate/textmate-tokenizer.ts +6 -19
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import * as monaco from '@theia/monaco-editor-core';
|
|
2
|
+
import { IStandaloneTheme } from '@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
|
|
3
|
+
import { IOnigLib, IRawTheme, Registry } from 'vscode-textmate';
|
|
4
|
+
export interface ThemeMix extends IRawTheme, monaco.editor.IStandaloneThemeData {
|
|
5
|
+
}
|
|
6
|
+
export interface MixStandaloneTheme extends IStandaloneTheme {
|
|
7
|
+
themeData: ThemeMix;
|
|
8
|
+
}
|
|
9
|
+
export declare const OnigasmPromise: unique symbol;
|
|
10
|
+
export declare type OnigasmPromise = Promise<IOnigLib>;
|
|
11
|
+
export declare const TextmateRegistryFactory: unique symbol;
|
|
12
|
+
export declare type TextmateRegistryFactory = (currentTheme?: ThemeMix) => Registry;
|
|
2
13
|
export declare type MonacoThemeColor = monaco.editor.IColors;
|
|
3
14
|
export interface MonacoTokenRule extends monaco.editor.ITokenThemeRule {
|
|
4
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monaco-theme-types.d.ts","sourceRoot":"","sources":["../../../src/browser/textmate/monaco-theme-types.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"monaco-theme-types.d.ts","sourceRoot":"","sources":["../../../src/browser/textmate/monaco-theme-types.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2EAA2E,CAAC;AAC7G,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhE,MAAM,WAAW,QAAS,SAAQ,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,oBAAoB;CAAI;AACnF,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IACxD,SAAS,EAAE,QAAQ,CAAA;CACtB;AAED,eAAO,MAAM,cAAc,eAA2B,CAAC;AACvD,oBAAY,cAAc,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC/C,eAAO,MAAM,uBAAuB,eAAoC,CAAC;AACzE,oBAAY,uBAAuB,GAAG,CAAC,YAAY,CAAC,EAAE,QAAQ,KAAK,QAAQ,CAAC;AAE5E,oBAAY,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;AACrD,MAAM,WAAW,eAAgB,SAAQ,MAAM,CAAC,MAAM,CAAC,eAAe;CAAI;AAC1E,oBAAY,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;AAC5D,MAAM,WAAW,WAAY,SAAQ,MAAM,CAAC,MAAM,CAAC,oBAAoB;IACnE,IAAI,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -15,5 +15,8 @@
|
|
|
15
15
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
16
|
// *****************************************************************************
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.TextmateRegistryFactory = exports.OnigasmPromise = void 0;
|
|
19
|
+
exports.OnigasmPromise = Symbol('OnigasmPromise');
|
|
20
|
+
exports.TextmateRegistryFactory = Symbol('TextmateRegistryFactory');
|
|
18
21
|
;
|
|
19
22
|
//# sourceMappingURL=monaco-theme-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monaco-theme-types.js","sourceRoot":"","sources":["../../../src/browser/textmate/monaco-theme-types.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF
|
|
1
|
+
{"version":3,"file":"monaco-theme-types.js","sourceRoot":"","sources":["../../../src/browser/textmate/monaco-theme-types.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;;;AAWnE,QAAA,cAAc,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAE1C,QAAA,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAIC,CAAC"}
|
|
@@ -19,13 +19,5 @@ export interface TokenizerOption {
|
|
|
19
19
|
*/
|
|
20
20
|
lineLimit?: number;
|
|
21
21
|
}
|
|
22
|
-
export declare namespace TokenizerOption {
|
|
23
|
-
/**
|
|
24
|
-
* The default TextMate tokenizer option.
|
|
25
|
-
*
|
|
26
|
-
* @deprecated Use the current value of `editor.maxTokenizationLineLength` preference instead.
|
|
27
|
-
*/
|
|
28
|
-
const DEFAULT: TokenizerOption;
|
|
29
|
-
}
|
|
30
22
|
export declare function createTextmateTokenizer(grammar: IGrammar, options: TokenizerOption): monaco.languages.EncodedTokensProvider & monaco.languages.TokensProvider;
|
|
31
23
|
//# sourceMappingURL=textmate-tokenizer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textmate-tokenizer.d.ts","sourceRoot":"","sources":["../../../src/browser/textmate/textmate-tokenizer.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAW,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAEpD,qBAAa,cAAe,YAAW,MAAM,CAAC,SAAS,CAAC,MAAM;aAGtC,SAAS,EAAE,YAAY;gBAAvB,SAAS,EAAE,YAAY;IAG3C,KAAK,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM;IAIhC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG,OAAO;CAIlD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAE5B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CAEtB;AAED,
|
|
1
|
+
{"version":3,"file":"textmate-tokenizer.d.ts","sourceRoot":"","sources":["../../../src/browser/textmate/textmate-tokenizer.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAW,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAEpD,qBAAa,cAAe,YAAW,MAAM,CAAC,SAAS,CAAC,MAAM;aAGtC,SAAS,EAAE,YAAY;gBAAvB,SAAS,EAAE,YAAY;IAG3C,KAAK,IAAI,MAAM,CAAC,SAAS,CAAC,MAAM;IAIhC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,MAAM,GAAG,OAAO;CAIlD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAE5B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CAEtB;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,qBAAqB,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAgC7J"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
16
|
// *****************************************************************************
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.createTextmateTokenizer = exports.
|
|
18
|
+
exports.createTextmateTokenizer = exports.TokenizerState = void 0;
|
|
19
19
|
const vscode_textmate_1 = require("vscode-textmate");
|
|
20
20
|
class TokenizerState {
|
|
21
21
|
constructor(ruleStack) {
|
|
@@ -29,17 +29,6 @@ class TokenizerState {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
exports.TokenizerState = TokenizerState;
|
|
32
|
-
var TokenizerOption;
|
|
33
|
-
(function (TokenizerOption) {
|
|
34
|
-
/**
|
|
35
|
-
* The default TextMate tokenizer option.
|
|
36
|
-
*
|
|
37
|
-
* @deprecated Use the current value of `editor.maxTokenizationLineLength` preference instead.
|
|
38
|
-
*/
|
|
39
|
-
TokenizerOption.DEFAULT = {
|
|
40
|
-
lineLimit: 400
|
|
41
|
-
};
|
|
42
|
-
})(TokenizerOption = exports.TokenizerOption || (exports.TokenizerOption = {}));
|
|
43
32
|
function createTextmateTokenizer(grammar, options) {
|
|
44
33
|
if (options.lineLimit !== undefined && (options.lineLimit <= 0 || !Number.isInteger(options.lineLimit))) {
|
|
45
34
|
throw new Error(`The 'lineLimit' must be a positive integer. It was ${options.lineLimit}.`);
|
|
@@ -47,24 +36,22 @@ function createTextmateTokenizer(grammar, options) {
|
|
|
47
36
|
return {
|
|
48
37
|
getInitialState: () => new TokenizerState(vscode_textmate_1.INITIAL),
|
|
49
38
|
tokenizeEncoded(line, state) {
|
|
50
|
-
let processedLine = line;
|
|
51
39
|
if (options.lineLimit !== undefined && line.length > options.lineLimit) {
|
|
52
|
-
//
|
|
53
|
-
|
|
40
|
+
// Skip tokenizing the line if it exceeds the line limit.
|
|
41
|
+
return { endState: state.ruleStack, tokens: new Uint32Array() };
|
|
54
42
|
}
|
|
55
|
-
const result = grammar.tokenizeLine2(
|
|
43
|
+
const result = grammar.tokenizeLine2(line, state.ruleStack, 500);
|
|
56
44
|
return {
|
|
57
45
|
endState: new TokenizerState(result.ruleStack),
|
|
58
46
|
tokens: result.tokens
|
|
59
47
|
};
|
|
60
48
|
},
|
|
61
49
|
tokenize(line, state) {
|
|
62
|
-
let processedLine = line;
|
|
63
50
|
if (options.lineLimit !== undefined && line.length > options.lineLimit) {
|
|
64
|
-
//
|
|
65
|
-
|
|
51
|
+
// Skip tokenizing the line if it exceeds the line limit.
|
|
52
|
+
return { endState: state.ruleStack, tokens: [] };
|
|
66
53
|
}
|
|
67
|
-
const result = grammar.tokenizeLine(
|
|
54
|
+
const result = grammar.tokenizeLine(line, state.ruleStack, 500);
|
|
68
55
|
return {
|
|
69
56
|
endState: new TokenizerState(result.ruleStack),
|
|
70
57
|
tokens: result.tokens.map(t => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textmate-tokenizer.js","sourceRoot":"","sources":["../../../src/browser/textmate/textmate-tokenizer.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;;;AAEhF,qDAAkE;AAGlE,MAAa,cAAc;IAEvB,YACoB,SAAuB;QAAvB,cAAS,GAAT,SAAS,CAAc;IACvC,CAAC;IAEL,KAAK;QACD,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,KAA8B;QACjC,OAAO,KAAK,YAAY,cAAc,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC;IACrG,CAAC;CAEJ;AAdD,wCAcC;AAkBD,
|
|
1
|
+
{"version":3,"file":"textmate-tokenizer.js","sourceRoot":"","sources":["../../../src/browser/textmate/textmate-tokenizer.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;;;AAEhF,qDAAkE;AAGlE,MAAa,cAAc;IAEvB,YACoB,SAAuB;QAAvB,cAAS,GAAT,SAAS,CAAc;IACvC,CAAC;IAEL,KAAK;QACD,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,KAA8B;QACjC,OAAO,KAAK,YAAY,cAAc,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC;IACrG,CAAC;CAEJ;AAdD,wCAcC;AAkBD,SAAgB,uBAAuB,CAAC,OAAiB,EAAE,OAAwB;IAC/E,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE;QACrG,MAAM,IAAI,KAAK,CAAC,sDAAsD,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC;KAC/F;IACD,OAAO;QACH,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,yBAAO,CAAC;QAClD,eAAe,CAAC,IAAY,EAAE,KAAqB;YAC/C,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE;gBACpE,yDAAyD;gBACzD,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,WAAW,EAAE,EAAE,CAAC;aACnE;YACD,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;YACjE,OAAO;gBACH,QAAQ,EAAE,IAAI,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC;gBAC9C,MAAM,EAAE,MAAM,CAAC,MAAM;aACxB,CAAC;QACN,CAAC;QACD,QAAQ,CAAC,IAAY,EAAE,KAAqB;YACxC,IAAI,OAAO,CAAC,SAAS,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE;gBACpE,yDAAyD;gBACzD,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;aACpD;YACD,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;YAChE,OAAO;gBACH,QAAQ,EAAE,IAAI,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC;gBAC9C,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBAC5B,UAAU,EAAE,CAAC,CAAC,UAAU;oBACxB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;iBACvC,CAAC,CAAC;aACN,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC;AAhCD,0DAgCC"}
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/monaco",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.29.0-next.10+c617a60355d",
|
|
4
4
|
"description": "Theia - Monaco Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.
|
|
7
|
-
"@theia/editor": "1.
|
|
8
|
-
"@theia/filesystem": "1.
|
|
9
|
-
"@theia/markers": "1.
|
|
10
|
-
"@theia/monaco-editor-core": "1.
|
|
11
|
-
"@theia/outline-view": "1.
|
|
6
|
+
"@theia/core": "1.29.0-next.10+c617a60355d",
|
|
7
|
+
"@theia/editor": "1.29.0-next.10+c617a60355d",
|
|
8
|
+
"@theia/filesystem": "1.29.0-next.10+c617a60355d",
|
|
9
|
+
"@theia/markers": "1.29.0-next.10+c617a60355d",
|
|
10
|
+
"@theia/monaco-editor-core": "1.67.2",
|
|
11
|
+
"@theia/outline-view": "1.29.0-next.10+c617a60355d",
|
|
12
12
|
"fast-plist": "^0.1.2",
|
|
13
13
|
"idb": "^4.0.5",
|
|
14
14
|
"jsonc-parser": "^2.2.0",
|
|
15
|
-
"
|
|
16
|
-
"vscode-textmate": "^
|
|
15
|
+
"vscode-oniguruma": "1.6.1",
|
|
16
|
+
"vscode-textmate": "^7.0.1"
|
|
17
17
|
},
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"watch": "theiaext watch"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@theia/ext-scripts": "1.
|
|
52
|
+
"@theia/ext-scripts": "1.28.0"
|
|
53
53
|
},
|
|
54
54
|
"nyc": {
|
|
55
55
|
"extends": "../../configs/nyc.json"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "c617a60355d5cbfaf1fecb3554cda9329eeeb1f9"
|
|
58
58
|
}
|
|
@@ -38,14 +38,15 @@ export class MonacoColorRegistry extends ColorRegistry {
|
|
|
38
38
|
|
|
39
39
|
override getCurrentColor(id: string): string | undefined {
|
|
40
40
|
const color = this.monacoThemeService.getColorTheme().getColor(id);
|
|
41
|
-
return color
|
|
41
|
+
return color?.toString();
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
protected override doRegister(definition: ColorDefinition): Disposable {
|
|
45
45
|
const defaults: ColorDefaults = {
|
|
46
46
|
dark: this.toColor(definition.defaults?.dark),
|
|
47
47
|
light: this.toColor(definition.defaults?.light),
|
|
48
|
-
|
|
48
|
+
hcDark: this.toColor(definition.defaults?.hcDark ?? definition.defaults?.hc),
|
|
49
|
+
hcLight: this.toColor(definition.defaults?.hcLight),
|
|
49
50
|
};
|
|
50
51
|
const identifier = this.monacoColorRegistry.registerColor(definition.id, defaults, definition.description);
|
|
51
52
|
return Disposable.create(() => this.monacoColorRegistry.deregisterColor(identifier));
|
|
@@ -135,7 +135,7 @@ export class MonacoEditorCommandHandlers implements CommandContribution {
|
|
|
135
135
|
* and execute them using the instantiation service of the current editor.
|
|
136
136
|
*/
|
|
137
137
|
protected registerMonacoCommands(): void {
|
|
138
|
-
const editorActions = new Map(EditorExtensionsRegistry.getEditorActions().map(({ id, label }) => [id, label]));
|
|
138
|
+
const editorActions = new Map(EditorExtensionsRegistry.getEditorActions().map(({ id, label, alias }) => [id, { label, alias }]));
|
|
139
139
|
|
|
140
140
|
const { codeEditorService } = this;
|
|
141
141
|
const globalInstantiationService = StandaloneServices.initialize({});
|
|
@@ -179,8 +179,8 @@ export class MonacoEditorCommandHandlers implements CommandContribution {
|
|
|
179
179
|
return true;
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
|
-
const
|
|
183
|
-
this.commandRegistry.registerCommand({ id, label }, handler);
|
|
182
|
+
const commandAction = editorActions.get(id);
|
|
183
|
+
this.commandRegistry.registerCommand({ id, label: commandAction?.label, originalLabel: commandAction?.alias }, handler);
|
|
184
184
|
const coreCommand = MonacoCommands.COMMON_ACTIONS.get(id);
|
|
185
185
|
if (coreCommand) {
|
|
186
186
|
this.commandRegistry.registerHandler(coreCommand, handler);
|
|
@@ -63,6 +63,10 @@ export class MonacoDiffEditor extends MonacoEditor {
|
|
|
63
63
|
|
|
64
64
|
protected override create(options?: IDiffEditorConstructionOptions, override?: EditorServiceOverrides): Disposable {
|
|
65
65
|
const instantiator = this.getInstantiatorWithOverrides(override);
|
|
66
|
+
/**
|
|
67
|
+
* @monaco-uplift. Should be guaranteed to work.
|
|
68
|
+
* Incomparable enums prevent TypeScript from believing that public IStandaloneDiffEditor is satisfied by private StandaloneDiffEditor
|
|
69
|
+
*/
|
|
66
70
|
this._diffEditor = instantiator
|
|
67
71
|
.createInstance(StandaloneDiffEditor, this.node, { ...options, fixedOverflowWidgets: true }) as unknown as monaco.editor.IStandaloneDiffEditor;
|
|
68
72
|
this.editor = this._diffEditor.getModifiedEditor();
|
|
@@ -142,7 +142,10 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
142
142
|
}
|
|
143
143
|
} as IStandaloneEditorConstructionOptions;
|
|
144
144
|
const instantiator = this.getInstantiatorWithOverrides(override);
|
|
145
|
-
|
|
145
|
+
/**
|
|
146
|
+
* @monaco-uplift. Should be guaranteed to work.
|
|
147
|
+
* Incomparable enums prevent TypeScript from believing that public IStandaloneCodeEditor is satisfied by private StandaloneCodeEditor
|
|
148
|
+
*/
|
|
146
149
|
return this.editor = instantiator.createInstance(StandaloneEditor, this.node, combinedOptions) as unknown as monaco.editor.IStandaloneCodeEditor;
|
|
147
150
|
}
|
|
148
151
|
|
|
@@ -35,6 +35,16 @@ import { editorOptionsRegistry, IEditorOption } from '@theia/monaco-editor-core/
|
|
|
35
35
|
import { MAX_SAFE_INTEGER } from '@theia/core';
|
|
36
36
|
import { editorGeneratedPreferenceProperties } from '@theia/editor/lib/browser/editor-generated-preference-schema';
|
|
37
37
|
|
|
38
|
+
let theiaDidInitialize = false;
|
|
39
|
+
const originalInitialize = StandaloneServices.initialize;
|
|
40
|
+
StandaloneServices.initialize = overrides => {
|
|
41
|
+
if (!theiaDidInitialize) {
|
|
42
|
+
console.warn('Monaco was initialized before overrides were installed by Theia\'s initialization.'
|
|
43
|
+
+ ' Please check the lifecycle of services that use Monaco and ensure that Monaco entities are not instantiated before Theia is initialized.', new Error());
|
|
44
|
+
}
|
|
45
|
+
return originalInitialize(overrides);
|
|
46
|
+
};
|
|
47
|
+
|
|
38
48
|
@injectable()
|
|
39
49
|
export class MonacoFrontendApplicationContribution implements FrontendApplicationContribution, StylingParticipant {
|
|
40
50
|
|
|
@@ -65,6 +75,7 @@ export class MonacoFrontendApplicationContribution implements FrontendApplicatio
|
|
|
65
75
|
protected init(): void {
|
|
66
76
|
this.addAdditionalPreferenceValidations();
|
|
67
77
|
const { codeEditorService, textModelService, contextKeyService, contextMenuService } = this;
|
|
78
|
+
theiaDidInitialize = true;
|
|
68
79
|
StandaloneServices.initialize({
|
|
69
80
|
[ICodeEditorService.toString()]: codeEditorService,
|
|
70
81
|
[ITextModelService.toString()]: textModelService,
|
|
@@ -74,7 +85,10 @@ export class MonacoFrontendApplicationContribution implements FrontendApplicatio
|
|
|
74
85
|
// Monaco registers certain quick access providers (e.g. QuickCommandAccess) at import time, but we want to use our own.
|
|
75
86
|
this.quickAccessRegistry.clear();
|
|
76
87
|
|
|
77
|
-
|
|
88
|
+
/**
|
|
89
|
+
* @monaco-uplift.Should be guaranteed to work.
|
|
90
|
+
* Incomparable enums prevent TypeScript from believing that public ITextModel satisfied private ITextModel
|
|
91
|
+
*/
|
|
78
92
|
setSnippetSuggestSupport(this.snippetSuggestProvider as unknown as CompletionItemProvider);
|
|
79
93
|
|
|
80
94
|
for (const language of monaco.languages.getLanguages()) {
|
|
@@ -167,7 +181,7 @@ export class MonacoFrontendApplicationContribution implements FrontendApplicatio
|
|
|
167
181
|
new editorBoolConstructor(id++, 'wordBasedSuggestions', true, editorGeneratedPreferenceProperties['editor.wordBasedSuggestions']),
|
|
168
182
|
new editorStringEnumConstructor(id++, 'wordBasedSuggestionsMode', 'matchingDocuments', editorGeneratedPreferenceProperties['editor.wordBasedSuggestionsMode'].enum, editorGeneratedPreferenceProperties['editor.wordBasedSuggestionsMode']),
|
|
169
183
|
new editorBoolConstructor(id++, 'stablePeek', false, editorGeneratedPreferenceProperties['editor.stablePeek']),
|
|
170
|
-
new editorIntConstructor(id++, '
|
|
184
|
+
new editorIntConstructor(id++, 'maxTokenizationLineLength', 20000, 1, MAX_SAFE_INTEGER, editorGeneratedPreferenceProperties['editor.maxTokenizationLineLength']),
|
|
171
185
|
);
|
|
172
186
|
}
|
|
173
187
|
}
|
|
@@ -19,8 +19,9 @@ import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposa
|
|
|
19
19
|
import { ThemeService } from '@theia/core/lib/browser/theming';
|
|
20
20
|
import * as monaco from '@theia/monaco-editor-core';
|
|
21
21
|
import { injectable } from '@theia/core/shared/inversify';
|
|
22
|
-
import type { ThemeMix } from './textmate/monaco-theme-
|
|
22
|
+
import type { ThemeMix } from './textmate/monaco-theme-types';
|
|
23
23
|
import { Theme } from '@theia/core/lib/common/theme';
|
|
24
|
+
import { Emitter, Event } from '@theia/core';
|
|
24
25
|
|
|
25
26
|
let _monacoDB: Promise<idb.IDBPDatabase> | undefined;
|
|
26
27
|
if ('indexedDB' in window) {
|
|
@@ -99,25 +100,31 @@ export function stateToTheme(state: MonacoThemeState): Theme {
|
|
|
99
100
|
};
|
|
100
101
|
}
|
|
101
102
|
|
|
102
|
-
async function getThemeFromDB(id: string): Promise<Theme | undefined> {
|
|
103
|
-
const matchingState = (await getThemes()).find(theme => theme.id === id);
|
|
104
|
-
return matchingState && stateToTheme(matchingState);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
103
|
@injectable()
|
|
108
104
|
export class ThemeServiceWithDB extends ThemeService {
|
|
105
|
+
protected onDidRetrieveThemeEmitter = new Emitter<MonacoThemeState>();
|
|
106
|
+
get onDidRetrieveTheme(): Event<MonacoThemeState> {
|
|
107
|
+
return this.onDidRetrieveThemeEmitter.event;
|
|
108
|
+
}
|
|
109
|
+
|
|
109
110
|
override loadUserTheme(): void {
|
|
110
111
|
this.loadUserThemeWithDB();
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
protected async loadUserThemeWithDB(): Promise<void> {
|
|
114
|
-
const themeId = window.localStorage.getItem(
|
|
115
|
-
const theme = this.themes[themeId] ?? await
|
|
115
|
+
const themeId = window.localStorage.getItem(ThemeService.STORAGE_KEY) ?? this.defaultTheme.id;
|
|
116
|
+
const theme = this.themes[themeId] ?? await getThemes().then(themes => {
|
|
117
|
+
const matchingTheme = themes.find(candidate => candidate.id === themeId);
|
|
118
|
+
if (matchingTheme) {
|
|
119
|
+
this.onDidRetrieveThemeEmitter.fire(matchingTheme);
|
|
120
|
+
return stateToTheme(matchingTheme);
|
|
121
|
+
}
|
|
122
|
+
}) ?? this.getTheme(themeId);
|
|
116
123
|
// In case the theme comes from the DB.
|
|
117
124
|
if (!this.themes[theme.id]) {
|
|
118
125
|
this.themes[theme.id] = theme;
|
|
119
126
|
}
|
|
120
|
-
this.setCurrentTheme(theme.id);
|
|
127
|
+
this.setCurrentTheme(theme.id, false);
|
|
121
128
|
this.deferredInitializer.resolve();
|
|
122
129
|
}
|
|
123
130
|
}
|
|
@@ -214,7 +214,7 @@ export class MonacoQuickInputService implements QuickInputService {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
createInputBox(): InputBox {
|
|
217
|
-
return this.monacoService.createInputBox()
|
|
217
|
+
return this.monacoService.createInputBox();
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
input(options?: InputOptions, token?: monaco.CancellationToken): Promise<string | undefined> {
|
|
@@ -253,6 +253,7 @@ export class MonacoQuickInputService implements QuickInputService {
|
|
|
253
253
|
return new Promise<T | undefined>((resolve, reject) => {
|
|
254
254
|
const quickPick = this.monacoService.createQuickPick<MonacoQuickPickItem<T>>();
|
|
255
255
|
const wrapped = this.wrapQuickPick(quickPick);
|
|
256
|
+
wrapped.items = items;
|
|
256
257
|
|
|
257
258
|
if (options) {
|
|
258
259
|
wrapped.canSelectMany = !!options.canSelectMany;
|
|
@@ -321,8 +322,6 @@ export class MonacoQuickInputService implements QuickInputService {
|
|
|
321
322
|
}
|
|
322
323
|
});
|
|
323
324
|
}
|
|
324
|
-
|
|
325
|
-
wrapped.items = items;
|
|
326
325
|
wrapped.show();
|
|
327
326
|
}).then(item => {
|
|
328
327
|
if (item?.execute) {
|
|
@@ -134,7 +134,9 @@ export class MonacoTextModelService implements ITextModelService {
|
|
|
134
134
|
switch (editorPreference) {
|
|
135
135
|
case 'editor.tabSize': return 'tabSize';
|
|
136
136
|
case 'editor.insertSpaces': return 'insertSpaces';
|
|
137
|
-
case 'editor.bracketPairColorization.enabled':
|
|
137
|
+
case 'editor.bracketPairColorization.enabled':
|
|
138
|
+
case 'editor.bracketPairColorization.independentColorPoolPerBracketType':
|
|
139
|
+
return 'bracketColorizationOptions';
|
|
138
140
|
case 'editor.trimAutoWhitespace': return 'trimAutoWhitespace';
|
|
139
141
|
|
|
140
142
|
}
|
|
@@ -142,28 +144,21 @@ export class MonacoTextModelService implements ITextModelService {
|
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
protected updateModel(model: MonacoEditorModel, change?: EditorPreferenceChange): void {
|
|
145
|
-
if (change) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
if (!change) {
|
|
148
|
+
model.autoSave = this.editorPreferences.get('files.autoSave', undefined, model.uri);
|
|
149
|
+
model.autoSaveDelay = this.editorPreferences.get('files.autoSaveDelay', undefined, model.uri);
|
|
150
|
+
model.textEditorModel.updateOptions(this.getModelOptions(model));
|
|
151
|
+
} else if (change.affects(model.uri, model.languageId)) {
|
|
149
152
|
if (change.preferenceName === 'files.autoSave') {
|
|
150
153
|
model.autoSave = this.editorPreferences.get('files.autoSave', undefined, model.uri);
|
|
151
154
|
}
|
|
152
155
|
if (change.preferenceName === 'files.autoSaveDelay') {
|
|
153
156
|
model.autoSaveDelay = this.editorPreferences.get('files.autoSaveDelay', undefined, model.uri);
|
|
154
157
|
}
|
|
155
|
-
const modelOption = this.
|
|
158
|
+
const modelOption = this.toModelOption(change.preferenceName);
|
|
156
159
|
if (modelOption) {
|
|
157
|
-
|
|
158
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
159
|
-
const newValue = change.newValue as any;
|
|
160
|
-
options[modelOption] = change.preferenceName === 'editor.bracketPairColorization.enabled' ? { enabled: newValue } : newValue;
|
|
161
|
-
model.textEditorModel.updateOptions(options);
|
|
160
|
+
model.textEditorModel.updateOptions(this.getModelOptions(model));
|
|
162
161
|
}
|
|
163
|
-
} else {
|
|
164
|
-
model.autoSave = this.editorPreferences.get('files.autoSave', undefined, model.uri);
|
|
165
|
-
model.autoSaveDelay = this.editorPreferences.get('files.autoSaveDelay', undefined, model.uri);
|
|
166
|
-
model.textEditorModel.updateOptions(this.getModelOptions(model));
|
|
167
162
|
}
|
|
168
163
|
}
|
|
169
164
|
|
|
@@ -176,7 +171,11 @@ export class MonacoTextModelService implements ITextModelService {
|
|
|
176
171
|
return {
|
|
177
172
|
tabSize: this.editorPreferences.get({ preferenceName: 'editor.tabSize', overrideIdentifier }, undefined, uri),
|
|
178
173
|
insertSpaces: this.editorPreferences.get({ preferenceName: 'editor.insertSpaces', overrideIdentifier }, undefined, uri),
|
|
179
|
-
bracketColorizationOptions: {
|
|
174
|
+
bracketColorizationOptions: {
|
|
175
|
+
enabled: this.editorPreferences.get({ preferenceName: 'editor.bracketPairColorization.enabled', overrideIdentifier }, undefined, uri),
|
|
176
|
+
independentColorPoolPerBracketType: this.editorPreferences.get(
|
|
177
|
+
{ preferenceName: 'editor.bracketPairColorization.independentColorPoolPerBracketType', overrideIdentifier }, undefined, uri),
|
|
178
|
+
},
|
|
180
179
|
trimAutoWhitespace: this.editorPreferences.get({ preferenceName: 'editor.trimAutoWhitespace', overrideIdentifier }, undefined, uri),
|
|
181
180
|
};
|
|
182
181
|
}
|
|
@@ -19,11 +19,10 @@
|
|
|
19
19
|
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
20
20
|
import * as jsoncparser from 'jsonc-parser';
|
|
21
21
|
import * as plistparser from 'fast-plist';
|
|
22
|
-
import { ThemeService } from '@theia/core/lib/browser/theming';
|
|
23
22
|
import URI from '@theia/core/lib/common/uri';
|
|
24
23
|
import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
25
24
|
import { MonacoThemeRegistry } from './textmate/monaco-theme-registry';
|
|
26
|
-
import { getThemes, putTheme, MonacoThemeState, stateToTheme } from './monaco-indexed-db';
|
|
25
|
+
import { getThemes, putTheme, MonacoThemeState, stateToTheme, ThemeServiceWithDB } from './monaco-indexed-db';
|
|
27
26
|
import { FileService } from '@theia/filesystem/lib/browser/file-service';
|
|
28
27
|
import * as monaco from '@theia/monaco-editor-core';
|
|
29
28
|
|
|
@@ -61,7 +60,7 @@ export class MonacoThemingService {
|
|
|
61
60
|
|
|
62
61
|
@inject(FileService) protected readonly fileService: FileService;
|
|
63
62
|
@inject(MonacoThemeRegistry) protected readonly monacoThemeRegistry: MonacoThemeRegistry;
|
|
64
|
-
@inject(
|
|
63
|
+
@inject(ThemeServiceWithDB) protected readonly themeService: ThemeServiceWithDB;
|
|
65
64
|
|
|
66
65
|
/** Register themes whose configuration needs to be loaded */
|
|
67
66
|
register(theme: MonacoTheme, pending: { [uri: string]: Promise<any> } = {}): Disposable {
|
|
@@ -143,6 +142,7 @@ export class MonacoThemingService {
|
|
|
143
142
|
this.monacoThemeRegistry.initializeDefaultThemes();
|
|
144
143
|
this.updateBodyUiTheme();
|
|
145
144
|
this.themeService.onDidColorThemeChange(() => this.updateBodyUiTheme());
|
|
145
|
+
this.themeService.onDidRetrieveTheme(theme => this.monacoThemeRegistry.setTheme(MonacoThemingService.toCssSelector(theme.id), theme.data));
|
|
146
146
|
this.restore();
|
|
147
147
|
}
|
|
148
148
|
|
|
@@ -19,17 +19,18 @@ import { FrontendApplicationContribution, isBasicWasmSupported } from '@theia/co
|
|
|
19
19
|
import { bindContributionProvider } from '@theia/core';
|
|
20
20
|
import { TextmateRegistry } from './textmate-registry';
|
|
21
21
|
import { LanguageGrammarDefinitionContribution } from './textmate-contribution';
|
|
22
|
-
import { MonacoTextmateService
|
|
22
|
+
import { MonacoTextmateService } from './monaco-textmate-service';
|
|
23
23
|
import { MonacoThemeRegistry } from './monaco-theme-registry';
|
|
24
|
-
import { loadWASM, OnigScanner, OnigString } from '
|
|
25
|
-
import { IOnigLib } from 'vscode-textmate';
|
|
24
|
+
import { loadWASM, createOnigScanner, OnigScanner, createOnigString, OnigString } from 'vscode-oniguruma';
|
|
25
|
+
import { IOnigLib, IRawGrammar, parseRawGrammar, Registry } from 'vscode-textmate';
|
|
26
|
+
import { OnigasmPromise, TextmateRegistryFactory, ThemeMix } from './monaco-theme-types';
|
|
26
27
|
|
|
27
28
|
export class OnigasmLib implements IOnigLib {
|
|
28
29
|
createOnigScanner(sources: string[]): OnigScanner {
|
|
29
|
-
return
|
|
30
|
+
return createOnigScanner(sources);
|
|
30
31
|
}
|
|
31
32
|
createOnigString(sources: string): OnigString {
|
|
32
|
-
return
|
|
33
|
+
return createOnigString(sources);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -40,6 +41,35 @@ export default (bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: inter
|
|
|
40
41
|
bindContributionProvider(bind, LanguageGrammarDefinitionContribution);
|
|
41
42
|
bind(TextmateRegistry).toSelf().inSingletonScope();
|
|
42
43
|
bind(MonacoThemeRegistry).toSelf().inSingletonScope();
|
|
44
|
+
bind(TextmateRegistryFactory).toFactory(({ container }) => (theme?: ThemeMix) => {
|
|
45
|
+
const onigLib = container.get<OnigasmPromise>(OnigasmPromise);
|
|
46
|
+
const textmateRegistry = container.get(TextmateRegistry);
|
|
47
|
+
return new Registry({
|
|
48
|
+
onigLib,
|
|
49
|
+
theme,
|
|
50
|
+
loadGrammar: async (scopeName: string) => {
|
|
51
|
+
const provider = textmateRegistry.getProvider(scopeName);
|
|
52
|
+
if (provider) {
|
|
53
|
+
const definition = await provider.getGrammarDefinition();
|
|
54
|
+
let rawGrammar: IRawGrammar;
|
|
55
|
+
if (typeof definition.content === 'string') {
|
|
56
|
+
rawGrammar = parseRawGrammar(definition.content, definition.format === 'json' ? 'grammar.json' : 'grammar.plist');
|
|
57
|
+
} else {
|
|
58
|
+
rawGrammar = definition.content as IRawGrammar;
|
|
59
|
+
}
|
|
60
|
+
return rawGrammar;
|
|
61
|
+
}
|
|
62
|
+
return undefined;
|
|
63
|
+
},
|
|
64
|
+
getInjections: (scopeName: string) => {
|
|
65
|
+
const provider = textmateRegistry.getProvider(scopeName);
|
|
66
|
+
if (provider && provider.getInjections) {
|
|
67
|
+
return provider.getInjections(scopeName);
|
|
68
|
+
}
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
43
73
|
};
|
|
44
74
|
|
|
45
75
|
export async function dynamicOnigasmLib(ctx: interfaces.Context): Promise<IOnigLib> {
|
|
@@ -57,7 +87,7 @@ export async function createOnigasmLib(): Promise<IOnigLib> {
|
|
|
57
87
|
|
|
58
88
|
export async function fetchOnigasm(): Promise<ArrayBuffer> {
|
|
59
89
|
// Using Webpack's wasm loader should give us a URL to fetch the resource from:
|
|
60
|
-
const onigasmPath: string = require('
|
|
90
|
+
const onigasmPath: string = require('vscode-oniguruma/release/onig.wasm');
|
|
61
91
|
const response = await fetch(onigasmPath, { method: 'GET' });
|
|
62
92
|
return response.arrayBuffer();
|
|
63
93
|
}
|
|
@@ -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
|