@lvce-editor/extension-host-worker 5.19.0 → 5.21.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.
|
@@ -1113,7 +1113,7 @@ const rename$1 = async (protocol, oldUri, newUri) => {
|
|
|
1113
1113
|
throw new VError(error, 'Failed to execute file system provider');
|
|
1114
1114
|
}
|
|
1115
1115
|
};
|
|
1116
|
-
const writeFile$
|
|
1116
|
+
const writeFile$3 = async (protocol, uri, content) => {
|
|
1117
1117
|
try {
|
|
1118
1118
|
const provider = get$a(protocol);
|
|
1119
1119
|
return await provider.writeFile(uri, content);
|
|
@@ -2540,21 +2540,42 @@ const append = async (uri, content) => {
|
|
|
2540
2540
|
const rpc = await getOrCreateRpc$1();
|
|
2541
2541
|
await rpc.invoke('FileSystem.appendFile', uri, content);
|
|
2542
2542
|
};
|
|
2543
|
+
const writeFile$2 = async (uri, content) => {
|
|
2544
|
+
const rpc = await getOrCreateRpc$1();
|
|
2545
|
+
await rpc.invoke('FileSystem.writeFile', uri, content);
|
|
2546
|
+
};
|
|
2543
2547
|
|
|
2544
|
-
const providers = Object.create(null);
|
|
2545
2548
|
const getOutputFilePath = id => {
|
|
2546
2549
|
const outputFolderPath = 'file:///tmp';
|
|
2547
2550
|
const uri = `${outputFolderPath}/${id}.txt`;
|
|
2548
2551
|
return uri;
|
|
2549
2552
|
};
|
|
2553
|
+
|
|
2554
|
+
const providers = Object.create(null);
|
|
2550
2555
|
const registerOutputChannel = provider => {
|
|
2556
|
+
if (!provider) {
|
|
2557
|
+
throw new Error(`provider is required`);
|
|
2558
|
+
}
|
|
2559
|
+
if (!provider.id) {
|
|
2560
|
+
throw new Error('provider.id is required');
|
|
2561
|
+
}
|
|
2562
|
+
if (!provider.label) {
|
|
2563
|
+
throw new Error('provider.label is required');
|
|
2564
|
+
}
|
|
2551
2565
|
const uri = getOutputFilePath(provider.id);
|
|
2552
2566
|
providers[provider.id] = {
|
|
2553
|
-
...provider
|
|
2567
|
+
...provider,
|
|
2568
|
+
uri
|
|
2554
2569
|
};
|
|
2570
|
+
let isFirst = true;
|
|
2555
2571
|
return {
|
|
2556
2572
|
async append(text) {
|
|
2557
|
-
|
|
2573
|
+
// TODO race condition?
|
|
2574
|
+
if (isFirst) {
|
|
2575
|
+
isFirst = false;
|
|
2576
|
+
await writeFile$2(uri, '');
|
|
2577
|
+
}
|
|
2578
|
+
await append(uri, text + '\n');
|
|
2558
2579
|
},
|
|
2559
2580
|
getUri() {
|
|
2560
2581
|
return uri;
|
|
@@ -6061,7 +6082,7 @@ const commandMap = {
|
|
|
6061
6082
|
[FileSystemReadDirWithFileTypes]: readDirWithFileTypes$2,
|
|
6062
6083
|
[FileSystemReadFile]: readFile$2,
|
|
6063
6084
|
[FileSystemRename]: rename$1,
|
|
6064
|
-
[FileSystemWriteFile]: writeFile$
|
|
6085
|
+
[FileSystemWriteFile]: writeFile$3,
|
|
6065
6086
|
[FormattingExecuteFormmattingProvider]: executeFormattingProvider,
|
|
6066
6087
|
[HoverExecute]: executeHoverProvider,
|
|
6067
6088
|
[ImplementationExecuteImplementationProvider]: executeImplementationProvider,
|