@webgal/language-service 0.0.2-alpha.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 +373 -0
- package/build/chunk-C0xms8kb.cjs +34 -0
- package/build/index.cjs +297 -0
- package/build/index.d.cts +103 -0
- package/build/index.d.mts +103 -0
- package/build/index.mjs +293 -0
- package/build/language-configuration-BeRkRSII.mjs +214 -0
- package/build/language-configuration-D41FLA6b.cjs +232 -0
- package/build/monaco-init.cjs +83 -0
- package/build/monaco-init.d.cts +7 -0
- package/build/monaco-init.d.mts +7 -0
- package/build/monaco-init.mjs +78 -0
- package/build/monaco.cjs +138 -0
- package/build/monaco.d.cts +32 -0
- package/build/monaco.d.mts +32 -0
- package/build/monaco.mjs +134 -0
- package/build/node.cjs +374 -0
- package/build/node.d.cts +11 -0
- package/build/node.d.mts +11 -0
- package/build/node.mjs +370 -0
- package/build/syntaxes.cjs +12 -0
- package/build/syntaxes.d.cts +293 -0
- package/build/syntaxes.d.mts +293 -0
- package/build/syntaxes.mjs +9 -0
- package/build/themes.cjs +10 -0
- package/build/themes.d.cts +286 -0
- package/build/themes.d.mts +286 -0
- package/build/themes.mjs +8 -0
- package/build/white-Be4QIaif.cjs +1007 -0
- package/build/white-CaNrG0B0.mjs +995 -0
- package/package.json +71 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
|
|
2
|
+
//#region syntaxes/webgal.tmLanguage.json
|
|
3
|
+
var webgal_tmLanguage_default = {
|
|
4
|
+
$schema: "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
5
|
+
name: "WebGAL Script",
|
|
6
|
+
patterns: [{ "include": "#comment-line" }, { "include": "#statement" }],
|
|
7
|
+
repository: {
|
|
8
|
+
"argument-list": { "patterns": [{
|
|
9
|
+
"comment": ">1 arguments left, ie -kwarg0=val0 -kwarg1=val1 ...",
|
|
10
|
+
"match": "(\\s\\-)(.*?)(\\s\\-.*)$",
|
|
11
|
+
"captures": {
|
|
12
|
+
"1": { "patterns": [{ "include": "#operator" }] },
|
|
13
|
+
"2": { "patterns": [{ "include": "#parameter" }] },
|
|
14
|
+
"3": { "patterns": [{ "include": "#argument-list" }] }
|
|
15
|
+
}
|
|
16
|
+
}, {
|
|
17
|
+
"comment": "only one argument left, ie -kwarg0=val0",
|
|
18
|
+
"match": "(\\s\\-)(.*)",
|
|
19
|
+
"captures": {
|
|
20
|
+
"1": { "patterns": [{ "include": "#operator" }] },
|
|
21
|
+
"2": { "patterns": [{ "include": "#parameter" }] }
|
|
22
|
+
}
|
|
23
|
+
}] },
|
|
24
|
+
"character": {
|
|
25
|
+
"match": ".*",
|
|
26
|
+
"name": "entity.name.type.character.webgal"
|
|
27
|
+
},
|
|
28
|
+
"command": {
|
|
29
|
+
"match": ".*",
|
|
30
|
+
"name": "support.function.command.webgal"
|
|
31
|
+
},
|
|
32
|
+
"comment-line": {
|
|
33
|
+
"match": "\\;.*?$",
|
|
34
|
+
"name": "comment.line.webgal"
|
|
35
|
+
},
|
|
36
|
+
"operator": {
|
|
37
|
+
"match": "[\\:\\=\\<\\>\\|\\+\\-]",
|
|
38
|
+
"name": "keyword.operator.webgal"
|
|
39
|
+
},
|
|
40
|
+
"parameter": { "patterns": [{
|
|
41
|
+
"comment": "value only, ie val0",
|
|
42
|
+
"match": "(?!.*\\=).+",
|
|
43
|
+
"name": "variable.parameter.webgal"
|
|
44
|
+
}, {
|
|
45
|
+
"comment": "name and value, ie [kwarg0]=[val0]",
|
|
46
|
+
"match": "(.*?)(\\=)(.*?)$",
|
|
47
|
+
"captures": {
|
|
48
|
+
"1": { "name": "variable.parameter.webgal" },
|
|
49
|
+
"2": { "patterns": [{ "include": "#operator" }] },
|
|
50
|
+
"3": { "name": "variable.other.webgal" }
|
|
51
|
+
}
|
|
52
|
+
}] },
|
|
53
|
+
"utterance": { "patterns": [{
|
|
54
|
+
"comment": "utterance only",
|
|
55
|
+
"match": "(?!.*\\s\\-)(.+)",
|
|
56
|
+
"captures": { "0": { "name": "string.unquoted.utterance.webgal" } }
|
|
57
|
+
}, {
|
|
58
|
+
"comment": "utterance and argument list",
|
|
59
|
+
"match": "(.*?)(\\s\\-.*?)$",
|
|
60
|
+
"captures": {
|
|
61
|
+
"1": { "name": "string.unquoted.utterance.webgal" },
|
|
62
|
+
"2": { "patterns": [{ "include": "#argument-list" }] }
|
|
63
|
+
}
|
|
64
|
+
}] },
|
|
65
|
+
"character-colon": {
|
|
66
|
+
"comment": "[char]:[utt[ -args]][;cmt]",
|
|
67
|
+
"match": "^(?!(?:say|changeBg|changeFigure|bgm|playVideo|pixiPerform|pixiInit|intro|miniAvatar|changeScene|choose|end|setComplexAnimation|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|filmMode|setTextbox|setAnimation|playEffect|setTempAnimation|setTransform|setTransition|getUserInput|applyStyle|wait)\\:)(.*?)(\\:)([^\\;\\n]*?)($|\\;.*?$)",
|
|
68
|
+
"captures": {
|
|
69
|
+
"1": {
|
|
70
|
+
"name": "meta.character.webgal",
|
|
71
|
+
"patterns": [{ "include": "#character" }]
|
|
72
|
+
},
|
|
73
|
+
"2": { "patterns": [{ "include": "#operator" }] },
|
|
74
|
+
"3": { "patterns": [{ "include": "#utterance" }] },
|
|
75
|
+
"4": { "patterns": [{ "include": "#comment-line" }] }
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"command-colon": {
|
|
79
|
+
"comment": "cmd:[arg0[ -args]][;cmt]",
|
|
80
|
+
"match": "^(say|changeBg|changeFigure|bgm|playVideo|pixiPerform|pixiInit|intro|miniAvatar|changeScene|choose|end|setComplexAnimation|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|filmMode|setTextbox|setAnimation|playEffect|setTempAnimation|setTransform|setTransition|getUserInput|applyStyle|wait)(\\:)([^\\;\\n]*?)($|\\;.*?$)",
|
|
81
|
+
"captures": {
|
|
82
|
+
"1": {
|
|
83
|
+
"name": "meta.command.webgal",
|
|
84
|
+
"patterns": [{ "include": "#command" }]
|
|
85
|
+
},
|
|
86
|
+
"2": { "patterns": [{ "include": "#operator" }] },
|
|
87
|
+
"3": { "patterns": [{ "include": "#argument-list" }] },
|
|
88
|
+
"4": { "patterns": [{ "include": "#comment-line" }] }
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"command-semicolon": {
|
|
92
|
+
"comment": "cmd;[cmt]",
|
|
93
|
+
"match": "^(say|changeBg|changeFigure|bgm|playVideo|pixiPerform|pixiInit|intro|miniAvatar|changeScene|choose|end|setComplexAnimation|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|filmMode|setTextbox|setAnimation|playEffect|setTempAnimation|setTransform|setTransition|getUserInput|applyStyle|wait)($|\\;.*?$)",
|
|
94
|
+
"captures": {
|
|
95
|
+
"1": {
|
|
96
|
+
"name": "meta.command.webgal",
|
|
97
|
+
"patterns": [{ "include": "#command" }]
|
|
98
|
+
},
|
|
99
|
+
"2": { "patterns": [{ "include": "#comment-line" }] }
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"utterance-semicolon": {
|
|
103
|
+
"comment": "utt[ -args];[cmt]",
|
|
104
|
+
"match": "^(?!(?:say|changeBg|changeFigure|bgm|playVideo|pixiPerform|pixiInit|intro|miniAvatar|changeScene|choose|end|setComplexAnimation|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|filmMode|setTextbox|setAnimation|playEffect|setTempAnimation|setTransform|setTransition|getUserInput|applyStyle|wait)\\;)([^\\:\\;\\n]+?)($|\\;.*?$)",
|
|
105
|
+
"captures": {
|
|
106
|
+
"1": { "patterns": [{ "include": "#utterance" }] },
|
|
107
|
+
"2": { "patterns": [{ "include": "#comment-line" }] }
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"statement": { "patterns": [
|
|
111
|
+
{ "include": "#character-colon" },
|
|
112
|
+
{ "include": "#command-colon" },
|
|
113
|
+
{ "include": "#command-semicolon" },
|
|
114
|
+
{ "include": "#utterance-semicolon" }
|
|
115
|
+
] }
|
|
116
|
+
},
|
|
117
|
+
scopeName: "source.webgal"
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region syntaxes/webgal-config.tmLanguage.json
|
|
122
|
+
var webgal_config_tmLanguage_default = {
|
|
123
|
+
$schema: "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
|
124
|
+
name: "WebGAL Config",
|
|
125
|
+
patterns: [{ "include": "#comment-line" }, { "include": "#statement" }],
|
|
126
|
+
repository: {
|
|
127
|
+
"command": {
|
|
128
|
+
"match": ".+",
|
|
129
|
+
"name": "markup.quote.webgal-config"
|
|
130
|
+
},
|
|
131
|
+
"comment-line": {
|
|
132
|
+
"match": "\\;.*?$",
|
|
133
|
+
"name": "comment.line.webgal-config"
|
|
134
|
+
},
|
|
135
|
+
"operator": {
|
|
136
|
+
"match": "[\\:\\=\\<\\>\\|\\+\\-]",
|
|
137
|
+
"name": "keyword.operator.webgal-config"
|
|
138
|
+
},
|
|
139
|
+
"parameter": {
|
|
140
|
+
"match": ".+",
|
|
141
|
+
"name": "variable.other.webgal-config"
|
|
142
|
+
},
|
|
143
|
+
"command-colon": {
|
|
144
|
+
"comment": "cmd:[arg][;cmt]",
|
|
145
|
+
"match": "^(Game_Logo|Game_key|Game_name|Textbox_theme|Title_bgm|Title_img|Enable_Appreciation|Default_Language|Show_panic|Legacy_Expression_Blend_Mode)(\\:)([^\\;\\n]*?)($|\\;.*?$)",
|
|
146
|
+
"captures": {
|
|
147
|
+
"1": { "patterns": [{ "include": "#command" }] },
|
|
148
|
+
"2": { "patterns": [{ "include": "#operator" }] },
|
|
149
|
+
"3": { "patterns": [{ "include": "#parameter" }] },
|
|
150
|
+
"4": { "patterns": [{ "include": "#comment-line" }] }
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"statement": { "patterns": [{ "include": "#command-colon" }] }
|
|
154
|
+
},
|
|
155
|
+
scopeName: "source.webgal-config"
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
//#endregion
|
|
159
|
+
//#region syntaxes/language-configuration.json
|
|
160
|
+
var language_configuration_default = {
|
|
161
|
+
comments: { "lineComment": { "comment": ";" } },
|
|
162
|
+
autoClosingPairs: [
|
|
163
|
+
{
|
|
164
|
+
"open": "{",
|
|
165
|
+
"close": "}"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"open": "[",
|
|
169
|
+
"close": "]"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"open": "(",
|
|
173
|
+
"close": ")"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"open": "'",
|
|
177
|
+
"close": "'",
|
|
178
|
+
"notIn": ["string", "comment"]
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"open": "\"",
|
|
182
|
+
"close": "\"",
|
|
183
|
+
"notIn": ["string"]
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"open": "`",
|
|
187
|
+
"close": "`",
|
|
188
|
+
"notIn": ["string", "comment"]
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"open": ":",
|
|
192
|
+
"close": ";"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"open": ";area",
|
|
196
|
+
"close": ";endarea"
|
|
197
|
+
}
|
|
198
|
+
],
|
|
199
|
+
folding: { "markers": {
|
|
200
|
+
"start": "^\\s*;\\s*area\\b",
|
|
201
|
+
"end": "^\\s*;\\s*endarea\\b"
|
|
202
|
+
} },
|
|
203
|
+
surroundingPairs: [
|
|
204
|
+
["{", "}"],
|
|
205
|
+
["[", "]"],
|
|
206
|
+
["(", ")"],
|
|
207
|
+
["'", "'"],
|
|
208
|
+
["\"", "\""],
|
|
209
|
+
["`", "`"]
|
|
210
|
+
],
|
|
211
|
+
wordPattern: "([^:\\s])+\\.(.[^;\\s])|([^\\`\\~\\!\\@\\#\\%\\^\\&\\*\\(\\)\\-\\=\\+\\[\\{\\]\\}\\\\\\|\\;\\:\\'\\\"\\,\\.\\<\\>\\/\\?\\s]+)"
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
//#endregion
|
|
215
|
+
Object.defineProperty(exports, 'language_configuration_default', {
|
|
216
|
+
enumerable: true,
|
|
217
|
+
get: function () {
|
|
218
|
+
return language_configuration_default;
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
Object.defineProperty(exports, 'webgal_config_tmLanguage_default', {
|
|
222
|
+
enumerable: true,
|
|
223
|
+
get: function () {
|
|
224
|
+
return webgal_config_tmLanguage_default;
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
Object.defineProperty(exports, 'webgal_tmLanguage_default', {
|
|
228
|
+
enumerable: true,
|
|
229
|
+
get: function () {
|
|
230
|
+
return webgal_tmLanguage_default;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
3
|
+
const require_syntaxes = require('./syntaxes.cjs');
|
|
4
|
+
const require_themes = require('./themes.cjs');
|
|
5
|
+
let _codingame_monaco_vscode_api = require("@codingame/monaco-vscode-api");
|
|
6
|
+
let _codingame_monaco_vscode_api_extensions = require("@codingame/monaco-vscode-api/extensions");
|
|
7
|
+
require("vscode/localExtensionHost");
|
|
8
|
+
let _codingame_monaco_vscode_languages_service_override = require("@codingame/monaco-vscode-languages-service-override");
|
|
9
|
+
_codingame_monaco_vscode_languages_service_override = require_chunk.__toESM(_codingame_monaco_vscode_languages_service_override);
|
|
10
|
+
let _codingame_monaco_vscode_theme_service_override = require("@codingame/monaco-vscode-theme-service-override");
|
|
11
|
+
_codingame_monaco_vscode_theme_service_override = require_chunk.__toESM(_codingame_monaco_vscode_theme_service_override);
|
|
12
|
+
let _codingame_monaco_vscode_textmate_service_override = require("@codingame/monaco-vscode-textmate-service-override");
|
|
13
|
+
_codingame_monaco_vscode_textmate_service_override = require_chunk.__toESM(_codingame_monaco_vscode_textmate_service_override);
|
|
14
|
+
|
|
15
|
+
//#region src/monaco-init.ts
|
|
16
|
+
const workerLoaders = {
|
|
17
|
+
TextEditorWorker: () => new Worker(new URL("monaco-editor/esm/vs/editor/editor.worker.js", require("url").pathToFileURL(__filename).href).href, { type: "module" }),
|
|
18
|
+
TextMateWorker: () => new Worker(new URL("@codingame/monaco-vscode-textmate-service-override/worker", require("url").pathToFileURL(__filename).href).href, { type: "module" })
|
|
19
|
+
};
|
|
20
|
+
let initPromise = null;
|
|
21
|
+
async function initWebgalMonaco() {
|
|
22
|
+
if (initPromise) return initPromise;
|
|
23
|
+
initPromise = (async () => {
|
|
24
|
+
const { registerFileUrl } = (0, _codingame_monaco_vscode_api_extensions.registerExtension)({
|
|
25
|
+
name: "webgal",
|
|
26
|
+
publisher: "openwebgal",
|
|
27
|
+
version: "1.0.0",
|
|
28
|
+
engines: { vscode: "^1.0.0" },
|
|
29
|
+
activationEvents: ["onLanguage:webgal", "onLanguage:webgal-config"],
|
|
30
|
+
contributes: {
|
|
31
|
+
languages: [{
|
|
32
|
+
id: "webgal",
|
|
33
|
+
extensions: [".webgal"],
|
|
34
|
+
aliases: ["WebGAL"],
|
|
35
|
+
configuration: "./language-configuration.json"
|
|
36
|
+
}, {
|
|
37
|
+
id: "webgal-config",
|
|
38
|
+
extensions: [".webgal-config"],
|
|
39
|
+
aliases: ["WebGAL Config"]
|
|
40
|
+
}],
|
|
41
|
+
grammars: [{
|
|
42
|
+
language: "webgal",
|
|
43
|
+
scopeName: "source.webgal",
|
|
44
|
+
path: "./webgal.tmLanguage.json"
|
|
45
|
+
}, {
|
|
46
|
+
language: "webgal-config",
|
|
47
|
+
scopeName: "source.webgal-config",
|
|
48
|
+
path: "./webgal-config.tmLanguage.json"
|
|
49
|
+
}],
|
|
50
|
+
themes: [{
|
|
51
|
+
id: "webgal-dark",
|
|
52
|
+
label: "WebGAL Dark",
|
|
53
|
+
uiTheme: "vs-dark",
|
|
54
|
+
path: "./dark.json"
|
|
55
|
+
}, {
|
|
56
|
+
id: "webgal-white",
|
|
57
|
+
label: "WebGAL White",
|
|
58
|
+
uiTheme: "vs",
|
|
59
|
+
path: "./white.json"
|
|
60
|
+
}]
|
|
61
|
+
}
|
|
62
|
+
}, _codingame_monaco_vscode_api_extensions.ExtensionHostKind.LocalProcess);
|
|
63
|
+
registerFileUrl("./webgal.tmLanguage.json", new URL("data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(require_syntaxes.webgalGrammar)))), require("url").pathToFileURL(__filename).href).href);
|
|
64
|
+
registerFileUrl("./webgal-config.tmLanguage.json", new URL("data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(require_syntaxes.webgalConfigGrammar)))), require("url").pathToFileURL(__filename).href).href);
|
|
65
|
+
registerFileUrl("./language-configuration.json", new URL("data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(require_syntaxes.webgalLanguageConfiguration)))), require("url").pathToFileURL(__filename).href).href);
|
|
66
|
+
registerFileUrl("./dark.json", new URL("data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(require_themes.webgalDarkTheme)))), require("url").pathToFileURL(__filename).href).href);
|
|
67
|
+
registerFileUrl("./white.json", new URL("data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(require_themes.webgalWhiteTheme)))), require("url").pathToFileURL(__filename).href).href);
|
|
68
|
+
window.MonacoEnvironment = { getWorker: function(_moduleId, label) {
|
|
69
|
+
const workerFactory = workerLoaders[label];
|
|
70
|
+
if (workerFactory !== null) return workerFactory();
|
|
71
|
+
throw new Error(`Worker ${label} not found`);
|
|
72
|
+
} };
|
|
73
|
+
await (0, _codingame_monaco_vscode_api.initialize)({
|
|
74
|
+
...(0, _codingame_monaco_vscode_textmate_service_override.default)(),
|
|
75
|
+
...(0, _codingame_monaco_vscode_theme_service_override.default)(),
|
|
76
|
+
...(0, _codingame_monaco_vscode_languages_service_override.default)()
|
|
77
|
+
});
|
|
78
|
+
})();
|
|
79
|
+
return initPromise;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
exports.initWebgalMonaco = initWebgalMonaco;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { webgalConfigGrammar, webgalGrammar, webgalLanguageConfiguration } from "./syntaxes.mjs";
|
|
2
|
+
import { webgalDarkTheme, webgalWhiteTheme } from "./themes.mjs";
|
|
3
|
+
import { initialize } from "@codingame/monaco-vscode-api";
|
|
4
|
+
import { ExtensionHostKind, registerExtension } from "@codingame/monaco-vscode-api/extensions";
|
|
5
|
+
import "vscode/localExtensionHost";
|
|
6
|
+
import getLanguagesServiceOverride from "@codingame/monaco-vscode-languages-service-override";
|
|
7
|
+
import getThemeServiceOverride from "@codingame/monaco-vscode-theme-service-override";
|
|
8
|
+
import getTextMateServiceOverride from "@codingame/monaco-vscode-textmate-service-override";
|
|
9
|
+
|
|
10
|
+
//#region src/monaco-init.ts
|
|
11
|
+
const workerLoaders = {
|
|
12
|
+
TextEditorWorker: () => new Worker(new URL("monaco-editor/esm/vs/editor/editor.worker.js", import.meta.url).href, { type: "module" }),
|
|
13
|
+
TextMateWorker: () => new Worker(new URL("@codingame/monaco-vscode-textmate-service-override/worker", import.meta.url).href, { type: "module" })
|
|
14
|
+
};
|
|
15
|
+
let initPromise = null;
|
|
16
|
+
async function initWebgalMonaco() {
|
|
17
|
+
if (initPromise) return initPromise;
|
|
18
|
+
initPromise = (async () => {
|
|
19
|
+
const { registerFileUrl } = registerExtension({
|
|
20
|
+
name: "webgal",
|
|
21
|
+
publisher: "openwebgal",
|
|
22
|
+
version: "1.0.0",
|
|
23
|
+
engines: { vscode: "^1.0.0" },
|
|
24
|
+
activationEvents: ["onLanguage:webgal", "onLanguage:webgal-config"],
|
|
25
|
+
contributes: {
|
|
26
|
+
languages: [{
|
|
27
|
+
id: "webgal",
|
|
28
|
+
extensions: [".webgal"],
|
|
29
|
+
aliases: ["WebGAL"],
|
|
30
|
+
configuration: "./language-configuration.json"
|
|
31
|
+
}, {
|
|
32
|
+
id: "webgal-config",
|
|
33
|
+
extensions: [".webgal-config"],
|
|
34
|
+
aliases: ["WebGAL Config"]
|
|
35
|
+
}],
|
|
36
|
+
grammars: [{
|
|
37
|
+
language: "webgal",
|
|
38
|
+
scopeName: "source.webgal",
|
|
39
|
+
path: "./webgal.tmLanguage.json"
|
|
40
|
+
}, {
|
|
41
|
+
language: "webgal-config",
|
|
42
|
+
scopeName: "source.webgal-config",
|
|
43
|
+
path: "./webgal-config.tmLanguage.json"
|
|
44
|
+
}],
|
|
45
|
+
themes: [{
|
|
46
|
+
id: "webgal-dark",
|
|
47
|
+
label: "WebGAL Dark",
|
|
48
|
+
uiTheme: "vs-dark",
|
|
49
|
+
path: "./dark.json"
|
|
50
|
+
}, {
|
|
51
|
+
id: "webgal-white",
|
|
52
|
+
label: "WebGAL White",
|
|
53
|
+
uiTheme: "vs",
|
|
54
|
+
path: "./white.json"
|
|
55
|
+
}]
|
|
56
|
+
}
|
|
57
|
+
}, ExtensionHostKind.LocalProcess);
|
|
58
|
+
registerFileUrl("./webgal.tmLanguage.json", new URL("data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(webgalGrammar)))), import.meta.url).href);
|
|
59
|
+
registerFileUrl("./webgal-config.tmLanguage.json", new URL("data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(webgalConfigGrammar)))), import.meta.url).href);
|
|
60
|
+
registerFileUrl("./language-configuration.json", new URL("data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(webgalLanguageConfiguration)))), import.meta.url).href);
|
|
61
|
+
registerFileUrl("./dark.json", new URL("data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(webgalDarkTheme)))), import.meta.url).href);
|
|
62
|
+
registerFileUrl("./white.json", new URL("data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(webgalWhiteTheme)))), import.meta.url).href);
|
|
63
|
+
window.MonacoEnvironment = { getWorker: function(_moduleId, label) {
|
|
64
|
+
const workerFactory = workerLoaders[label];
|
|
65
|
+
if (workerFactory !== null) return workerFactory();
|
|
66
|
+
throw new Error(`Worker ${label} not found`);
|
|
67
|
+
} };
|
|
68
|
+
await initialize({
|
|
69
|
+
...getTextMateServiceOverride(),
|
|
70
|
+
...getThemeServiceOverride(),
|
|
71
|
+
...getLanguagesServiceOverride()
|
|
72
|
+
});
|
|
73
|
+
})();
|
|
74
|
+
return initPromise;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { initWebgalMonaco };
|
package/build/monaco.cjs
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
3
|
+
const require_index = require('./index.cjs');
|
|
4
|
+
let vscode_ws_jsonrpc = require("vscode-ws-jsonrpc");
|
|
5
|
+
let vscode_languageclient_browser_js = require("vscode-languageclient/browser.js");
|
|
6
|
+
let monaco_languageclient = require("monaco-languageclient");
|
|
7
|
+
|
|
8
|
+
//#region src/monaco.ts
|
|
9
|
+
const createWebgalMonacoLanguageClient = (options) => {
|
|
10
|
+
const { languageServerUrl, editor } = options;
|
|
11
|
+
const editorInstance = editor;
|
|
12
|
+
const vfs = options.virtualFileSystem || require_index.createMemoryFileSystem({ root: "file:///game" });
|
|
13
|
+
if (!options.virtualFileSystem) {
|
|
14
|
+
vfs.writeFile("file:///game/scene/start.txt", "WebGal:Start;");
|
|
15
|
+
vfs.writeFile("file:///game/config.txt", "");
|
|
16
|
+
}
|
|
17
|
+
const webSocket = new WebSocket(languageServerUrl);
|
|
18
|
+
webSocket.onopen = () => {
|
|
19
|
+
const socket = (0, vscode_ws_jsonrpc.toSocket)(webSocket);
|
|
20
|
+
const reader = new vscode_ws_jsonrpc.WebSocketMessageReader(socket);
|
|
21
|
+
const languageClient = createLanguageClient({
|
|
22
|
+
reader,
|
|
23
|
+
writer: new vscode_ws_jsonrpc.WebSocketMessageWriter(socket)
|
|
24
|
+
}, {
|
|
25
|
+
editor: editorInstance,
|
|
26
|
+
vfs
|
|
27
|
+
});
|
|
28
|
+
languageClient.start();
|
|
29
|
+
reader.onClose(() => languageClient.stop());
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
webSocket,
|
|
33
|
+
vfs
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
const createWebgalMonacoLanguageClientWithWorker = (options) => {
|
|
37
|
+
const { worker, editor } = options;
|
|
38
|
+
const editorInstance = editor;
|
|
39
|
+
const vfs = options.virtualFileSystem || require_index.createMemoryFileSystem({ root: "file:///game" });
|
|
40
|
+
if (!options.virtualFileSystem) {
|
|
41
|
+
vfs.writeFile("file:///game/scene/start.txt", "WebGal:Start;");
|
|
42
|
+
vfs.writeFile("file:///game/config.txt", "");
|
|
43
|
+
}
|
|
44
|
+
const languageClient = createLanguageClient({
|
|
45
|
+
reader: new vscode_languageclient_browser_js.BrowserMessageReader(worker),
|
|
46
|
+
writer: new vscode_languageclient_browser_js.BrowserMessageWriter(worker)
|
|
47
|
+
}, {
|
|
48
|
+
editor: editorInstance,
|
|
49
|
+
vfs
|
|
50
|
+
});
|
|
51
|
+
languageClient.start();
|
|
52
|
+
worker.onerror = () => languageClient.stop();
|
|
53
|
+
worker.onmessageerror = () => languageClient.stop();
|
|
54
|
+
return {
|
|
55
|
+
worker,
|
|
56
|
+
vfs
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
const createWebgalMonacoLanguageClientWithPort = (options) => {
|
|
60
|
+
const { port, editor } = options;
|
|
61
|
+
const editorInstance = editor;
|
|
62
|
+
const vfs = options.virtualFileSystem || require_index.createMemoryFileSystem({ root: "file:///game" });
|
|
63
|
+
if (!options.virtualFileSystem) {
|
|
64
|
+
vfs.writeFile("file:///game/scene/start.txt", "WebGal:Start;");
|
|
65
|
+
vfs.writeFile("file:///game/config.txt", "");
|
|
66
|
+
}
|
|
67
|
+
const languageClient = createLanguageClient({
|
|
68
|
+
reader: new vscode_languageclient_browser_js.BrowserMessageReader(port),
|
|
69
|
+
writer: new vscode_languageclient_browser_js.BrowserMessageWriter(port)
|
|
70
|
+
}, {
|
|
71
|
+
editor: editorInstance,
|
|
72
|
+
vfs
|
|
73
|
+
});
|
|
74
|
+
languageClient.start();
|
|
75
|
+
port.onmessageerror = () => languageClient.stop();
|
|
76
|
+
return {
|
|
77
|
+
port,
|
|
78
|
+
vfs
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const createLanguageClient = (messageTransports, options) => {
|
|
82
|
+
const handlers = require_index.createWebgalClientHandlers({
|
|
83
|
+
vfs: options.vfs,
|
|
84
|
+
overrides: { "client/showTip": function(message) {
|
|
85
|
+
console.log(message);
|
|
86
|
+
} }
|
|
87
|
+
});
|
|
88
|
+
const client = new monaco_languageclient.MonacoLanguageClient({
|
|
89
|
+
name: "WebGAL Language Client",
|
|
90
|
+
clientOptions: {
|
|
91
|
+
documentSelector: [
|
|
92
|
+
{
|
|
93
|
+
scheme: "file",
|
|
94
|
+
language: "webgal"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
scheme: "file",
|
|
98
|
+
language: "webgal-config"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
scheme: "inmemory",
|
|
102
|
+
language: "webgal"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
scheme: "inmemory",
|
|
106
|
+
language: "webgal-config"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
errorHandler: {
|
|
110
|
+
error: () => ({ action: vscode_languageclient_browser_js.ErrorAction.Continue }),
|
|
111
|
+
closed: () => ({ action: vscode_languageclient_browser_js.CloseAction.DoNotRestart })
|
|
112
|
+
},
|
|
113
|
+
synchronize: { configurationSection: ["webgal", "http"] },
|
|
114
|
+
initializationOptions() {
|
|
115
|
+
const model = options.editor.getModel();
|
|
116
|
+
return {
|
|
117
|
+
processId: Math.random(),
|
|
118
|
+
rootPath: "file:///game",
|
|
119
|
+
rootUri: "file:///game",
|
|
120
|
+
capabilities: {},
|
|
121
|
+
workspaceFolders: [{
|
|
122
|
+
uri: "file:///game",
|
|
123
|
+
name: "example"
|
|
124
|
+
}],
|
|
125
|
+
...model ? { textDocument: { uri: model.uri.toString() } } : {}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
messageTransports
|
|
130
|
+
});
|
|
131
|
+
require_index.registerWebgalClientHandlers(client, handlers);
|
|
132
|
+
return client;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
//#endregion
|
|
136
|
+
exports.createWebgalMonacoLanguageClient = createWebgalMonacoLanguageClient;
|
|
137
|
+
exports.createWebgalMonacoLanguageClientWithPort = createWebgalMonacoLanguageClientWithPort;
|
|
138
|
+
exports.createWebgalMonacoLanguageClientWithWorker = createWebgalMonacoLanguageClientWithWorker;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createMemoryFileSystem } from "./index.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/monaco.d.ts
|
|
4
|
+
interface CreateWebgalMonacoLanguageClientOptions {
|
|
5
|
+
languageServerUrl: string;
|
|
6
|
+
editor: any;
|
|
7
|
+
virtualFileSystem?: ReturnType<typeof createMemoryFileSystem>;
|
|
8
|
+
}
|
|
9
|
+
declare const createWebgalMonacoLanguageClient: (options: CreateWebgalMonacoLanguageClientOptions) => {
|
|
10
|
+
webSocket: WebSocket;
|
|
11
|
+
vfs: ReturnType<typeof createMemoryFileSystem>;
|
|
12
|
+
};
|
|
13
|
+
interface CreateWebgalMonacoLanguageClientWorkerOptions {
|
|
14
|
+
editor: any;
|
|
15
|
+
worker: Worker;
|
|
16
|
+
virtualFileSystem?: ReturnType<typeof createMemoryFileSystem>;
|
|
17
|
+
}
|
|
18
|
+
declare const createWebgalMonacoLanguageClientWithWorker: (options: CreateWebgalMonacoLanguageClientWorkerOptions) => {
|
|
19
|
+
worker: Worker;
|
|
20
|
+
vfs: ReturnType<typeof createMemoryFileSystem>;
|
|
21
|
+
};
|
|
22
|
+
interface CreateWebgalMonacoLanguageClientPortOptions {
|
|
23
|
+
editor: any;
|
|
24
|
+
port: MessagePort;
|
|
25
|
+
virtualFileSystem?: ReturnType<typeof createMemoryFileSystem>;
|
|
26
|
+
}
|
|
27
|
+
declare const createWebgalMonacoLanguageClientWithPort: (options: CreateWebgalMonacoLanguageClientPortOptions) => {
|
|
28
|
+
port: MessagePort;
|
|
29
|
+
vfs: ReturnType<typeof createMemoryFileSystem>;
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { CreateWebgalMonacoLanguageClientOptions, CreateWebgalMonacoLanguageClientPortOptions, CreateWebgalMonacoLanguageClientWorkerOptions, createWebgalMonacoLanguageClient, createWebgalMonacoLanguageClientWithPort, createWebgalMonacoLanguageClientWithWorker };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createMemoryFileSystem } from "./index.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/monaco.d.ts
|
|
4
|
+
interface CreateWebgalMonacoLanguageClientOptions {
|
|
5
|
+
languageServerUrl: string;
|
|
6
|
+
editor: any;
|
|
7
|
+
virtualFileSystem?: ReturnType<typeof createMemoryFileSystem>;
|
|
8
|
+
}
|
|
9
|
+
declare const createWebgalMonacoLanguageClient: (options: CreateWebgalMonacoLanguageClientOptions) => {
|
|
10
|
+
webSocket: WebSocket;
|
|
11
|
+
vfs: ReturnType<typeof createMemoryFileSystem>;
|
|
12
|
+
};
|
|
13
|
+
interface CreateWebgalMonacoLanguageClientWorkerOptions {
|
|
14
|
+
editor: any;
|
|
15
|
+
worker: Worker;
|
|
16
|
+
virtualFileSystem?: ReturnType<typeof createMemoryFileSystem>;
|
|
17
|
+
}
|
|
18
|
+
declare const createWebgalMonacoLanguageClientWithWorker: (options: CreateWebgalMonacoLanguageClientWorkerOptions) => {
|
|
19
|
+
worker: Worker;
|
|
20
|
+
vfs: ReturnType<typeof createMemoryFileSystem>;
|
|
21
|
+
};
|
|
22
|
+
interface CreateWebgalMonacoLanguageClientPortOptions {
|
|
23
|
+
editor: any;
|
|
24
|
+
port: MessagePort;
|
|
25
|
+
virtualFileSystem?: ReturnType<typeof createMemoryFileSystem>;
|
|
26
|
+
}
|
|
27
|
+
declare const createWebgalMonacoLanguageClientWithPort: (options: CreateWebgalMonacoLanguageClientPortOptions) => {
|
|
28
|
+
port: MessagePort;
|
|
29
|
+
vfs: ReturnType<typeof createMemoryFileSystem>;
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { CreateWebgalMonacoLanguageClientOptions, CreateWebgalMonacoLanguageClientPortOptions, CreateWebgalMonacoLanguageClientWorkerOptions, createWebgalMonacoLanguageClient, createWebgalMonacoLanguageClientWithPort, createWebgalMonacoLanguageClientWithWorker };
|