Perf: register a file provider in the ext host to avoid certain roundtrips (#181107)

* register a `file` provider in the ext host

* fix tests

* comments

* address feedback
This commit is contained in:
Benjamin Pasero
2023-04-28 17:31:54 +02:00
committed by GitHub
parent 2df199f873
commit 71bb936e87
3 changed files with 122 additions and 5 deletions

View File

@@ -57,7 +57,7 @@ suite('vscode API - workspace-fs', () => {
}
});
test('fs.write/stat/delete', async function () {
test('fs.write/stat/read/delete', async function () {
const uri = root.with({ path: posix.join(root.path, 'new.file') });
await vscode.workspace.fs.writeFile(uri, Buffer.from('HELLO'));
@@ -65,6 +65,9 @@ suite('vscode API - workspace-fs', () => {
const stat = await vscode.workspace.fs.stat(uri);
assert.strictEqual(stat.type, vscode.FileType.File);
const contents = await vscode.workspace.fs.readFile(uri);
assert.strictEqual(Buffer.from(contents).toString(), 'HELLO');
await vscode.workspace.fs.delete(uri);
try {
@@ -122,7 +125,7 @@ suite('vscode API - workspace-fs', () => {
}
});
test('throws FileSystemError', async function () {
test('throws FileSystemError (1)', async function () {
try {
await vscode.workspace.fs.stat(vscode.Uri.file(`/c468bf16-acfd-4591-825e-2bcebba508a3/71b1f274-91cb-4c19-af00-8495eaab4b73/4b60cb48-a6f2-40ea-9085-0936f4a8f59a.tx6`));
@@ -133,7 +136,7 @@ suite('vscode API - workspace-fs', () => {
}
});
test('throws FileSystemError', async function () {
test('throws FileSystemError (2)', async function () {
try {
await vscode.workspace.fs.stat(vscode.Uri.parse('foo:/bar'));
@@ -144,7 +147,7 @@ suite('vscode API - workspace-fs', () => {
}
});
test('vscode.workspace.fs.remove() (and copy()) succeed unexpectedly. #84177', async function () {
test('vscode.workspace.fs.remove() (and copy()) succeed unexpectedly. #84177 (1)', async function () {
const entries = await vscode.workspace.fs.readDirectory(root);
assert.ok(entries.length > 0);
@@ -158,7 +161,7 @@ suite('vscode API - workspace-fs', () => {
}
});
test('vscode.workspace.fs.remove() (and copy()) succeed unexpectedly. #84177', async function () {
test('vscode.workspace.fs.remove() (and copy()) succeed unexpectedly. #84177 (2)', async function () {
const entries = await vscode.workspace.fs.readDirectory(root);
assert.ok(entries.length > 0);