mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 18:46:36 -05:00
Merge from vscode 2e5312cd61ff99c570299ecc122c52584265eda2
This commit is contained in:
committed by
Anthony Dresser
parent
3603f55d97
commit
7f1d8fc32f
@@ -182,21 +182,21 @@ export class FileService extends Disposable implements IFileService {
|
||||
|
||||
const stat = await provider.stat(resource);
|
||||
|
||||
let trie: TernarySearchTree<string, boolean> | undefined;
|
||||
let trie: TernarySearchTree<URI, boolean> | undefined;
|
||||
|
||||
return this.toFileStat(provider, resource, stat, undefined, !!resolveMetadata, (stat, siblings) => {
|
||||
|
||||
// lazy trie to check for recursive resolving
|
||||
if (!trie) {
|
||||
trie = TernarySearchTree.forPaths<true>();
|
||||
trie.set(resource.toString(), true);
|
||||
trie = TernarySearchTree.forUris<true>();
|
||||
trie.set(resource, true);
|
||||
if (isNonEmptyArray(resolveTo)) {
|
||||
resolveTo.forEach(uri => trie!.set(uri.toString(), true));
|
||||
resolveTo.forEach(uri => trie!.set(uri, true));
|
||||
}
|
||||
}
|
||||
|
||||
// check for recursive resolving
|
||||
if (Boolean(trie.findSuperstr(stat.resource.toString()) || trie.get(stat.resource.toString()))) {
|
||||
if (Boolean(trie.findSuperstr(stat.resource) || trie.get(stat.resource))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -416,11 +416,7 @@ suite('Disk File Service', function () {
|
||||
assert.equal(r2.name, 'deep');
|
||||
});
|
||||
|
||||
test('resolve - folder symbolic link', async () => {
|
||||
if (isWindows) {
|
||||
return; // not reliable on windows
|
||||
}
|
||||
|
||||
(isWindows /* not reliable on windows */ ? test.skip : test)('resolve - folder symbolic link', async () => {
|
||||
const link = URI.file(join(testDir, 'deep-link'));
|
||||
await symlink(join(testDir, 'deep'), link.fsPath);
|
||||
|
||||
@@ -430,11 +426,7 @@ suite('Disk File Service', function () {
|
||||
assert.equal(resolved.isSymbolicLink, true);
|
||||
});
|
||||
|
||||
test('resolve - file symbolic link', async () => {
|
||||
if (isWindows) {
|
||||
return; // not reliable on windows
|
||||
}
|
||||
|
||||
(isWindows /* not reliable on windows */ ? test.skip : test)('resolve - file symbolic link', async () => {
|
||||
const link = URI.file(join(testDir, 'lorem.txt-linked'));
|
||||
await symlink(join(testDir, 'lorem.txt'), link.fsPath);
|
||||
|
||||
@@ -443,11 +435,7 @@ suite('Disk File Service', function () {
|
||||
assert.equal(resolved.isSymbolicLink, true);
|
||||
});
|
||||
|
||||
test('resolve - symbolic link pointing to non-existing file does not break', async () => {
|
||||
if (isWindows) {
|
||||
return; // not reliable on windows
|
||||
}
|
||||
|
||||
(isWindows /* not reliable on windows */ ? test.skip : test)('resolve - symbolic link pointing to non-existing file does not break', async () => {
|
||||
await symlink(join(testDir, 'foo'), join(testDir, 'bar'));
|
||||
|
||||
const resolved = await service.resolve(URI.file(testDir));
|
||||
@@ -495,11 +483,7 @@ suite('Disk File Service', function () {
|
||||
assert.equal((<FileOperationError>error).fileOperationResult, FileOperationResult.FILE_NOT_FOUND);
|
||||
}
|
||||
|
||||
test('deleteFile - symbolic link (exists)', async () => {
|
||||
if (isWindows) {
|
||||
return; // not reliable on windows
|
||||
}
|
||||
|
||||
(isWindows /* not reliable on windows */ ? test.skip : test)('deleteFile - symbolic link (exists)', async () => {
|
||||
const target = URI.file(join(testDir, 'lorem.txt'));
|
||||
const link = URI.file(join(testDir, 'lorem.txt-linked'));
|
||||
await symlink(target.fsPath, link.fsPath);
|
||||
@@ -520,11 +504,7 @@ suite('Disk File Service', function () {
|
||||
assert.equal(existsSync(target.fsPath), true); // target the link pointed to is never deleted
|
||||
});
|
||||
|
||||
test('deleteFile - symbolic link (pointing to non-existing file)', async () => {
|
||||
if (isWindows) {
|
||||
return; // not reliable on windows
|
||||
}
|
||||
|
||||
(isWindows /* not reliable on windows */ ? test.skip : test)('deleteFile - symbolic link (pointing to non-existing file)', async () => {
|
||||
const target = URI.file(join(testDir, 'foo'));
|
||||
const link = URI.file(join(testDir, 'bar'));
|
||||
await symlink(target.fsPath, link.fsPath);
|
||||
@@ -1409,11 +1389,7 @@ suite('Disk File Service', function () {
|
||||
assert.equal(error!.fileOperationResult, FileOperationResult.FILE_IS_DIRECTORY);
|
||||
});
|
||||
|
||||
test('readFile - FILE_NOT_DIRECTORY', async () => {
|
||||
if (isWindows) {
|
||||
return; // error code does not seem to be supported on windows
|
||||
}
|
||||
|
||||
(isWindows /* error code does not seem to be supported on windows */ ? test.skip : test)('readFile - FILE_NOT_DIRECTORY', async () => {
|
||||
const resource = URI.file(join(testDir, 'lorem.txt', 'file.txt'));
|
||||
|
||||
let error: FileOperationError | undefined = undefined;
|
||||
@@ -1525,10 +1501,10 @@ suite('Disk File Service', function () {
|
||||
|
||||
// Also test when the stat size is wrong
|
||||
fileProvider.setSmallStatSize(true);
|
||||
return doTestFileExceedsMemoryLimit(false);
|
||||
return doTestFileExceedsMemoryLimit();
|
||||
}
|
||||
|
||||
async function doTestFileExceedsMemoryLimit(testTotalBytesRead = true) {
|
||||
async function doTestFileExceedsMemoryLimit() {
|
||||
const resource = URI.file(join(testDir, 'index.html'));
|
||||
|
||||
let error: FileOperationError | undefined = undefined;
|
||||
@@ -1540,10 +1516,6 @@ suite('Disk File Service', function () {
|
||||
|
||||
assert.ok(error);
|
||||
assert.equal(error!.fileOperationResult, FileOperationResult.FILE_EXCEEDS_MEMORY_LIMIT);
|
||||
|
||||
if (testTotalBytesRead) {
|
||||
assert.equal(fileProvider.totalBytesRead, 0);
|
||||
}
|
||||
}
|
||||
|
||||
test('readFile - FILE_TOO_LARGE - default', async () => {
|
||||
@@ -1569,7 +1541,7 @@ suite('Disk File Service', function () {
|
||||
});
|
||||
|
||||
async function testFileTooLarge() {
|
||||
await doTestFileExceedsMemoryLimit();
|
||||
await doTestFileTooLarge();
|
||||
|
||||
// Also test when the stat size is wrong
|
||||
fileProvider.setSmallStatSize(true);
|
||||
|
||||
Reference in New Issue
Block a user