modern-monaco 0.1.7 → 0.1.9
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/dist/core.js +210 -198
- package/dist/index.js +11 -9
- package/dist/shiki-wasm.js +1 -1
- package/dist/shiki.js +8 -8
- package/package.json +5 -5
- package/types/core.d.ts +6 -3
package/dist/core.js
CHANGED
|
@@ -83,75 +83,75 @@ var editorProps = [
|
|
|
83
83
|
var errors = {
|
|
84
84
|
NotFound: ErrorNotFound
|
|
85
85
|
};
|
|
86
|
-
var
|
|
87
|
-
var
|
|
86
|
+
var syntaxes = [];
|
|
87
|
+
var lspProviders = {};
|
|
88
|
+
var { promise: editorWorkerPromise, resolve: onDidEditorWorkerResolve } = promiseWithResolvers();
|
|
89
|
+
var attr = (el, name) => el.getAttribute(name);
|
|
90
|
+
var style = (el, style2) => Object.assign(el.style, style2);
|
|
88
91
|
async function init(options) {
|
|
89
|
-
const langs = (options?.langs ?? []).concat(
|
|
92
|
+
const langs = (options?.langs ?? []).concat(syntaxes);
|
|
90
93
|
const hightlighter = await initShiki({ ...options, langs });
|
|
91
94
|
return loadMonaco(hightlighter, options?.workspace, options?.lsp);
|
|
92
95
|
}
|
|
93
|
-
async function lazy(options
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
value = void 0;
|
|
96
|
+
async function lazy(options) {
|
|
97
|
+
if (!customElements.get("monaco-editor")) {
|
|
98
|
+
let monacoPromise = null;
|
|
99
|
+
customElements.define(
|
|
100
|
+
"monaco-editor",
|
|
101
|
+
class extends HTMLElement {
|
|
102
|
+
async connectedCallback() {
|
|
103
|
+
const workspace = options?.workspace;
|
|
104
|
+
const renderOptions = {};
|
|
105
|
+
for (const attrName of this.getAttributeNames()) {
|
|
106
|
+
const key = editorProps.find((k) => k.toLowerCase() === attrName);
|
|
107
|
+
if (key) {
|
|
108
|
+
let value = attr(this, attrName);
|
|
109
|
+
if (value === "") {
|
|
110
|
+
value = key === "minimap" || key === "stickyScroll" ? { enabled: true } : true;
|
|
111
|
+
} else {
|
|
112
|
+
value = value.trim();
|
|
113
|
+
if (value === "true") {
|
|
114
|
+
value = true;
|
|
115
|
+
} else if (value === "false") {
|
|
116
|
+
value = false;
|
|
117
|
+
} else if (value === "null") {
|
|
118
|
+
value = null;
|
|
119
|
+
} else if (/^\d+$/.test(value)) {
|
|
120
|
+
value = Number(value);
|
|
121
|
+
} else if (/^\{.+\}$/.test(value)) {
|
|
122
|
+
try {
|
|
123
|
+
value = JSON.parse(value);
|
|
124
|
+
} catch (error) {
|
|
125
|
+
value = void 0;
|
|
126
|
+
}
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
if (key === "padding") {
|
|
130
|
+
if (typeof value === "number") {
|
|
131
|
+
value = { top: value, bottom: value };
|
|
132
|
+
} else if (/^\d+\s+\d+$/.test(value)) {
|
|
133
|
+
const [top, bottom] = value.split(/\s+/);
|
|
134
|
+
if (top && bottom) {
|
|
135
|
+
value = { top: Number(top), bottom: Number(bottom) };
|
|
136
|
+
}
|
|
137
|
+
} else {
|
|
138
|
+
value = void 0;
|
|
135
139
|
}
|
|
136
|
-
} else {
|
|
137
|
-
value = void 0;
|
|
138
140
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
if (key === "wordWrap" && (value === "on" || value === true)) {
|
|
142
|
+
value = "on";
|
|
143
|
+
}
|
|
144
|
+
if (value !== void 0) {
|
|
145
|
+
renderOptions[key] = value;
|
|
146
|
+
}
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const optionsEl = this.children[0];
|
|
152
|
-
if (optionsEl && optionsEl.tagName === "SCRIPT" && optionsEl.className === "monaco-editor-options") {
|
|
149
|
+
let filename;
|
|
150
|
+
let code;
|
|
151
|
+
const firstEl = this.firstElementChild;
|
|
152
|
+
if (firstEl && firstEl.tagName === "SCRIPT" && firstEl.className === "monaco-editor-options") {
|
|
153
153
|
try {
|
|
154
|
-
const v = JSON.parse(
|
|
154
|
+
const v = JSON.parse(firstEl.textContent);
|
|
155
155
|
if (Array.isArray(v) && v.length === 2) {
|
|
156
156
|
const [input, opts] = v;
|
|
157
157
|
Object.assign(renderOptions, opts);
|
|
@@ -167,166 +167,178 @@ async function lazy(options, hydrate2) {
|
|
|
167
167
|
}
|
|
168
168
|
} catch {
|
|
169
169
|
}
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
setStyle(this, { display: "block", position: "relative" });
|
|
174
|
-
let widthAttr = getAttr(this, "width");
|
|
175
|
-
let heightAttr = getAttr(this, "height");
|
|
176
|
-
if (isDigital(widthAttr) && isDigital(heightAttr)) {
|
|
177
|
-
const width = Number(widthAttr);
|
|
178
|
-
const height = Number(heightAttr);
|
|
179
|
-
setStyle(this, { width: width + "px", height: height + "px" });
|
|
180
|
-
renderOptions.dimension = { width, height };
|
|
181
|
-
} else {
|
|
182
|
-
if (isDigital(widthAttr)) {
|
|
183
|
-
widthAttr += "px";
|
|
170
|
+
firstEl.remove();
|
|
184
171
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
setStyle(containerEl, { width: "100%", height: "100%" });
|
|
194
|
-
this.appendChild(containerEl);
|
|
195
|
-
if (!filename && workspace) {
|
|
196
|
-
if (workspace.history.state.current) {
|
|
197
|
-
filename = workspace.history.state.current;
|
|
198
|
-
} else if (workspace.entryFile) {
|
|
199
|
-
filename = workspace.entryFile;
|
|
200
|
-
workspace.history.replace(filename);
|
|
172
|
+
style(this, { display: "block", position: "relative" });
|
|
173
|
+
let widthAttr = attr(this, "width");
|
|
174
|
+
let heightAttr = attr(this, "height");
|
|
175
|
+
if (isDigital(widthAttr) && isDigital(heightAttr)) {
|
|
176
|
+
const width = Number(widthAttr);
|
|
177
|
+
const height = Number(heightAttr);
|
|
178
|
+
style(this, { width: width + "px", height: height + "px" });
|
|
179
|
+
renderOptions.dimension = { width, height };
|
|
201
180
|
} else {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (filename) {
|
|
205
|
-
workspace.history.replace(filename);
|
|
181
|
+
if (isDigital(widthAttr)) {
|
|
182
|
+
widthAttr += "px";
|
|
206
183
|
}
|
|
184
|
+
if (isDigital(heightAttr)) {
|
|
185
|
+
heightAttr += "px";
|
|
186
|
+
}
|
|
187
|
+
this.style.width ||= widthAttr ?? "100%";
|
|
188
|
+
this.style.height ||= heightAttr ?? "100%";
|
|
207
189
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (!
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
219
|
-
const highlighter = await initShiki({
|
|
220
|
-
...options,
|
|
221
|
-
theme: renderOptions.theme ?? options?.theme,
|
|
222
|
-
langs
|
|
223
|
-
});
|
|
224
|
-
let prerenderEl = hydrate2 ? this.querySelector(".monaco-editor-prerender") : void 0;
|
|
225
|
-
if (!prerenderEl && filename && workspace) {
|
|
226
|
-
try {
|
|
227
|
-
const code2 = await workspace.fs.readFile(filename);
|
|
228
|
-
const language = getLanguageIdFromPath(filename);
|
|
229
|
-
prerenderEl = containerEl.cloneNode(true);
|
|
230
|
-
prerenderEl.className = "monaco-editor-prerender";
|
|
231
|
-
prerenderEl.innerHTML = render(highlighter, decode(code2), { ...renderOptions, language });
|
|
232
|
-
} catch (error) {
|
|
233
|
-
if (error instanceof ErrorNotFound) {
|
|
190
|
+
const containerEl = document.createElement("div");
|
|
191
|
+
containerEl.className = "monaco-editor-container";
|
|
192
|
+
style(containerEl, { width: "100%", height: "100%" });
|
|
193
|
+
this.appendChild(containerEl);
|
|
194
|
+
if (!filename && workspace) {
|
|
195
|
+
if (workspace.history.state.current) {
|
|
196
|
+
filename = workspace.history.state.current;
|
|
197
|
+
} else if (workspace.entryFile) {
|
|
198
|
+
filename = workspace.entryFile;
|
|
199
|
+
workspace.history.replace(filename);
|
|
234
200
|
} else {
|
|
235
|
-
|
|
201
|
+
const rootFiles = (await workspace.fs.readDirectory("/")).filter(([name, type]) => type === 1).map(([name]) => name);
|
|
202
|
+
filename = rootFiles.includes("index.html") ? "index.html" : rootFiles[0];
|
|
203
|
+
if (filename) {
|
|
204
|
+
workspace.history.replace(filename);
|
|
205
|
+
}
|
|
236
206
|
}
|
|
237
207
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
const viewState = await workspace.viewState.get(filename);
|
|
244
|
-
const scrollTop = viewState?.viewState.scrollTop ?? 0;
|
|
245
|
-
if (scrollTop) {
|
|
246
|
-
const mockEl = prerenderEl.querySelector(".mock-monaco-editor");
|
|
247
|
-
if (mockEl) {
|
|
248
|
-
mockEl.scrollTop = scrollTop;
|
|
249
|
-
}
|
|
208
|
+
const langs = (options?.langs ?? []).concat(syntaxes);
|
|
209
|
+
if (renderOptions.language || filename) {
|
|
210
|
+
const lang = renderOptions.language ?? getLanguageIdFromPath(filename) ?? "plaintext";
|
|
211
|
+
if (!syntaxes.find((s) => s.name === lang)) {
|
|
212
|
+
langs.push(lang);
|
|
250
213
|
}
|
|
251
214
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const monaco = await (monacoPromise ?? (monacoPromise = loadMonaco(highlighter, workspace, options?.lsp, onDidEditorWorkerResolve)));
|
|
255
|
-
const editor = monaco.editor.create(containerEl, renderOptions);
|
|
256
|
-
if (workspace) {
|
|
257
|
-
const storeViewState = () => {
|
|
258
|
-
const currentModel = editor.getModel();
|
|
259
|
-
if (currentModel?.uri.scheme === "file") {
|
|
260
|
-
const state = editor.saveViewState();
|
|
261
|
-
if (state) {
|
|
262
|
-
state.viewState.scrollTop ??= editor.getScrollTop();
|
|
263
|
-
workspace.viewState.save(currentModel.uri.toString(), Object.freeze(state));
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
editor.onDidChangeCursorSelection(debunce(storeViewState, 500));
|
|
268
|
-
editor.onDidScrollChange(debunce(storeViewState, 500));
|
|
269
|
-
workspace.history.onChange((state) => {
|
|
270
|
-
if (editor.getModel()?.uri.toString() !== state.current) {
|
|
271
|
-
workspace._openTextDocument(state.current, editor);
|
|
272
|
-
}
|
|
273
|
-
});
|
|
215
|
+
if (renderOptions.theme) {
|
|
216
|
+
renderOptions.theme = renderOptions.theme.toLowerCase().replace(/ +/g, "-");
|
|
274
217
|
}
|
|
275
|
-
|
|
218
|
+
const highlighter = await initShiki({
|
|
219
|
+
...options,
|
|
220
|
+
theme: renderOptions.theme ?? options?.theme,
|
|
221
|
+
langs
|
|
222
|
+
});
|
|
223
|
+
let prerenderEl;
|
|
224
|
+
for (const el of this.children) {
|
|
225
|
+
if (el.className === "monaco-editor-prerender") {
|
|
226
|
+
prerenderEl = el;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (!prerenderEl && filename && workspace) {
|
|
276
231
|
try {
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
232
|
+
const code2 = await workspace.fs.readFile(filename);
|
|
233
|
+
const language = getLanguageIdFromPath(filename);
|
|
234
|
+
prerenderEl = containerEl.cloneNode(true);
|
|
235
|
+
prerenderEl.className = "monaco-editor-prerender";
|
|
236
|
+
prerenderEl.innerHTML = render(highlighter, decode(code2), { ...renderOptions, language });
|
|
281
237
|
} catch (error) {
|
|
282
238
|
if (error instanceof ErrorNotFound) {
|
|
283
|
-
if (code) {
|
|
284
|
-
const dirname = filename.split("/").slice(0, -1).join("/");
|
|
285
|
-
if (dirname) {
|
|
286
|
-
await workspace.fs.createDirectory(dirname);
|
|
287
|
-
}
|
|
288
|
-
await workspace.fs.writeFile(filename, code);
|
|
289
|
-
workspace._openTextDocument(filename, editor);
|
|
290
|
-
} else {
|
|
291
|
-
editor.setModel(monaco.editor.createModel(""));
|
|
292
|
-
}
|
|
293
239
|
} else {
|
|
294
240
|
throw error;
|
|
295
241
|
}
|
|
296
242
|
}
|
|
297
|
-
} else if (code && (renderOptions.language || filename)) {
|
|
298
|
-
const model = monaco.editor.createModel(code, renderOptions.language, filename);
|
|
299
|
-
editor.setModel(model);
|
|
300
|
-
} else {
|
|
301
|
-
editor.setModel(monaco.editor.createModel(""));
|
|
302
243
|
}
|
|
303
244
|
if (prerenderEl) {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
245
|
+
style(prerenderEl, { position: "absolute", top: "0", left: "0" });
|
|
246
|
+
this.appendChild(prerenderEl);
|
|
247
|
+
if (filename && workspace) {
|
|
248
|
+
const viewState = await workspace.viewState.get(filename);
|
|
249
|
+
const scrollTop = viewState?.viewState.scrollTop ?? 0;
|
|
250
|
+
if (scrollTop) {
|
|
251
|
+
const mockEl = prerenderEl.querySelector(".mock-monaco-editor");
|
|
252
|
+
if (mockEl) {
|
|
253
|
+
mockEl.scrollTop = scrollTop;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
async function createEditor() {
|
|
259
|
+
const monaco = await (monacoPromise ?? (monacoPromise = loadMonaco(highlighter, workspace, options?.lsp, onDidEditorWorkerResolve)));
|
|
260
|
+
const editor = monaco.editor.create(containerEl, renderOptions);
|
|
261
|
+
if (workspace) {
|
|
262
|
+
const storeViewState = () => {
|
|
263
|
+
const currentModel = editor.getModel();
|
|
264
|
+
if (currentModel?.uri.scheme === "file") {
|
|
265
|
+
const state = editor.saveViewState();
|
|
266
|
+
if (state) {
|
|
267
|
+
state.viewState.scrollTop ??= editor.getScrollTop();
|
|
268
|
+
workspace.viewState.save(currentModel.uri.toString(), Object.freeze(state));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
editor.onDidChangeCursorSelection(debunce(storeViewState, 500));
|
|
273
|
+
editor.onDidScrollChange(debunce(storeViewState, 500));
|
|
274
|
+
workspace.history.onChange((state) => {
|
|
275
|
+
if (editor.getModel()?.uri.toString() !== state.current) {
|
|
276
|
+
workspace._openTextDocument(state.current, editor);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
if (filename && workspace) {
|
|
281
|
+
try {
|
|
282
|
+
const model = await workspace._openTextDocument(filename, editor);
|
|
283
|
+
if (code && code !== model.getValue()) {
|
|
284
|
+
model.setValue(code);
|
|
285
|
+
}
|
|
286
|
+
} catch (error) {
|
|
287
|
+
if (error instanceof ErrorNotFound) {
|
|
288
|
+
if (code) {
|
|
289
|
+
const dirname = filename.split("/").slice(0, -1).join("/");
|
|
290
|
+
if (dirname) {
|
|
291
|
+
await workspace.fs.createDirectory(dirname);
|
|
292
|
+
}
|
|
293
|
+
await workspace.fs.writeFile(filename, code);
|
|
294
|
+
workspace._openTextDocument(filename, editor);
|
|
295
|
+
} else {
|
|
296
|
+
editor.setModel(monaco.editor.createModel(""));
|
|
297
|
+
}
|
|
309
298
|
} else {
|
|
310
|
-
|
|
299
|
+
throw error;
|
|
311
300
|
}
|
|
312
|
-
}
|
|
313
|
-
})
|
|
301
|
+
}
|
|
302
|
+
} else if (code && (renderOptions.language || filename)) {
|
|
303
|
+
const modelUri = filename ? monaco.Uri.file(filename) : void 0;
|
|
304
|
+
let model = modelUri ? monaco.editor.getModel(modelUri) : null;
|
|
305
|
+
if (!model) {
|
|
306
|
+
model = monaco.editor.createModel(code, renderOptions.language, modelUri);
|
|
307
|
+
} else if (code !== model.getValue()) {
|
|
308
|
+
model.setValue(code);
|
|
309
|
+
}
|
|
310
|
+
editor.setModel(model);
|
|
311
|
+
} else {
|
|
312
|
+
editor.setModel(monaco.editor.createModel(""));
|
|
313
|
+
}
|
|
314
|
+
if (prerenderEl) {
|
|
315
|
+
editorWorkerPromise.then(() => {
|
|
316
|
+
setTimeout(() => {
|
|
317
|
+
const animate = prerenderEl.animate?.([{ opacity: 1 }, { opacity: 0 }], { duration: 150 });
|
|
318
|
+
if (animate) {
|
|
319
|
+
animate.finished.then(() => prerenderEl.remove());
|
|
320
|
+
} else {
|
|
321
|
+
setTimeout(() => prerenderEl.remove(), 150);
|
|
322
|
+
}
|
|
323
|
+
}, 100);
|
|
324
|
+
});
|
|
325
|
+
}
|
|
314
326
|
}
|
|
327
|
+
await createEditor();
|
|
315
328
|
}
|
|
316
|
-
await createEditor();
|
|
317
329
|
}
|
|
318
|
-
|
|
319
|
-
|
|
330
|
+
);
|
|
331
|
+
}
|
|
320
332
|
await editorWorkerPromise;
|
|
321
333
|
}
|
|
322
334
|
function hydrate(options) {
|
|
323
|
-
return lazy(options
|
|
335
|
+
return lazy(options);
|
|
324
336
|
}
|
|
325
|
-
async function loadMonaco(highlighter, workspace, lsp,
|
|
337
|
+
async function loadMonaco(highlighter, workspace, lsp, onDidEditorWorkerResolve2) {
|
|
326
338
|
const monaco = await import("./editor-core.js");
|
|
327
|
-
const
|
|
339
|
+
const lspProviderMap = { ...lspProviders, ...lsp?.providers };
|
|
328
340
|
workspace?.setupMonaco(monaco);
|
|
329
|
-
if (Object.keys(
|
|
341
|
+
if (Object.keys(lspProviderMap).length > 0) {
|
|
330
342
|
initLS(monaco);
|
|
331
343
|
}
|
|
332
344
|
if (!document.getElementById("monaco-editor-core-css")) {
|
|
@@ -338,9 +350,9 @@ async function loadMonaco(highlighter, workspace, lsp, onDidEditorWorkerResolve)
|
|
|
338
350
|
}
|
|
339
351
|
Reflect.set(globalThis, "MonacoEnvironment", {
|
|
340
352
|
getWorker: async (_workerId, label) => {
|
|
341
|
-
let provider =
|
|
353
|
+
let provider = lspProviderMap[label];
|
|
342
354
|
if (!provider) {
|
|
343
|
-
provider = Object.values(
|
|
355
|
+
provider = Object.values(lspProviderMap).find((p) => p.aliases?.includes(label));
|
|
344
356
|
}
|
|
345
357
|
const url = provider ? (await provider.import()).getWorkerUrl() : monaco.getWorkerUrl();
|
|
346
358
|
if (label === "typescript") {
|
|
@@ -352,7 +364,7 @@ async function loadMonaco(highlighter, workspace, lsp, onDidEditorWorkerResolve)
|
|
|
352
364
|
const worker = createWebWorker(url, void 0);
|
|
353
365
|
if (!provider) {
|
|
354
366
|
const onMessage = (e) => {
|
|
355
|
-
|
|
367
|
+
onDidEditorWorkerResolve2?.();
|
|
356
368
|
worker.removeEventListener("message", onMessage);
|
|
357
369
|
};
|
|
358
370
|
worker.addEventListener("message", onMessage);
|
|
@@ -432,9 +444,9 @@ async function loadMonaco(highlighter, workspace, lsp, onDidEditorWorkerResolve)
|
|
|
432
444
|
}
|
|
433
445
|
registerShikiMonacoTokenizer(monaco, highlighter, id);
|
|
434
446
|
let lspLabel = id;
|
|
435
|
-
let lspProvider =
|
|
447
|
+
let lspProvider = lspProviderMap[lspLabel];
|
|
436
448
|
if (!lspProvider) {
|
|
437
|
-
const alias = Object.entries(
|
|
449
|
+
const alias = Object.entries(lspProviderMap).find(([, lsp2]) => lsp2.aliases?.includes(id));
|
|
438
450
|
if (alias) {
|
|
439
451
|
[lspLabel, lspProvider] = alias;
|
|
440
452
|
}
|
|
@@ -447,17 +459,17 @@ async function loadMonaco(highlighter, workspace, lsp, onDidEditorWorkerResolve)
|
|
|
447
459
|
initShikiMonacoTokenizer(monaco, highlighter);
|
|
448
460
|
return monaco;
|
|
449
461
|
}
|
|
450
|
-
function
|
|
451
|
-
|
|
452
|
-
}
|
|
453
|
-
function registerSyntax(...syntaxes) {
|
|
454
|
-
builtinSyntaxes.push(...syntaxes);
|
|
462
|
+
function registerSyntax(syntax) {
|
|
463
|
+
syntaxes.push(syntax);
|
|
455
464
|
}
|
|
456
465
|
function registerTheme(theme) {
|
|
457
466
|
if (theme.name) {
|
|
458
467
|
themes.set(theme.name, theme);
|
|
459
468
|
}
|
|
460
469
|
}
|
|
470
|
+
function registerLSPProvider(lang, provider) {
|
|
471
|
+
lspProviders[lang] = provider;
|
|
472
|
+
}
|
|
461
473
|
setDefaultWasmLoader(getWasmInstance);
|
|
462
474
|
export {
|
|
463
475
|
Workspace,
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node_modules/.pnpm/tm-themes@1.10.
|
|
1
|
+
// node_modules/.pnpm/tm-themes@1.10.9/node_modules/tm-themes/themes/vitesse-dark.json
|
|
2
2
|
var vitesse_dark_default = {
|
|
3
3
|
colors: {
|
|
4
4
|
"activityBar.activeBorder": "#4d9375",
|
|
@@ -715,7 +715,7 @@ var builtinLSPProviders = {
|
|
|
715
715
|
}
|
|
716
716
|
};
|
|
717
717
|
|
|
718
|
-
// node_modules/.pnpm/tm-grammars@1.24.
|
|
718
|
+
// node_modules/.pnpm/tm-grammars@1.24.10/node_modules/tm-grammars/grammars/html.json
|
|
719
719
|
var html_default = {
|
|
720
720
|
displayName: "HTML",
|
|
721
721
|
injections: {
|
|
@@ -3344,7 +3344,7 @@ var html_default = {
|
|
|
3344
3344
|
scopeName: "text.html.basic"
|
|
3345
3345
|
};
|
|
3346
3346
|
|
|
3347
|
-
// node_modules/.pnpm/tm-grammars@1.24.
|
|
3347
|
+
// node_modules/.pnpm/tm-grammars@1.24.10/node_modules/tm-grammars/grammars/css.json
|
|
3348
3348
|
var css_default = {
|
|
3349
3349
|
displayName: "CSS",
|
|
3350
3350
|
name: "css",
|
|
@@ -5206,7 +5206,7 @@ var css_default = {
|
|
|
5206
5206
|
scopeName: "source.css"
|
|
5207
5207
|
};
|
|
5208
5208
|
|
|
5209
|
-
// node_modules/.pnpm/tm-grammars@1.24.
|
|
5209
|
+
// node_modules/.pnpm/tm-grammars@1.24.10/node_modules/tm-grammars/grammars/javascript.json
|
|
5210
5210
|
var javascript_default = {
|
|
5211
5211
|
displayName: "JavaScript",
|
|
5212
5212
|
name: "javascript",
|
|
@@ -11204,7 +11204,7 @@ var javascript_default = {
|
|
|
11204
11204
|
scopeName: "source.js"
|
|
11205
11205
|
};
|
|
11206
11206
|
|
|
11207
|
-
// node_modules/.pnpm/tm-grammars@1.24.
|
|
11207
|
+
// node_modules/.pnpm/tm-grammars@1.24.10/node_modules/tm-grammars/grammars/typescript.json
|
|
11208
11208
|
var typescript_default = {
|
|
11209
11209
|
displayName: "TypeScript",
|
|
11210
11210
|
name: "typescript",
|
|
@@ -16953,7 +16953,7 @@ var typescript_default = {
|
|
|
16953
16953
|
scopeName: "source.ts"
|
|
16954
16954
|
};
|
|
16955
16955
|
|
|
16956
|
-
// node_modules/.pnpm/tm-grammars@1.24.
|
|
16956
|
+
// node_modules/.pnpm/tm-grammars@1.24.10/node_modules/tm-grammars/grammars/jsx.json
|
|
16957
16957
|
var jsx_default = {
|
|
16958
16958
|
displayName: "JSX",
|
|
16959
16959
|
name: "jsx",
|
|
@@ -22951,7 +22951,7 @@ var jsx_default = {
|
|
|
22951
22951
|
scopeName: "source.js.jsx"
|
|
22952
22952
|
};
|
|
22953
22953
|
|
|
22954
|
-
// node_modules/.pnpm/tm-grammars@1.24.
|
|
22954
|
+
// node_modules/.pnpm/tm-grammars@1.24.10/node_modules/tm-grammars/grammars/tsx.json
|
|
22955
22955
|
var tsx_default = {
|
|
22956
22956
|
displayName: "TSX",
|
|
22957
22957
|
name: "tsx",
|
|
@@ -28949,7 +28949,7 @@ var tsx_default = {
|
|
|
28949
28949
|
scopeName: "source.tsx"
|
|
28950
28950
|
};
|
|
28951
28951
|
|
|
28952
|
-
// node_modules/.pnpm/tm-grammars@1.24.
|
|
28952
|
+
// node_modules/.pnpm/tm-grammars@1.24.10/node_modules/tm-grammars/grammars/json.json
|
|
28953
28953
|
var json_default = {
|
|
28954
28954
|
displayName: "JSON",
|
|
28955
28955
|
name: "json",
|
|
@@ -29348,7 +29348,9 @@ import { errors, hydrate, init, lazy, Workspace } from "./core.js";
|
|
|
29348
29348
|
for (const [lang, provider] of Object.entries(builtinLSPProviders)) {
|
|
29349
29349
|
registerLSPProvider(lang, provider);
|
|
29350
29350
|
}
|
|
29351
|
-
|
|
29351
|
+
for (const syntax of syntaxes) {
|
|
29352
|
+
registerSyntax(syntax);
|
|
29353
|
+
}
|
|
29352
29354
|
registerTheme(vitesse_dark_default);
|
|
29353
29355
|
export {
|
|
29354
29356
|
Workspace,
|