当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript files.isEqualOrParent函数代码示例

本文整理汇总了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;
	}
开发者ID:FabianLauer,项目名称:vscode,代码行数:7,代码来源:workspace.ts

示例2: isInsideWorkspace

	public isInsideWorkspace(resource: URI): boolean {
		if (resource && this.workspace) {
			return isEqualOrParent(resource.fsPath, this.workspace.resource.fsPath, !isLinux /* ignorecase */);
		}

		return false;
	}
开发者ID:hungys,项目名称:vscode,代码行数:7,代码来源:workspace.ts

示例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));
		}
	});
开发者ID:FabianLauer,项目名称:vscode,代码行数:49,代码来源:files.test.ts

示例4: isEqualOrParent

	const containers = windows.filter(window => typeof window.openedWorkspacePath === 'string' && isEqualOrParent(filePath, window.openedWorkspacePath, !platform.isLinux /* ignorecase */));
开发者ID:hungys,项目名称:vscode,代码行数:1,代码来源:windowsUtils.ts


注:本文中的vs/platform/files/common/files.isEqualOrParent函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。