本文整理匯總了TypeScript中vs/platform/files/common/files.isEqualOrParent函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript isEqualOrParent函數的具體用法?TypeScript isEqualOrParent怎麽用?TypeScript isEqualOrParent使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了isEqualOrParent函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: contains
private contains(resource: URI): boolean {
if (resource) {
return isEqualOrParent(resource.fsPath, this._resource.fsPath, !isLinux /* ignorecase */);
}
return false;
}
示例2: isInsideWorkspace
public isInsideWorkspace(resource: URI): boolean {
if (resource && this.workspace) {
return isEqualOrParent(resource.fsPath, this.workspace.resource.fsPath, !isLinux /* ignorecase */);
}
return false;
}
示例3: test
test('isEqualOrParent (ignorecase)', function () {
// same assertions apply as with isEqual()
testIsEqual(isEqualOrParent);
if (isWindows) {
assert(isEqualOrParent('c:\\some\\path', 'c:\\', true));
assert(isEqualOrParent('c:\\some\\path', 'c:\\some', true));
assert(isEqualOrParent('c:\\some\\path', 'c:\\some\\', true));
assert(isEqualOrParent('c:\\someöäü\\path', 'c:\\someöäü', true));
assert(isEqualOrParent('c:\\someöäü\\path', 'c:\\someöäü\\', true));
assert(isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\bar', true));
assert(isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\bar\\', true));
assert(isEqualOrParent('c:\\some\\path', 'c:\\some\\path', true));
assert(isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\bar\\test.ts', true));
assert(isEqualOrParent('c:\\some\\path', 'C:\\', true));
assert(isEqualOrParent('c:\\some\\path', 'c:\\SOME', true));
assert(isEqualOrParent('c:\\some\\path', 'c:\\SOME\\', true));
assert(!isEqualOrParent('c:\\some\\path', 'd:\\', true));
assert(!isEqualOrParent('c:\\some\\path', 'd:\\some\\path', true));
assert(!isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\barr', true));
assert(!isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\bar\\test', true));
assert(!isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\bar\\test.', true));
assert(!isEqualOrParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\BAR\\test.', true));
}
if (isMacintosh || isLinux) {
assert(isEqualOrParent('/some/path', '/', true));
assert(isEqualOrParent('/some/path', '/some', true));
assert(isEqualOrParent('/some/path', '/some/', true));
assert(isEqualOrParent('/someöäü/path', '/someöäü', true));
assert(isEqualOrParent('/someöäü/path', '/someöäü/', true));
assert(isEqualOrParent('/foo/bar/test.ts', '/foo/bar', true));
assert(isEqualOrParent('/foo/bar/test.ts', '/foo/bar/', true));
assert(isEqualOrParent('/some/path', '/some/path', true));
assert(isEqualOrParent('/some/path', '/SOME', true));
assert(isEqualOrParent('/some/path', '/SOME/', true));
assert(isEqualOrParent('/someöäü/path', '/SOMEÖÄÜ', true));
assert(isEqualOrParent('/someöäü/path', '/SOMEÖÄÜ/', true));
assert(!isEqualOrParent('/foo/bar/test.ts', '/foo/barr', true));
assert(!isEqualOrParent('/foo/bar/test.ts', '/foo/bar/test', true));
assert(!isEqualOrParent('foo/bar/test.ts', 'foo/bar/test.', true));
assert(!isEqualOrParent('foo/bar/test.ts', 'foo/BAR/test.', true));
}
});
示例4: isEqualOrParent
const containers = windows.filter(window => typeof window.openedWorkspacePath === 'string' && isEqualOrParent(filePath, window.openedWorkspacePath, !platform.isLinux /* ignorecase */));