@webgal/language-service 0.0.2-alpha.0 → 0.0.2-alpha.2
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/build/index.cjs +16 -289
- package/build/index.d.cts +4 -97
- package/build/index.d.mts +4 -97
- package/build/index.mjs +5 -288
- package/build/monaco/index.cjs +6 -0
- package/build/monaco/index.d.cts +2 -0
- package/build/monaco/index.d.mts +2 -0
- package/build/monaco/index.mjs +3 -0
- package/build/monaco-init-BR2AgVuN.d.mts +158 -0
- package/build/monaco-init-D6m312d3.mjs +525 -0
- package/build/monaco-init-DUnVu1qx.d.cts +158 -0
- package/build/monaco-init-PW92JiUH.cjs +606 -0
- package/build/node.d.cts +2 -1
- package/build/node.d.mts +2 -1
- package/build/syntaxes.cjs +1 -1
- package/build/syntaxes.mjs +1 -1
- package/build/themes.cjs +1 -1
- package/build/themes.mjs +1 -1
- package/package.json +7 -3
- package/build/monaco-init.cjs +0 -83
- package/build/monaco-init.d.cts +0 -7
- package/build/monaco-init.d.mts +0 -7
- package/build/monaco-init.mjs +0 -78
- package/build/monaco.cjs +0 -138
- package/build/monaco.d.cts +0 -32
- package/build/monaco.d.mts +0 -32
- package/build/monaco.mjs +0 -134
- /package/build/{language-configuration-BeRkRSII.mjs → language-configuration-CXgHqltm.mjs} +0 -0
- /package/build/{language-configuration-D41FLA6b.cjs → language-configuration-Dogb_mCE.cjs} +0 -0
- /package/build/{white-Be4QIaif.cjs → white-DKaUkz8d.cjs} +0 -0
- /package/build/{white-CaNrG0B0.mjs → white-DO2qVBHF.mjs} +0 -0
package/build/index.mjs
CHANGED
|
@@ -1,293 +1,10 @@
|
|
|
1
|
+
import { a as registerWebgalClientHandlers, c as createVolarFileSystem, d as pathToUri, f as toVfsPath, i as createWebgalClientHandlers, l as joinPaths, n as createWebgalMonacoLanguageClient, o as createMemoryVolarFileSystem, p as uriToPath, r as createWebgalMonacoLanguageClientWithWorker, s as createVirtualFileSystem, t as initWebgalMonaco, u as normalizePath } from "./monaco-init-D6m312d3.mjs";
|
|
2
|
+
import "./monaco/index.mjs";
|
|
3
|
+
|
|
1
4
|
//#region src/index.ts
|
|
2
|
-
const normalizePath = (input) => {
|
|
3
|
-
let path = input.replace(/\\/g, "/").replace(/\/+/g, "/");
|
|
4
|
-
if (path === "") return "/";
|
|
5
|
-
if (!path.startsWith("/")) path = "/" + path;
|
|
6
|
-
if (path.length > 1 && path.endsWith("/")) path = path.slice(0, -1);
|
|
7
|
-
return path;
|
|
8
|
-
};
|
|
9
|
-
const joinPaths = (...parts) => {
|
|
10
|
-
return normalizePath(parts.filter((part) => part && part !== "/").join("/"));
|
|
11
|
-
};
|
|
12
|
-
const uriToPath = (uriString) => {
|
|
13
|
-
if (uriString.startsWith("file://")) {
|
|
14
|
-
const stripped = uriString.replace(/^file:\/*/i, "/");
|
|
15
|
-
const decoded = decodeURIComponent(stripped).replace(/\\/g, "/");
|
|
16
|
-
if (/^\/[a-zA-Z]:\//.test(decoded)) return decoded.slice(1);
|
|
17
|
-
return normalizePath(decoded);
|
|
18
|
-
}
|
|
19
|
-
return normalizePath(uriString);
|
|
20
|
-
};
|
|
21
|
-
const toVfsPath = (value) => value.startsWith("file://") ? uriToPath(value) : value;
|
|
22
5
|
function createMemoryFileSystem(options) {
|
|
23
|
-
|
|
24
|
-
let rootEntry = options?.tree && options.tree.type === "dir" ? options.tree : {
|
|
25
|
-
type: "dir",
|
|
26
|
-
children: {}
|
|
27
|
-
};
|
|
28
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
29
|
-
const emit = (changes) => {
|
|
30
|
-
for (const listener of listeners) listener(changes);
|
|
31
|
-
};
|
|
32
|
-
const resolveToSegments = (path) => {
|
|
33
|
-
let resolved = normalizePath(path);
|
|
34
|
-
if (root !== "/" && resolved.startsWith(root)) resolved = resolved.slice(root.length);
|
|
35
|
-
if (resolved.startsWith("/")) resolved = resolved.slice(1);
|
|
36
|
-
return resolved ? resolved.split("/") : [];
|
|
37
|
-
};
|
|
38
|
-
const ensureDirectoryEntry = (segments) => {
|
|
39
|
-
let current = rootEntry;
|
|
40
|
-
for (const segment of segments) {
|
|
41
|
-
if (current.type !== "dir") throw new Error("Path segment is not a directory");
|
|
42
|
-
const directory = current;
|
|
43
|
-
const existing = directory.children[segment];
|
|
44
|
-
if (!existing) {
|
|
45
|
-
const created = {
|
|
46
|
-
type: "dir",
|
|
47
|
-
children: {}
|
|
48
|
-
};
|
|
49
|
-
directory.children[segment] = created;
|
|
50
|
-
current = created;
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (existing.type !== "dir") throw new Error("Path segment is not a directory");
|
|
54
|
-
current = existing;
|
|
55
|
-
}
|
|
56
|
-
if (current.type !== "dir") throw new Error("Path is not a directory");
|
|
57
|
-
return current;
|
|
58
|
-
};
|
|
59
|
-
const getEntry = (path) => {
|
|
60
|
-
const segments = resolveToSegments(path);
|
|
61
|
-
let current = rootEntry;
|
|
62
|
-
for (const segment of segments) {
|
|
63
|
-
if (current.type !== "dir") return null;
|
|
64
|
-
const next = current.children[segment];
|
|
65
|
-
if (!next) return null;
|
|
66
|
-
current = next;
|
|
67
|
-
}
|
|
68
|
-
return current;
|
|
69
|
-
};
|
|
70
|
-
const readDirectory = async (path) => {
|
|
71
|
-
const entry = getEntry(path);
|
|
72
|
-
if (!entry || entry.type !== "dir") return null;
|
|
73
|
-
return Object.entries(entry.children).map(([name, child]) => ({
|
|
74
|
-
name,
|
|
75
|
-
isDirectory: child.type === "dir"
|
|
76
|
-
}));
|
|
77
|
-
};
|
|
78
|
-
const readFile = async (path) => {
|
|
79
|
-
const entry = getEntry(path);
|
|
80
|
-
if (!entry || entry.type !== "file") return null;
|
|
81
|
-
return entry.content;
|
|
82
|
-
};
|
|
83
|
-
const stat = async (path) => {
|
|
84
|
-
const entry = getEntry(path);
|
|
85
|
-
if (!entry) return null;
|
|
86
|
-
return {
|
|
87
|
-
isFile: entry.type === "file",
|
|
88
|
-
isDirectory: entry.type === "dir"
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
const findFile = async (startPath, targetName) => {
|
|
92
|
-
const startEntry = getEntry(startPath);
|
|
93
|
-
if (!startEntry || startEntry.type !== "dir") return null;
|
|
94
|
-
const stack = [{
|
|
95
|
-
path: normalizePath(startPath),
|
|
96
|
-
entry: startEntry
|
|
97
|
-
}];
|
|
98
|
-
while (stack.length) {
|
|
99
|
-
const current = stack.pop();
|
|
100
|
-
if (!current) break;
|
|
101
|
-
if (current.entry.type === "dir") for (const [name, child] of Object.entries(current.entry.children)) {
|
|
102
|
-
const nextPath = joinPaths(current.path, name);
|
|
103
|
-
if (child.type === "file" && name === targetName) return nextPath;
|
|
104
|
-
if (child.type === "dir") stack.push({
|
|
105
|
-
path: nextPath,
|
|
106
|
-
entry: child
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return null;
|
|
111
|
-
};
|
|
112
|
-
const getResourceDirectory = async (urls) => {
|
|
113
|
-
return readDirectory(joinPaths(root, ...urls));
|
|
114
|
-
};
|
|
115
|
-
const getAllTextWithScene = async () => {
|
|
116
|
-
const scenePath = joinPaths(root, "scene");
|
|
117
|
-
const sceneEntry = getEntry(scenePath);
|
|
118
|
-
if (!sceneEntry || sceneEntry.type !== "dir") return null;
|
|
119
|
-
const map = {};
|
|
120
|
-
for (const [name, child] of Object.entries(sceneEntry.children)) if (child.type === "file" && name.endsWith(".txt")) {
|
|
121
|
-
const fullPath = joinPaths(scenePath, name);
|
|
122
|
-
map[name] = {
|
|
123
|
-
path: fullPath,
|
|
124
|
-
name,
|
|
125
|
-
text: child.content,
|
|
126
|
-
fullPath
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
return map;
|
|
130
|
-
};
|
|
131
|
-
const getTree = () => rootEntry;
|
|
132
|
-
const setTree = (tree) => {
|
|
133
|
-
rootEntry = tree.type === "dir" ? tree : {
|
|
134
|
-
type: "dir",
|
|
135
|
-
children: {}
|
|
136
|
-
};
|
|
137
|
-
emit([{
|
|
138
|
-
type: "setTree",
|
|
139
|
-
tree: rootEntry
|
|
140
|
-
}]);
|
|
141
|
-
};
|
|
142
|
-
const writeFile = async (targetPath, content) => {
|
|
143
|
-
const segments = resolveToSegments(targetPath);
|
|
144
|
-
if (segments.length === 0) return;
|
|
145
|
-
const fileName = segments[segments.length - 1];
|
|
146
|
-
const parent = ensureDirectoryEntry(segments.slice(0, -1));
|
|
147
|
-
parent.children[fileName] = {
|
|
148
|
-
type: "file",
|
|
149
|
-
content
|
|
150
|
-
};
|
|
151
|
-
emit([{
|
|
152
|
-
type: "writeFile",
|
|
153
|
-
path: normalizePath(targetPath),
|
|
154
|
-
content
|
|
155
|
-
}]);
|
|
156
|
-
};
|
|
157
|
-
const mkdir = async (targetPath) => {
|
|
158
|
-
ensureDirectoryEntry(resolveToSegments(targetPath));
|
|
159
|
-
emit([{
|
|
160
|
-
type: "mkdir",
|
|
161
|
-
path: normalizePath(targetPath)
|
|
162
|
-
}]);
|
|
163
|
-
};
|
|
164
|
-
const deletePath = async (targetPath) => {
|
|
165
|
-
const segments = resolveToSegments(targetPath);
|
|
166
|
-
if (segments.length === 0) return;
|
|
167
|
-
const name = segments[segments.length - 1];
|
|
168
|
-
const parentSegments = segments.slice(0, -1);
|
|
169
|
-
const parentEntry = parentSegments.length === 0 ? rootEntry : getEntry(joinPaths(root, ...parentSegments));
|
|
170
|
-
if (!parentEntry || parentEntry.type !== "dir") return;
|
|
171
|
-
delete parentEntry.children[name];
|
|
172
|
-
emit([{
|
|
173
|
-
type: "deletePath",
|
|
174
|
-
path: normalizePath(targetPath)
|
|
175
|
-
}]);
|
|
176
|
-
};
|
|
177
|
-
const rename = async (from, to) => {
|
|
178
|
-
const fromSegments = resolveToSegments(from);
|
|
179
|
-
if (fromSegments.length === 0) return;
|
|
180
|
-
const fromName = fromSegments[fromSegments.length - 1];
|
|
181
|
-
const fromParentSegments = fromSegments.slice(0, -1);
|
|
182
|
-
const fromParentEntry = fromParentSegments.length === 0 ? rootEntry : getEntry(joinPaths(root, ...fromParentSegments));
|
|
183
|
-
if (!fromParentEntry || fromParentEntry.type !== "dir") return;
|
|
184
|
-
const entry = fromParentEntry.children[fromName];
|
|
185
|
-
if (!entry) return;
|
|
186
|
-
delete fromParentEntry.children[fromName];
|
|
187
|
-
const toSegments = resolveToSegments(to);
|
|
188
|
-
if (toSegments.length === 0) return;
|
|
189
|
-
const toName = toSegments[toSegments.length - 1];
|
|
190
|
-
const toParent = ensureDirectoryEntry(toSegments.slice(0, -1));
|
|
191
|
-
toParent.children[toName] = entry;
|
|
192
|
-
emit([{
|
|
193
|
-
type: "rename",
|
|
194
|
-
from: normalizePath(from),
|
|
195
|
-
to: normalizePath(to)
|
|
196
|
-
}]);
|
|
197
|
-
};
|
|
198
|
-
const applyChanges = async (changes) => {
|
|
199
|
-
for (const change of changes) {
|
|
200
|
-
if (change.type === "writeFile") {
|
|
201
|
-
await writeFile(change.path, change.content);
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
204
|
-
if (change.type === "mkdir") {
|
|
205
|
-
await mkdir(change.path);
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
if (change.type === "deletePath") {
|
|
209
|
-
await deletePath(change.path);
|
|
210
|
-
continue;
|
|
211
|
-
}
|
|
212
|
-
if (change.type === "rename") {
|
|
213
|
-
await rename(change.from, change.to);
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
if (change.type === "setTree") setTree(change.tree);
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
const onDidChange = (listener) => {
|
|
220
|
-
listeners.add(listener);
|
|
221
|
-
return () => {
|
|
222
|
-
listeners.delete(listener);
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
return {
|
|
226
|
-
root,
|
|
227
|
-
currentDirectory: () => root,
|
|
228
|
-
join: (...parts) => joinPaths(...parts),
|
|
229
|
-
stat,
|
|
230
|
-
readDirectory,
|
|
231
|
-
readFile,
|
|
232
|
-
findFile,
|
|
233
|
-
getResourceDirectory,
|
|
234
|
-
getAllTextWithScene,
|
|
235
|
-
getTree,
|
|
236
|
-
setTree,
|
|
237
|
-
writeFile,
|
|
238
|
-
deletePath,
|
|
239
|
-
mkdir,
|
|
240
|
-
rename,
|
|
241
|
-
applyChanges,
|
|
242
|
-
onDidChange
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
function createWebgalClientHandlers(options) {
|
|
246
|
-
const normalizeChange = (change) => {
|
|
247
|
-
if (change.type === "writeFile") return {
|
|
248
|
-
type: "writeFile",
|
|
249
|
-
path: toVfsPath(change.path),
|
|
250
|
-
content: change.content
|
|
251
|
-
};
|
|
252
|
-
if (change.type === "deletePath") return {
|
|
253
|
-
type: "deletePath",
|
|
254
|
-
path: toVfsPath(change.path)
|
|
255
|
-
};
|
|
256
|
-
if (change.type === "mkdir") return {
|
|
257
|
-
type: "mkdir",
|
|
258
|
-
path: toVfsPath(change.path)
|
|
259
|
-
};
|
|
260
|
-
if (change.type === "rename") return {
|
|
261
|
-
type: "rename",
|
|
262
|
-
from: toVfsPath(change.from),
|
|
263
|
-
to: toVfsPath(change.to)
|
|
264
|
-
};
|
|
265
|
-
return change;
|
|
266
|
-
};
|
|
267
|
-
return {
|
|
268
|
-
"client/showTip": options.showTip ?? (() => null),
|
|
269
|
-
"client/currentDirectory": () => options.vfs.currentDirectory(),
|
|
270
|
-
"client/FJoin": (args) => options.vfs.join(...Array.isArray(args) ? args : [args]),
|
|
271
|
-
"client/FStat": (path) => options.vfs.stat(path),
|
|
272
|
-
"client/findFile": ([startPath, targetName]) => options.vfs.findFile(startPath, targetName),
|
|
273
|
-
"client/goPropertyDoc": options.goPropertyDoc ?? (() => null),
|
|
274
|
-
"client/readDirectory": (uriString) => options.vfs.readDirectory(uriToPath(uriString)),
|
|
275
|
-
"client/getAllTextWithScene": () => options.vfs.getAllTextWithScene(),
|
|
276
|
-
"client/getResourceDirectory": (urls) => options.vfs.getResourceDirectory(urls),
|
|
277
|
-
"client/vfs/getTree": () => options.vfs.getTree(),
|
|
278
|
-
"client/vfs/setTree": (tree) => options.vfs.setTree(tree),
|
|
279
|
-
"client/vfs/readFile": (path) => options.vfs.readFile(toVfsPath(path)),
|
|
280
|
-
"client/vfs/writeFile": ({ path, content }) => options.vfs.writeFile(toVfsPath(path), content),
|
|
281
|
-
"client/vfs/deletePath": (path) => options.vfs.deletePath(toVfsPath(path)),
|
|
282
|
-
"client/vfs/mkdir": (path) => options.vfs.mkdir(toVfsPath(path)),
|
|
283
|
-
"client/vfs/rename": ({ from, to }) => options.vfs.rename(toVfsPath(from), toVfsPath(to)),
|
|
284
|
-
"client/vfs/applyChanges": (changes) => options.vfs.applyChanges(changes.map(normalizeChange)),
|
|
285
|
-
...options.overrides ?? {}
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
function registerWebgalClientHandlers(client, handlers) {
|
|
289
|
-
for (const [method, handler] of Object.entries(handlers)) client.onRequest(method, handler);
|
|
6
|
+
return createVirtualFileSystem(createMemoryVolarFileSystem(options));
|
|
290
7
|
}
|
|
291
8
|
|
|
292
9
|
//#endregion
|
|
293
|
-
export { createMemoryFileSystem, createWebgalClientHandlers, registerWebgalClientHandlers };
|
|
10
|
+
export { createMemoryFileSystem, createMemoryVolarFileSystem, createVirtualFileSystem, createVolarFileSystem, createWebgalClientHandlers, createWebgalMonacoLanguageClient, createWebgalMonacoLanguageClientWithWorker, initWebgalMonaco, joinPaths, normalizePath, pathToUri, registerWebgalClientHandlers, toVfsPath, uriToPath };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_monaco_init = require('../monaco-init-PW92JiUH.cjs');
|
|
3
|
+
|
|
4
|
+
exports.createWebgalMonacoLanguageClient = require_monaco_init.createWebgalMonacoLanguageClient;
|
|
5
|
+
exports.createWebgalMonacoLanguageClientWithWorker = require_monaco_init.createWebgalMonacoLanguageClientWithWorker;
|
|
6
|
+
exports.initWebgalMonaco = require_monaco_init.initWebgalMonaco;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as createWebgalMonacoLanguageClientWithWorker, i as createWebgalMonacoLanguageClient, n as CreateWebgalMonacoLanguageClientOptions, r as CreateWebgalMonacoLanguageClientWorkerOptions, t as initWebgalMonaco } from "../monaco-init-DUnVu1qx.cjs";
|
|
2
|
+
export { CreateWebgalMonacoLanguageClientOptions, CreateWebgalMonacoLanguageClientWorkerOptions, createWebgalMonacoLanguageClient, createWebgalMonacoLanguageClientWithWorker, initWebgalMonaco };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as createWebgalMonacoLanguageClientWithWorker, i as createWebgalMonacoLanguageClient, n as CreateWebgalMonacoLanguageClientOptions, r as CreateWebgalMonacoLanguageClientWorkerOptions, t as initWebgalMonaco } from "../monaco-init-BR2AgVuN.mjs";
|
|
2
|
+
export { CreateWebgalMonacoLanguageClientOptions, CreateWebgalMonacoLanguageClientWorkerOptions, createWebgalMonacoLanguageClient, createWebgalMonacoLanguageClientWithWorker, initWebgalMonaco };
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { createMemoryFileSystem } from "./index.mjs";
|
|
2
|
+
import { FileSystem } from "@volar/language-service";
|
|
3
|
+
import { URI } from "vscode-uri";
|
|
4
|
+
import "vscode/localExtensionHost";
|
|
5
|
+
|
|
6
|
+
//#region src/vfs/types.d.ts
|
|
7
|
+
type DirectoryEntry = {
|
|
8
|
+
name: string;
|
|
9
|
+
isDirectory: boolean;
|
|
10
|
+
};
|
|
11
|
+
type VirtualFileEntry = {
|
|
12
|
+
type: "file";
|
|
13
|
+
content: string;
|
|
14
|
+
};
|
|
15
|
+
type VirtualDirectoryEntry = {
|
|
16
|
+
type: "dir";
|
|
17
|
+
children: Record<string, VirtualEntry>;
|
|
18
|
+
};
|
|
19
|
+
type VirtualEntry = VirtualFileEntry | VirtualDirectoryEntry;
|
|
20
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
21
|
+
type VirtualFileSystemChange = {
|
|
22
|
+
type: "writeFile";
|
|
23
|
+
path: string;
|
|
24
|
+
content: string;
|
|
25
|
+
} | {
|
|
26
|
+
type: "deletePath";
|
|
27
|
+
path: string;
|
|
28
|
+
} | {
|
|
29
|
+
type: "mkdir";
|
|
30
|
+
path: string;
|
|
31
|
+
} | {
|
|
32
|
+
type: "rename";
|
|
33
|
+
from: string;
|
|
34
|
+
to: string;
|
|
35
|
+
} | {
|
|
36
|
+
type: "setTree";
|
|
37
|
+
tree: VirtualEntry;
|
|
38
|
+
};
|
|
39
|
+
type VirtualFileSystemChangeListener = (changes: VirtualFileSystemChange[]) => void;
|
|
40
|
+
type VirtualFileSystem = {
|
|
41
|
+
root: string;
|
|
42
|
+
currentDirectory: () => string | null;
|
|
43
|
+
join: (...parts: string[]) => string;
|
|
44
|
+
stat: (path: string) => Promise<{
|
|
45
|
+
isFile: boolean;
|
|
46
|
+
isDirectory: boolean;
|
|
47
|
+
} | null>;
|
|
48
|
+
readDirectory: (path: string) => Promise<DirectoryEntry[] | null>;
|
|
49
|
+
readFile: (path: string) => Promise<string | null>;
|
|
50
|
+
findFile: (startPath: string, targetName: string) => Promise<string | null>;
|
|
51
|
+
getResourceDirectory: (urls: string[]) => Promise<DirectoryEntry[] | null>;
|
|
52
|
+
getAllTextWithScene: () => Promise<Record<string, {
|
|
53
|
+
path: string;
|
|
54
|
+
name: string;
|
|
55
|
+
text: string;
|
|
56
|
+
fullPath: string;
|
|
57
|
+
}> | null>;
|
|
58
|
+
getTree: () => VirtualEntry;
|
|
59
|
+
setTree: (tree: VirtualEntry) => void;
|
|
60
|
+
writeFile: (path: string, content: string) => Promise<void>;
|
|
61
|
+
deletePath: (path: string) => Promise<void>;
|
|
62
|
+
mkdir: (path: string) => Promise<void>;
|
|
63
|
+
rename: (from: string, to: string) => Promise<void>;
|
|
64
|
+
applyChanges: (changes: VirtualFileSystemChange[]) => Promise<void>;
|
|
65
|
+
onDidChange: (listener: VirtualFileSystemChangeListener) => () => void;
|
|
66
|
+
};
|
|
67
|
+
type WebgalClientHandlers = {
|
|
68
|
+
"client/showTip": (message: string) => MaybePromise<unknown>;
|
|
69
|
+
"client/currentDirectory": () => MaybePromise<string | null>;
|
|
70
|
+
"client/FJoin": (args: string | string[]) => MaybePromise<string | null>;
|
|
71
|
+
"client/FStat": (path: string) => MaybePromise<unknown>;
|
|
72
|
+
"client/findFile": (args: [string, string]) => MaybePromise<string | null>;
|
|
73
|
+
"client/goPropertyDoc": (pathSegments: string[]) => MaybePromise<unknown>;
|
|
74
|
+
"client/readDirectory": (uriString: string) => MaybePromise<unknown>;
|
|
75
|
+
"client/getAllTextWithScene": () => MaybePromise<unknown>;
|
|
76
|
+
"client/getResourceDirectory": (urls: string[]) => MaybePromise<unknown>;
|
|
77
|
+
"client/vfs/getTree": () => MaybePromise<VirtualEntry>;
|
|
78
|
+
"client/vfs/setTree": (tree: VirtualEntry) => MaybePromise<unknown>;
|
|
79
|
+
"client/vfs/readFile": (path: string) => MaybePromise<string | null>;
|
|
80
|
+
"client/vfs/writeFile": (args: {
|
|
81
|
+
path: string;
|
|
82
|
+
content: string;
|
|
83
|
+
}) => MaybePromise<unknown>;
|
|
84
|
+
"client/vfs/deletePath": (path: string) => MaybePromise<unknown>;
|
|
85
|
+
"client/vfs/mkdir": (path: string) => MaybePromise<unknown>;
|
|
86
|
+
"client/vfs/rename": (args: {
|
|
87
|
+
from: string;
|
|
88
|
+
to: string;
|
|
89
|
+
}) => MaybePromise<unknown>;
|
|
90
|
+
"client/vfs/applyChanges": (changes: VirtualFileSystemChange[]) => MaybePromise<unknown>;
|
|
91
|
+
};
|
|
92
|
+
type LanguageClientLike = {
|
|
93
|
+
onRequest: (method: string, handler: (...args: any[]) => unknown) => void;
|
|
94
|
+
};
|
|
95
|
+
type CreateWebgalClientHandlersOptions = {
|
|
96
|
+
vfs: VirtualFileSystem;
|
|
97
|
+
showTip?: (message: string) => unknown;
|
|
98
|
+
goPropertyDoc?: (pathSegments: string[]) => unknown;
|
|
99
|
+
overrides?: Partial<WebgalClientHandlers>;
|
|
100
|
+
};
|
|
101
|
+
interface VolarWritableFileSystem extends FileSystem {
|
|
102
|
+
writeFile(uri: URI, content: string): Promise<void>;
|
|
103
|
+
mkdir(uri: URI): Promise<void>;
|
|
104
|
+
delete(uri: URI): Promise<void>;
|
|
105
|
+
rename(oldUri: URI, newUri: URI): Promise<void>;
|
|
106
|
+
getTree(): VirtualEntry;
|
|
107
|
+
setTree(tree: VirtualEntry): void;
|
|
108
|
+
onDidChange(listener: VirtualFileSystemChangeListener): () => void;
|
|
109
|
+
root: string;
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/client-handlers.d.ts
|
|
113
|
+
declare function createWebgalClientHandlers(options: CreateWebgalClientHandlersOptions): WebgalClientHandlers;
|
|
114
|
+
declare function registerWebgalClientHandlers(client: LanguageClientLike, handlers: Partial<WebgalClientHandlers>): void;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/vfs/adapter.d.ts
|
|
117
|
+
declare function createVirtualFileSystem(fs: VolarWritableFileSystem): VirtualFileSystem;
|
|
118
|
+
declare function createVolarFileSystem(vfs: VirtualFileSystem, options?: {
|
|
119
|
+
uriToPath?: (uri: URI) => string;
|
|
120
|
+
}): FileSystem;
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region src/vfs/memory.d.ts
|
|
123
|
+
declare function createMemoryVolarFileSystem(options?: {
|
|
124
|
+
root?: string;
|
|
125
|
+
tree?: VirtualEntry;
|
|
126
|
+
}): VolarWritableFileSystem;
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/vfs/utils.d.ts
|
|
129
|
+
declare const normalizePath: (input: string) => string;
|
|
130
|
+
declare const joinPaths: (...parts: string[]) => string;
|
|
131
|
+
declare const uriToPath: (value: string | URI) => string;
|
|
132
|
+
declare const pathToUri: (path: string) => URI;
|
|
133
|
+
declare const toVfsPath: (value: string) => string;
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/monaco/monaco.d.ts
|
|
136
|
+
interface CreateWebgalMonacoLanguageClientOptions {
|
|
137
|
+
languageServerUrl: string;
|
|
138
|
+
editor: any;
|
|
139
|
+
virtualFileSystem?: ReturnType<typeof createMemoryFileSystem>;
|
|
140
|
+
}
|
|
141
|
+
declare const createWebgalMonacoLanguageClient: (options: CreateWebgalMonacoLanguageClientOptions) => {
|
|
142
|
+
webSocket: WebSocket;
|
|
143
|
+
vfs: ReturnType<typeof createMemoryFileSystem>;
|
|
144
|
+
};
|
|
145
|
+
interface CreateWebgalMonacoLanguageClientWorkerOptions {
|
|
146
|
+
editor: any;
|
|
147
|
+
worker: Worker;
|
|
148
|
+
virtualFileSystem?: ReturnType<typeof createMemoryFileSystem>;
|
|
149
|
+
}
|
|
150
|
+
declare const createWebgalMonacoLanguageClientWithWorker: (options: CreateWebgalMonacoLanguageClientWorkerOptions) => {
|
|
151
|
+
worker: Worker;
|
|
152
|
+
vfs: ReturnType<typeof createMemoryFileSystem>;
|
|
153
|
+
};
|
|
154
|
+
//#endregion
|
|
155
|
+
//#region src/monaco/monaco-init.d.ts
|
|
156
|
+
declare function initWebgalMonaco(): Promise<void>;
|
|
157
|
+
//#endregion
|
|
158
|
+
export { VirtualFileSystem as C, WebgalClientHandlers as D, VolarWritableFileSystem as E, VirtualFileEntry as S, VirtualFileSystemChangeListener as T, DirectoryEntry as _, createWebgalMonacoLanguageClientWithWorker as a, VirtualDirectoryEntry as b, pathToUri as c, createMemoryVolarFileSystem as d, createVirtualFileSystem as f, CreateWebgalClientHandlersOptions as g, registerWebgalClientHandlers as h, createWebgalMonacoLanguageClient as i, toVfsPath as l, createWebgalClientHandlers as m, CreateWebgalMonacoLanguageClientOptions as n, joinPaths as o, createVolarFileSystem as p, CreateWebgalMonacoLanguageClientWorkerOptions as r, normalizePath as s, initWebgalMonaco as t, uriToPath as u, LanguageClientLike as v, VirtualFileSystemChange as w, VirtualEntry as x, MaybePromise as y };
|