@lvce-editor/extension-host-worker 8.60.0 → 8.62.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/dist/extension-api/index.js +32 -0
- package/dist/extension-api/parts/ExtensionApiCommandMap/ExtensionApiCommandMap.js +10 -1
- package/dist/extension-api/parts/FileSystemProviderRegistry/FileSystemProviderRegistry.js +29 -0
- package/dist/extensionHostWorkerMain.js +68 -20
- package/extension-api/dist/index.d.ts +1 -1
- package/extension-api/dist/index.js +1 -1
- package/extension-api/dist/parts/CommandMap/CommandMap.d.ts +3 -0
- package/extension-api/dist/parts/ExtensionApiCommandMap/ExtensionApiCommandMap.d.ts +3 -0
- package/extension-api/dist/parts/ExtensionApiCommandMap/ExtensionApiCommandMap.js +4 -1
- package/extension-api/dist/parts/ExtensionApiWorkerCommandMap/ExtensionApiWorkerCommandMap.d.ts +3 -0
- package/extension-api/dist/parts/FileSystemProvider/FileSystemProvider.d.ts +4 -0
- package/extension-api/dist/parts/FileSystemProviderRegistry/FileSystemProviderRegistry.d.ts +4 -0
- package/extension-api/dist/parts/FileSystemProviderRegistry/FileSystemProviderRegistry.js +26 -0
- package/extension-api/dist/parts/RegisteredFileSystemProvider/RegisteredFileSystemProvider.d.ts +4 -0
- package/extension-api/dist/parts/StatusBarItem/StatusBarItem.d.ts +1 -0
- package/extension-api/package.json +1 -1
- package/extension-api/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1810,6 +1810,15 @@ var assertFileSystemProvider = (provider) => {
|
|
|
1810
1810
|
if (typeof provider.readFile !== "function") {
|
|
1811
1811
|
throw new ExtensionApiError(`file system provider ${provider.id} is missing readFile function`);
|
|
1812
1812
|
}
|
|
1813
|
+
if (provider.readDirWithFileTypes !== void 0 && typeof provider.readDirWithFileTypes !== "function") {
|
|
1814
|
+
throw new ExtensionApiError(`file system provider ${provider.id} has invalid readDirWithFileTypes function`);
|
|
1815
|
+
}
|
|
1816
|
+
if (provider.isReadonly !== void 0 && typeof provider.isReadonly !== "function") {
|
|
1817
|
+
throw new ExtensionApiError(`file system provider ${provider.id} has invalid isReadonly function`);
|
|
1818
|
+
}
|
|
1819
|
+
if (provider.pathSeparator !== void 0 && typeof provider.pathSeparator !== "string") {
|
|
1820
|
+
throw new ExtensionApiError(`file system provider ${provider.id} has invalid pathSeparator`);
|
|
1821
|
+
}
|
|
1813
1822
|
if (provider.id in providers) {
|
|
1814
1823
|
throw new ExtensionApiError(`file system provider ${provider.id} is already registered`);
|
|
1815
1824
|
}
|
|
@@ -1824,6 +1833,20 @@ var getProvider = (id2) => {
|
|
|
1824
1833
|
var executeFileSystemProviderReadFile = async (id2, uri) => {
|
|
1825
1834
|
return getProvider(id2).readFile(uri);
|
|
1826
1835
|
};
|
|
1836
|
+
var executeFileSystemProviderReadDirWithFileTypes = async (id2, uri) => {
|
|
1837
|
+
const provider = getProvider(id2);
|
|
1838
|
+
if (!provider.readDirWithFileTypes) {
|
|
1839
|
+
throw new ExtensionApiError(`file system provider ${id2} is missing readDirWithFileTypes function`);
|
|
1840
|
+
}
|
|
1841
|
+
return provider.readDirWithFileTypes(uri);
|
|
1842
|
+
};
|
|
1843
|
+
var executeFileSystemProviderGetPathSeparator = (id2) => {
|
|
1844
|
+
return getProvider(id2).pathSeparator || "/";
|
|
1845
|
+
};
|
|
1846
|
+
var executeFileSystemProviderIsReadonly = async (id2) => {
|
|
1847
|
+
const provider = getProvider(id2);
|
|
1848
|
+
return provider.isReadonly ? provider.isReadonly() : false;
|
|
1849
|
+
};
|
|
1827
1850
|
var getFileSystemProviderRegistrySnapshot = () => {
|
|
1828
1851
|
return {
|
|
1829
1852
|
providers: Object.values(providers).map((provider) => ({
|
|
@@ -1835,6 +1858,9 @@ var registerFileSystemProvider = (provider) => {
|
|
|
1835
1858
|
assertFileSystemProvider(provider);
|
|
1836
1859
|
providers[provider.id] = {
|
|
1837
1860
|
id: provider.id,
|
|
1861
|
+
isReadonly: provider.isReadonly,
|
|
1862
|
+
pathSeparator: provider.pathSeparator,
|
|
1863
|
+
readDirWithFileTypes: provider.readDirWithFileTypes,
|
|
1838
1864
|
readFile: (uri) => provider.readFile(uri)
|
|
1839
1865
|
};
|
|
1840
1866
|
return {
|
|
@@ -3184,6 +3210,9 @@ var commandMap = {
|
|
|
3184
3210
|
"ExtensionApi.executeCommand": executeCommand,
|
|
3185
3211
|
"ExtensionApi.executeCompletionProvider": executeCompletionProvider,
|
|
3186
3212
|
"ExtensionApi.executeDiagnosticProvider": executeDiagnosticProvider,
|
|
3213
|
+
"ExtensionApi.executeFileSystemProviderGetPathSeparator": executeFileSystemProviderGetPathSeparator,
|
|
3214
|
+
"ExtensionApi.executeFileSystemProviderIsReadonly": executeFileSystemProviderIsReadonly,
|
|
3215
|
+
"ExtensionApi.executeFileSystemProviderReadDirWithFileTypes": executeFileSystemProviderReadDirWithFileTypes,
|
|
3187
3216
|
"ExtensionApi.executeFileSystemProviderReadFile": executeFileSystemProviderReadFile,
|
|
3188
3217
|
"ExtensionApi.executeFormattingProvider": executeFormattingProvider,
|
|
3189
3218
|
"ExtensionApi.executeHoverProvider": executeHoverProvider,
|
|
@@ -3582,6 +3611,9 @@ export {
|
|
|
3582
3611
|
executeCommand2 as executeCommand,
|
|
3583
3612
|
executeCompletionProvider,
|
|
3584
3613
|
executeDiagnosticProvider,
|
|
3614
|
+
executeFileSystemProviderGetPathSeparator,
|
|
3615
|
+
executeFileSystemProviderIsReadonly,
|
|
3616
|
+
executeFileSystemProviderReadDirWithFileTypes,
|
|
3585
3617
|
executeFileSystemProviderReadFile,
|
|
3586
3618
|
executeFormattingProvider,
|
|
3587
3619
|
executeHoverProvider,
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { executeCommand, getCommandRegistrySnapshot } from "../CommandRegistry/CommandRegistry.js";
|
|
2
2
|
import { executeCompletionProvider, executeResolveCompletionItemProvider, getCompletionProviderRegistrySnapshot } from "../Completion/Completion.js";
|
|
3
3
|
import { executeDiagnosticProvider, getDiagnosticProviderRegistrySnapshot } from "../Diagnostic/Diagnostic.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
executeFileSystemProviderGetPathSeparator,
|
|
6
|
+
executeFileSystemProviderIsReadonly,
|
|
7
|
+
executeFileSystemProviderReadDirWithFileTypes,
|
|
8
|
+
executeFileSystemProviderReadFile,
|
|
9
|
+
getFileSystemProviderRegistrySnapshot
|
|
10
|
+
} from "../FileSystemProviderRegistry/FileSystemProviderRegistry.js";
|
|
5
11
|
import { executeFormattingProvider, getFormattingProviderRegistrySnapshot } from "../Formatting/Formatting.js";
|
|
6
12
|
import { getStatusBarItems } from "../GetStatusBarItems/GetStatusBarItems.js";
|
|
7
13
|
import { executeHoverProvider, getHoverProviderRegistrySnapshot } from "../Hover/Hover.js";
|
|
@@ -42,6 +48,9 @@ const commandMap = {
|
|
|
42
48
|
"ExtensionApi.executeCommand": executeCommand,
|
|
43
49
|
"ExtensionApi.executeCompletionProvider": executeCompletionProvider,
|
|
44
50
|
"ExtensionApi.executeDiagnosticProvider": executeDiagnosticProvider,
|
|
51
|
+
"ExtensionApi.executeFileSystemProviderGetPathSeparator": executeFileSystemProviderGetPathSeparator,
|
|
52
|
+
"ExtensionApi.executeFileSystemProviderIsReadonly": executeFileSystemProviderIsReadonly,
|
|
53
|
+
"ExtensionApi.executeFileSystemProviderReadDirWithFileTypes": executeFileSystemProviderReadDirWithFileTypes,
|
|
45
54
|
"ExtensionApi.executeFileSystemProviderReadFile": executeFileSystemProviderReadFile,
|
|
46
55
|
"ExtensionApi.executeFormattingProvider": executeFormattingProvider,
|
|
47
56
|
"ExtensionApi.executeHoverProvider": executeHoverProvider,
|
|
@@ -10,6 +10,15 @@ const assertFileSystemProvider = (provider) => {
|
|
|
10
10
|
if (typeof provider.readFile !== "function") {
|
|
11
11
|
throw new ExtensionApiError(`file system provider ${provider.id} is missing readFile function`);
|
|
12
12
|
}
|
|
13
|
+
if (provider.readDirWithFileTypes !== void 0 && typeof provider.readDirWithFileTypes !== "function") {
|
|
14
|
+
throw new ExtensionApiError(`file system provider ${provider.id} has invalid readDirWithFileTypes function`);
|
|
15
|
+
}
|
|
16
|
+
if (provider.isReadonly !== void 0 && typeof provider.isReadonly !== "function") {
|
|
17
|
+
throw new ExtensionApiError(`file system provider ${provider.id} has invalid isReadonly function`);
|
|
18
|
+
}
|
|
19
|
+
if (provider.pathSeparator !== void 0 && typeof provider.pathSeparator !== "string") {
|
|
20
|
+
throw new ExtensionApiError(`file system provider ${provider.id} has invalid pathSeparator`);
|
|
21
|
+
}
|
|
13
22
|
if (provider.id in providers) {
|
|
14
23
|
throw new ExtensionApiError(`file system provider ${provider.id} is already registered`);
|
|
15
24
|
}
|
|
@@ -24,6 +33,20 @@ const getProvider = (id) => {
|
|
|
24
33
|
const executeFileSystemProviderReadFile = async (id, uri) => {
|
|
25
34
|
return getProvider(id).readFile(uri);
|
|
26
35
|
};
|
|
36
|
+
const executeFileSystemProviderReadDirWithFileTypes = async (id, uri) => {
|
|
37
|
+
const provider = getProvider(id);
|
|
38
|
+
if (!provider.readDirWithFileTypes) {
|
|
39
|
+
throw new ExtensionApiError(`file system provider ${id} is missing readDirWithFileTypes function`);
|
|
40
|
+
}
|
|
41
|
+
return provider.readDirWithFileTypes(uri);
|
|
42
|
+
};
|
|
43
|
+
const executeFileSystemProviderGetPathSeparator = (id) => {
|
|
44
|
+
return getProvider(id).pathSeparator || "/";
|
|
45
|
+
};
|
|
46
|
+
const executeFileSystemProviderIsReadonly = async (id) => {
|
|
47
|
+
const provider = getProvider(id);
|
|
48
|
+
return provider.isReadonly ? provider.isReadonly() : false;
|
|
49
|
+
};
|
|
27
50
|
const getFileSystemProviderRegistrySnapshot = () => {
|
|
28
51
|
return {
|
|
29
52
|
providers: Object.values(providers).map((provider) => ({
|
|
@@ -35,6 +58,9 @@ const registerFileSystemProvider = (provider) => {
|
|
|
35
58
|
assertFileSystemProvider(provider);
|
|
36
59
|
providers[provider.id] = {
|
|
37
60
|
id: provider.id,
|
|
61
|
+
isReadonly: provider.isReadonly,
|
|
62
|
+
pathSeparator: provider.pathSeparator,
|
|
63
|
+
readDirWithFileTypes: provider.readDirWithFileTypes,
|
|
38
64
|
readFile: (uri) => provider.readFile(uri)
|
|
39
65
|
};
|
|
40
66
|
return {
|
|
@@ -49,6 +75,9 @@ const resetFileSystemProviderRegistry = () => {
|
|
|
49
75
|
}
|
|
50
76
|
};
|
|
51
77
|
export {
|
|
78
|
+
executeFileSystemProviderGetPathSeparator,
|
|
79
|
+
executeFileSystemProviderIsReadonly,
|
|
80
|
+
executeFileSystemProviderReadDirWithFileTypes,
|
|
52
81
|
executeFileSystemProviderReadFile,
|
|
53
82
|
getFileSystemProviderRegistrySnapshot,
|
|
54
83
|
registerFileSystemProvider,
|
|
@@ -1273,7 +1273,7 @@ const createMockRpc = ({
|
|
|
1273
1273
|
};
|
|
1274
1274
|
|
|
1275
1275
|
const rpcs$2 = Object.create(null);
|
|
1276
|
-
const set$
|
|
1276
|
+
const set$e = (id, rpc) => {
|
|
1277
1277
|
rpcs$2[id] = rpc;
|
|
1278
1278
|
};
|
|
1279
1279
|
const get$b = id => {
|
|
@@ -1306,7 +1306,7 @@ const create$7 = rpcId => {
|
|
|
1306
1306
|
const mockRpc = createMockRpc({
|
|
1307
1307
|
commandMap
|
|
1308
1308
|
});
|
|
1309
|
-
set$
|
|
1309
|
+
set$e(rpcId, mockRpc);
|
|
1310
1310
|
// @ts-ignore
|
|
1311
1311
|
mockRpc[Symbol.dispose] = () => {
|
|
1312
1312
|
remove$4(rpcId);
|
|
@@ -1315,7 +1315,7 @@ const create$7 = rpcId => {
|
|
|
1315
1315
|
return mockRpc;
|
|
1316
1316
|
},
|
|
1317
1317
|
set(rpc) {
|
|
1318
|
-
set$
|
|
1318
|
+
set$e(rpcId, rpc);
|
|
1319
1319
|
}
|
|
1320
1320
|
};
|
|
1321
1321
|
};
|
|
@@ -1324,17 +1324,23 @@ const Text = 12;
|
|
|
1324
1324
|
const Reference = 100;
|
|
1325
1325
|
|
|
1326
1326
|
const DebugWorker$1 = 55;
|
|
1327
|
+
const DialogWorker = 7014;
|
|
1327
1328
|
const ExtensionManagementWorker = 9006;
|
|
1328
1329
|
const RendererWorker$1 = 1;
|
|
1329
1330
|
|
|
1330
1331
|
const {
|
|
1331
|
-
invoke: invoke$
|
|
1332
|
+
invoke: invoke$8} = create$7(DebugWorker$1);
|
|
1332
1333
|
|
|
1333
1334
|
const DebugWorker = {
|
|
1334
1335
|
__proto__: null,
|
|
1335
|
-
invoke: invoke$
|
|
1336
|
+
invoke: invoke$8
|
|
1336
1337
|
};
|
|
1337
1338
|
|
|
1339
|
+
const {
|
|
1340
|
+
invoke: invoke$7,
|
|
1341
|
+
set: set$d
|
|
1342
|
+
} = create$7(DialogWorker);
|
|
1343
|
+
|
|
1338
1344
|
const {
|
|
1339
1345
|
invoke: invoke$6,
|
|
1340
1346
|
invokeAndTransfer: invokeAndTransfer$3,
|
|
@@ -1353,6 +1359,10 @@ const {
|
|
|
1353
1359
|
const {
|
|
1354
1360
|
invoke: invoke$4,
|
|
1355
1361
|
invokeAndTransfer: invokeAndTransfer$2} = create$7(RendererWorker$1);
|
|
1362
|
+
const sendMessagePortToDialogWorker = async port => {
|
|
1363
|
+
const command = 'HandleMessagePort.handleMessagePort';
|
|
1364
|
+
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker', port, command);
|
|
1365
|
+
};
|
|
1356
1366
|
const sendMessagePortToFileSearchWorker = async (port, rpcId = 0) => {
|
|
1357
1367
|
const command = 'QuickPick.handleMessagePort';
|
|
1358
1368
|
await invokeAndTransfer$2('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSearchWorker', port, command, rpcId);
|
|
@@ -2395,9 +2405,9 @@ const exec = async (command, args, options) => {
|
|
|
2395
2405
|
const isUnavailableError$1 = error => {
|
|
2396
2406
|
return error instanceof Error && error.name === 'CommandNotFoundError' || error instanceof TypeError && error.message === "Cannot read properties of undefined (reading 'invoke')";
|
|
2397
2407
|
};
|
|
2398
|
-
const
|
|
2408
|
+
const executeMethod = async (method, providerId, ...args) => {
|
|
2399
2409
|
try {
|
|
2400
|
-
return await invoke$6(
|
|
2410
|
+
return await invoke$6(method, providerId, ...args);
|
|
2401
2411
|
} catch (error) {
|
|
2402
2412
|
if (isUnavailableError$1(error)) {
|
|
2403
2413
|
return {
|
|
@@ -2407,6 +2417,18 @@ const execute$1 = async (providerId, uri) => {
|
|
|
2407
2417
|
throw error;
|
|
2408
2418
|
}
|
|
2409
2419
|
};
|
|
2420
|
+
const execute$1 = (providerId, uri) => {
|
|
2421
|
+
return executeMethod('Extensions.executeFileSystemProviderReadFile', providerId, uri);
|
|
2422
|
+
};
|
|
2423
|
+
const getPathSeparator$1 = providerId => {
|
|
2424
|
+
return executeMethod('Extensions.executeFileSystemProviderGetPathSeparator', providerId);
|
|
2425
|
+
};
|
|
2426
|
+
const isReadonly$1 = providerId => {
|
|
2427
|
+
return executeMethod('Extensions.executeFileSystemProviderIsReadonly', providerId);
|
|
2428
|
+
};
|
|
2429
|
+
const readDirWithFileTypes$3 = (providerId, uri) => {
|
|
2430
|
+
return executeMethod('Extensions.executeFileSystemProviderReadDirWithFileTypes', providerId, uri);
|
|
2431
|
+
};
|
|
2410
2432
|
|
|
2411
2433
|
const fileSystemProviderMap = Object.create(null);
|
|
2412
2434
|
const get$9 = protocol => {
|
|
@@ -2435,8 +2457,15 @@ const registerFileSystemProvider = fileSystemProvider => {
|
|
|
2435
2457
|
};
|
|
2436
2458
|
const readDirWithFileTypes$2 = async (protocol, path) => {
|
|
2437
2459
|
try {
|
|
2438
|
-
const provider =
|
|
2439
|
-
|
|
2460
|
+
const provider = getOptional(protocol);
|
|
2461
|
+
if (provider) {
|
|
2462
|
+
return await provider.readDirWithFileTypes(path);
|
|
2463
|
+
}
|
|
2464
|
+
const isolated = await readDirWithFileTypes$3(protocol, path);
|
|
2465
|
+
if (isolated.found) {
|
|
2466
|
+
return isolated.result;
|
|
2467
|
+
}
|
|
2468
|
+
return await get$9(protocol).readDirWithFileTypes(path);
|
|
2440
2469
|
} catch (error) {
|
|
2441
2470
|
throw new VError(error, 'Failed to execute file system provider');
|
|
2442
2471
|
}
|
|
@@ -2524,21 +2553,35 @@ const writeFile$3 = async (protocol, uri, content) => {
|
|
|
2524
2553
|
throw new VError(error, 'Failed to execute file system provider');
|
|
2525
2554
|
}
|
|
2526
2555
|
};
|
|
2527
|
-
const getPathSeparator = protocol => {
|
|
2556
|
+
const getPathSeparator = async protocol => {
|
|
2528
2557
|
try {
|
|
2529
|
-
const provider =
|
|
2530
|
-
|
|
2558
|
+
const provider = getOptional(protocol);
|
|
2559
|
+
if (provider) {
|
|
2560
|
+
return provider.pathSeparator;
|
|
2561
|
+
}
|
|
2562
|
+
const isolated = await getPathSeparator$1(protocol);
|
|
2563
|
+
if (isolated.found) {
|
|
2564
|
+
return isolated.result;
|
|
2565
|
+
}
|
|
2566
|
+
return get$9(protocol).pathSeparator;
|
|
2531
2567
|
} catch (error) {
|
|
2532
2568
|
throw new VError(error, 'Failed to execute file system provider');
|
|
2533
2569
|
}
|
|
2534
2570
|
};
|
|
2535
2571
|
const isReadonly = async protocol => {
|
|
2536
2572
|
try {
|
|
2537
|
-
const provider =
|
|
2538
|
-
if (
|
|
2539
|
-
|
|
2573
|
+
const provider = getOptional(protocol);
|
|
2574
|
+
if (provider) {
|
|
2575
|
+
if (!provider.isReadonly) {
|
|
2576
|
+
return false;
|
|
2577
|
+
}
|
|
2578
|
+
return await provider.isReadonly();
|
|
2540
2579
|
}
|
|
2541
|
-
|
|
2580
|
+
const isolated = await isReadonly$1(protocol);
|
|
2581
|
+
if (isolated.found) {
|
|
2582
|
+
return isolated.result;
|
|
2583
|
+
}
|
|
2584
|
+
return await get$9(protocol).isReadonly();
|
|
2542
2585
|
} catch (error) {
|
|
2543
2586
|
throw new VError(error, 'Failed to execute file system provider');
|
|
2544
2587
|
}
|
|
@@ -2961,7 +3004,7 @@ const getEnabledProviders = () => {
|
|
|
2961
3004
|
|
|
2962
3005
|
const confirm = message => {
|
|
2963
3006
|
string(message);
|
|
2964
|
-
const result = invoke$
|
|
3007
|
+
const result = invoke$7('ConfirmPrompt.prompt', message);
|
|
2965
3008
|
return result;
|
|
2966
3009
|
};
|
|
2967
3010
|
|
|
@@ -6665,7 +6708,7 @@ const handleMessagePort2 = async (port, rpcId) => {
|
|
|
6665
6708
|
messagePort: port
|
|
6666
6709
|
});
|
|
6667
6710
|
if (rpcId) {
|
|
6668
|
-
set$
|
|
6711
|
+
set$e(rpcId, rpc);
|
|
6669
6712
|
}
|
|
6670
6713
|
};
|
|
6671
6714
|
|
|
@@ -6675,7 +6718,7 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
6675
6718
|
messagePort: port
|
|
6676
6719
|
});
|
|
6677
6720
|
if (rpcId) {
|
|
6678
|
-
set$
|
|
6721
|
+
set$e(rpcId, rpc);
|
|
6679
6722
|
}
|
|
6680
6723
|
};
|
|
6681
6724
|
|
|
@@ -7464,11 +7507,16 @@ const launchRendererWorker = async () => {
|
|
|
7464
7507
|
const rpc = await create$8({
|
|
7465
7508
|
commandMap: commandMap
|
|
7466
7509
|
});
|
|
7467
|
-
set$
|
|
7510
|
+
set$e(RendererWorker, rpc);
|
|
7468
7511
|
};
|
|
7469
7512
|
|
|
7470
7513
|
const listen = async () => {
|
|
7471
7514
|
await Promise.all([launchExtensionManagementWorker(), launchFileSearchWorker(), launchRendererWorker(), launchQuickPickWorker()]);
|
|
7515
|
+
const dialogRpc = await create$d({
|
|
7516
|
+
commandMap: {},
|
|
7517
|
+
send: sendMessagePortToDialogWorker
|
|
7518
|
+
});
|
|
7519
|
+
set$d(dialogRpc);
|
|
7472
7520
|
};
|
|
7473
7521
|
|
|
7474
7522
|
const main = async () => {
|
|
@@ -9,7 +9,7 @@ export { executeCompletionProvider, executeResolveCompletionItemProvider, getCom
|
|
|
9
9
|
export { executeDiagnosticProvider, getDiagnosticProviderRegistrySnapshot, registerDiagnosticProvider, resetDiagnosticProviderRegistry, } from './parts/Diagnostic/Diagnostic.ts';
|
|
10
10
|
export { executeFormattingProvider, getFormattingProviderRegistrySnapshot, registerFormattingProvider, resetFormattingProviderRegistry, } from './parts/Formatting/Formatting.ts';
|
|
11
11
|
export { exists, mkdir, readDirWithFileTypes, readFile, remove, stat, writeFile } from './parts/FileSystem/FileSystem.ts';
|
|
12
|
-
export { executeFileSystemProviderReadFile, getFileSystemProviderRegistrySnapshot, registerFileSystemProvider, resetFileSystemProviderRegistry, } from './parts/FileSystemProviderRegistry/FileSystemProviderRegistry.ts';
|
|
12
|
+
export { executeFileSystemProviderGetPathSeparator, executeFileSystemProviderIsReadonly, executeFileSystemProviderReadDirWithFileTypes, executeFileSystemProviderReadFile, getFileSystemProviderRegistrySnapshot, registerFileSystemProvider, resetFileSystemProviderRegistry, } from './parts/FileSystemProviderRegistry/FileSystemProviderRegistry.ts';
|
|
13
13
|
export { confirm, getWorkspaceFolder, getWorkspaceUri, handleWorkspaceRefresh, openUri } from './parts/Host/Host.ts';
|
|
14
14
|
export { executeHoverProvider, getHoverProviderRegistrySnapshot, registerHoverProvider, resetHoverProviderRegistry } from './parts/Hover/Hover.ts';
|
|
15
15
|
export { getPlatform, type Platform } from './parts/Platform/Platform.ts';
|
|
@@ -9,7 +9,7 @@ export { executeCompletionProvider, executeResolveCompletionItemProvider, getCom
|
|
|
9
9
|
export { executeDiagnosticProvider, getDiagnosticProviderRegistrySnapshot, registerDiagnosticProvider, resetDiagnosticProviderRegistry, } from "./parts/Diagnostic/Diagnostic.js";
|
|
10
10
|
export { executeFormattingProvider, getFormattingProviderRegistrySnapshot, registerFormattingProvider, resetFormattingProviderRegistry, } from "./parts/Formatting/Formatting.js";
|
|
11
11
|
export { exists, mkdir, readDirWithFileTypes, readFile, remove, stat, writeFile } from "./parts/FileSystem/FileSystem.js";
|
|
12
|
-
export { executeFileSystemProviderReadFile, getFileSystemProviderRegistrySnapshot, registerFileSystemProvider, resetFileSystemProviderRegistry, } from "./parts/FileSystemProviderRegistry/FileSystemProviderRegistry.js";
|
|
12
|
+
export { executeFileSystemProviderGetPathSeparator, executeFileSystemProviderIsReadonly, executeFileSystemProviderReadDirWithFileTypes, executeFileSystemProviderReadFile, getFileSystemProviderRegistrySnapshot, registerFileSystemProvider, resetFileSystemProviderRegistry, } from "./parts/FileSystemProviderRegistry/FileSystemProviderRegistry.js";
|
|
13
13
|
export { confirm, getWorkspaceFolder, getWorkspaceUri, handleWorkspaceRefresh, openUri } from "./parts/Host/Host.js";
|
|
14
14
|
export { executeHoverProvider, getHoverProviderRegistrySnapshot, registerHoverProvider, resetHoverProviderRegistry } from "./parts/Hover/Hover.js";
|
|
15
15
|
export { getPlatform } from "./parts/Platform/Platform.js";
|
|
@@ -6,6 +6,9 @@ export declare const commandMap: {
|
|
|
6
6
|
'ExtensionApi.executeCommand': (id: string, ...args: readonly unknown[]) => Promise<unknown>;
|
|
7
7
|
'ExtensionApi.executeCompletionProvider': (textDocument: import("../CompletionTextDocument/CompletionTextDocument.ts").TextDocument, offset: number, ...args: readonly unknown[]) => Promise<readonly import("../CompletionItem/CompletionItem.ts").CompletionItem[]>;
|
|
8
8
|
'ExtensionApi.executeDiagnosticProvider': (textDocument: import("../DiagnosticTextDocument/DiagnosticTextDocument.ts").TextDocument, ...args: readonly unknown[]) => Promise<readonly import("../DiagnosticResult/DiagnosticResult.ts").Diagnostic[]>;
|
|
9
|
+
'ExtensionApi.executeFileSystemProviderGetPathSeparator': (id: string) => string;
|
|
10
|
+
'ExtensionApi.executeFileSystemProviderIsReadonly': (id: string) => Promise<boolean>;
|
|
11
|
+
'ExtensionApi.executeFileSystemProviderReadDirWithFileTypes': (id: string, uri: string) => Promise<readonly import("../FileSystemDirent/FileSystemDirent.ts").FileSystemDirent[]>;
|
|
9
12
|
'ExtensionApi.executeFileSystemProviderReadFile': (id: string, uri: string) => Promise<string>;
|
|
10
13
|
'ExtensionApi.executeFormattingProvider': (textDocument: import("../FormattingTextDocument/FormattingTextDocument.ts").TextDocument, ...args: readonly unknown[]) => Promise<readonly import("../FormattingEdit/FormattingEdit.ts").FormattingEdit[]>;
|
|
11
14
|
'ExtensionApi.executeHoverProvider': (textDocument: import("../HoverTextDocument/HoverTextDocument.ts").TextDocument, offset: number, ...args: readonly unknown[]) => Promise<import("../HoverResult/HoverResult.ts").HoverResult | undefined>;
|
|
@@ -5,6 +5,9 @@ export declare const commandMap: {
|
|
|
5
5
|
'ExtensionApi.executeCommand': (id: string, ...args: readonly unknown[]) => Promise<unknown>;
|
|
6
6
|
'ExtensionApi.executeCompletionProvider': (textDocument: import("../CompletionTextDocument/CompletionTextDocument.ts").TextDocument, offset: number, ...args: readonly unknown[]) => Promise<readonly import("../CompletionItem/CompletionItem.ts").CompletionItem[]>;
|
|
7
7
|
'ExtensionApi.executeDiagnosticProvider': (textDocument: import("../DiagnosticTextDocument/DiagnosticTextDocument.ts").TextDocument, ...args: readonly unknown[]) => Promise<readonly import("../DiagnosticResult/DiagnosticResult.ts").Diagnostic[]>;
|
|
8
|
+
'ExtensionApi.executeFileSystemProviderGetPathSeparator': (id: string) => string;
|
|
9
|
+
'ExtensionApi.executeFileSystemProviderIsReadonly': (id: string) => Promise<boolean>;
|
|
10
|
+
'ExtensionApi.executeFileSystemProviderReadDirWithFileTypes': (id: string, uri: string) => Promise<readonly import("../FileSystemDirent/FileSystemDirent.ts").FileSystemDirent[]>;
|
|
8
11
|
'ExtensionApi.executeFileSystemProviderReadFile': (id: string, uri: string) => Promise<string>;
|
|
9
12
|
'ExtensionApi.executeFormattingProvider': (textDocument: import("../FormattingTextDocument/FormattingTextDocument.ts").TextDocument, ...args: readonly unknown[]) => Promise<readonly import("../FormattingEdit/FormattingEdit.ts").FormattingEdit[]>;
|
|
10
13
|
'ExtensionApi.executeHoverProvider': (textDocument: import("../HoverTextDocument/HoverTextDocument.ts").TextDocument, offset: number, ...args: readonly unknown[]) => Promise<import("../HoverResult/HoverResult.ts").HoverResult | undefined>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { executeCommand, getCommandRegistrySnapshot } from "../CommandRegistry/CommandRegistry.js";
|
|
2
2
|
import { executeCompletionProvider, executeResolveCompletionItemProvider, getCompletionProviderRegistrySnapshot } from "../Completion/Completion.js";
|
|
3
3
|
import { executeDiagnosticProvider, getDiagnosticProviderRegistrySnapshot } from "../Diagnostic/Diagnostic.js";
|
|
4
|
-
import { executeFileSystemProviderReadFile, getFileSystemProviderRegistrySnapshot } from "../FileSystemProviderRegistry/FileSystemProviderRegistry.js";
|
|
4
|
+
import { executeFileSystemProviderGetPathSeparator, executeFileSystemProviderIsReadonly, executeFileSystemProviderReadDirWithFileTypes, executeFileSystemProviderReadFile, getFileSystemProviderRegistrySnapshot, } from "../FileSystemProviderRegistry/FileSystemProviderRegistry.js";
|
|
5
5
|
import { executeFormattingProvider, getFormattingProviderRegistrySnapshot } from "../Formatting/Formatting.js";
|
|
6
6
|
import { getStatusBarItems } from "../GetStatusBarItems/GetStatusBarItems.js";
|
|
7
7
|
import { executeHoverProvider, getHoverProviderRegistrySnapshot } from "../Hover/Hover.js";
|
|
@@ -17,6 +17,9 @@ export const commandMap = {
|
|
|
17
17
|
'ExtensionApi.executeCommand': executeCommand,
|
|
18
18
|
'ExtensionApi.executeCompletionProvider': executeCompletionProvider,
|
|
19
19
|
'ExtensionApi.executeDiagnosticProvider': executeDiagnosticProvider,
|
|
20
|
+
'ExtensionApi.executeFileSystemProviderGetPathSeparator': executeFileSystemProviderGetPathSeparator,
|
|
21
|
+
'ExtensionApi.executeFileSystemProviderIsReadonly': executeFileSystemProviderIsReadonly,
|
|
22
|
+
'ExtensionApi.executeFileSystemProviderReadDirWithFileTypes': executeFileSystemProviderReadDirWithFileTypes,
|
|
20
23
|
'ExtensionApi.executeFileSystemProviderReadFile': executeFileSystemProviderReadFile,
|
|
21
24
|
'ExtensionApi.executeFormattingProvider': executeFormattingProvider,
|
|
22
25
|
'ExtensionApi.executeHoverProvider': executeHoverProvider,
|
package/extension-api/dist/parts/ExtensionApiWorkerCommandMap/ExtensionApiWorkerCommandMap.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export declare const commandMap: {
|
|
|
7
7
|
'ExtensionApi.executeCommand': (id: string, ...args: readonly unknown[]) => Promise<unknown>;
|
|
8
8
|
'ExtensionApi.executeCompletionProvider': (textDocument: import("../CompletionTextDocument/CompletionTextDocument.ts").TextDocument, offset: number, ...args: readonly unknown[]) => Promise<readonly import("../CompletionItem/CompletionItem.ts").CompletionItem[]>;
|
|
9
9
|
'ExtensionApi.executeDiagnosticProvider': (textDocument: import("../DiagnosticTextDocument/DiagnosticTextDocument.ts").TextDocument, ...args: readonly unknown[]) => Promise<readonly import("../DiagnosticResult/DiagnosticResult.ts").Diagnostic[]>;
|
|
10
|
+
'ExtensionApi.executeFileSystemProviderGetPathSeparator': (id: string) => string;
|
|
11
|
+
'ExtensionApi.executeFileSystemProviderIsReadonly': (id: string) => Promise<boolean>;
|
|
12
|
+
'ExtensionApi.executeFileSystemProviderReadDirWithFileTypes': (id: string, uri: string) => Promise<readonly import("../FileSystemDirent/FileSystemDirent.ts").FileSystemDirent[]>;
|
|
10
13
|
'ExtensionApi.executeFileSystemProviderReadFile': (id: string, uri: string) => Promise<string>;
|
|
11
14
|
'ExtensionApi.executeFormattingProvider': (textDocument: import("../FormattingTextDocument/FormattingTextDocument.ts").TextDocument, ...args: readonly unknown[]) => Promise<readonly import("../FormattingEdit/FormattingEdit.ts").FormattingEdit[]>;
|
|
12
15
|
'ExtensionApi.executeHoverProvider': (textDocument: import("../HoverTextDocument/HoverTextDocument.ts").TextDocument, offset: number, ...args: readonly unknown[]) => Promise<import("../HoverResult/HoverResult.ts").HoverResult | undefined>;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import type { FileSystemDirent } from '../FileSystemDirent/FileSystemDirent.ts';
|
|
1
2
|
export interface FileSystemProvider {
|
|
2
3
|
readonly id: string;
|
|
4
|
+
readonly isReadonly?: () => boolean | Promise<boolean>;
|
|
5
|
+
readonly pathSeparator?: string;
|
|
6
|
+
readonly readDirWithFileTypes?: (uri: string) => readonly FileSystemDirent[] | Promise<readonly FileSystemDirent[]>;
|
|
3
7
|
readonly readFile: (uri: string) => string | Promise<string>;
|
|
4
8
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { Disposable } from '../Disposable/Disposable.ts';
|
|
2
|
+
import type { FileSystemDirent } from '../FileSystemDirent/FileSystemDirent.ts';
|
|
2
3
|
import type { FileSystemProvider } from '../FileSystemProvider/FileSystemProvider.ts';
|
|
3
4
|
import type { FileSystemProviderRegistrySnapshot } from '../FileSystemProviderRegistrySnapshot/FileSystemProviderRegistrySnapshot.ts';
|
|
4
5
|
export declare const executeFileSystemProviderReadFile: (id: string, uri: string) => Promise<string>;
|
|
6
|
+
export declare const executeFileSystemProviderReadDirWithFileTypes: (id: string, uri: string) => Promise<readonly FileSystemDirent[]>;
|
|
7
|
+
export declare const executeFileSystemProviderGetPathSeparator: (id: string) => string;
|
|
8
|
+
export declare const executeFileSystemProviderIsReadonly: (id: string) => Promise<boolean>;
|
|
5
9
|
export declare const getFileSystemProviderRegistrySnapshot: () => FileSystemProviderRegistrySnapshot;
|
|
6
10
|
export declare const registerFileSystemProvider: (provider: FileSystemProvider) => Disposable;
|
|
7
11
|
export declare const resetFileSystemProviderRegistry: () => void;
|
|
@@ -10,6 +10,15 @@ const assertFileSystemProvider = (provider) => {
|
|
|
10
10
|
if (typeof provider.readFile !== 'function') {
|
|
11
11
|
throw new ExtensionApiError(`file system provider ${provider.id} is missing readFile function`);
|
|
12
12
|
}
|
|
13
|
+
if (provider.readDirWithFileTypes !== undefined && typeof provider.readDirWithFileTypes !== 'function') {
|
|
14
|
+
throw new ExtensionApiError(`file system provider ${provider.id} has invalid readDirWithFileTypes function`);
|
|
15
|
+
}
|
|
16
|
+
if (provider.isReadonly !== undefined && typeof provider.isReadonly !== 'function') {
|
|
17
|
+
throw new ExtensionApiError(`file system provider ${provider.id} has invalid isReadonly function`);
|
|
18
|
+
}
|
|
19
|
+
if (provider.pathSeparator !== undefined && typeof provider.pathSeparator !== 'string') {
|
|
20
|
+
throw new ExtensionApiError(`file system provider ${provider.id} has invalid pathSeparator`);
|
|
21
|
+
}
|
|
13
22
|
if (provider.id in providers) {
|
|
14
23
|
throw new ExtensionApiError(`file system provider ${provider.id} is already registered`);
|
|
15
24
|
}
|
|
@@ -24,6 +33,20 @@ const getProvider = (id) => {
|
|
|
24
33
|
export const executeFileSystemProviderReadFile = async (id, uri) => {
|
|
25
34
|
return getProvider(id).readFile(uri);
|
|
26
35
|
};
|
|
36
|
+
export const executeFileSystemProviderReadDirWithFileTypes = async (id, uri) => {
|
|
37
|
+
const provider = getProvider(id);
|
|
38
|
+
if (!provider.readDirWithFileTypes) {
|
|
39
|
+
throw new ExtensionApiError(`file system provider ${id} is missing readDirWithFileTypes function`);
|
|
40
|
+
}
|
|
41
|
+
return provider.readDirWithFileTypes(uri);
|
|
42
|
+
};
|
|
43
|
+
export const executeFileSystemProviderGetPathSeparator = (id) => {
|
|
44
|
+
return getProvider(id).pathSeparator || '/';
|
|
45
|
+
};
|
|
46
|
+
export const executeFileSystemProviderIsReadonly = async (id) => {
|
|
47
|
+
const provider = getProvider(id);
|
|
48
|
+
return provider.isReadonly ? provider.isReadonly() : false;
|
|
49
|
+
};
|
|
27
50
|
export const getFileSystemProviderRegistrySnapshot = () => {
|
|
28
51
|
return {
|
|
29
52
|
providers: Object.values(providers).map((provider) => ({
|
|
@@ -35,6 +58,9 @@ export const registerFileSystemProvider = (provider) => {
|
|
|
35
58
|
assertFileSystemProvider(provider);
|
|
36
59
|
providers[provider.id] = {
|
|
37
60
|
id: provider.id,
|
|
61
|
+
isReadonly: provider.isReadonly,
|
|
62
|
+
pathSeparator: provider.pathSeparator,
|
|
63
|
+
readDirWithFileTypes: provider.readDirWithFileTypes,
|
|
38
64
|
readFile: (uri) => provider.readFile(uri),
|
|
39
65
|
};
|
|
40
66
|
return {
|
package/extension-api/dist/parts/RegisteredFileSystemProvider/RegisteredFileSystemProvider.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import type { FileSystemDirent } from '../FileSystemDirent/FileSystemDirent.ts';
|
|
1
2
|
export interface RegisteredFileSystemProvider {
|
|
2
3
|
readonly id: string;
|
|
4
|
+
readonly isReadonly?: () => boolean | Promise<boolean>;
|
|
5
|
+
readonly pathSeparator?: string;
|
|
6
|
+
readonly readDirWithFileTypes?: (uri: string) => readonly FileSystemDirent[] | Promise<readonly FileSystemDirent[]>;
|
|
3
7
|
readonly readFile: (uri: string) => string | Promise<string>;
|
|
4
8
|
}
|