• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript files.isParent函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中vs/platform/files/common/files.isParent函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isParent函数的具体用法?TypeScript isParent怎么用?TypeScript isParent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了isParent函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: getWorkspaceLabel

export function getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier), environmentService: IEnvironmentService, uriDisplayService: IUriDisplayService, options?: { verbose: boolean }): string {

	// Workspace: Single Folder
	if (isSingleFolderWorkspaceIdentifier(workspace)) {
		// Folder on disk
		if (workspace.scheme === Schemas.file) {
			return options && options.verbose ? uriDisplayService.getLabel(workspace) : getBaseLabel(workspace);
		}

		// Remote folder
		return options && options.verbose ? uriDisplayService.getLabel(workspace) : `${getBaseLabel(workspace)} (${workspace.scheme})`;
	}

	// Workspace: Untitled
	if (isParent(workspace.configPath, environmentService.workspacesHome, !isLinux /* ignore case */)) {
		return localize('untitledWorkspace', "Untitled (Workspace)");
	}

	// Workspace: Saved
	const filename = basename(workspace.configPath);
	const workspaceName = filename.substr(0, filename.length - WORKSPACE_EXTENSION.length - 1);
	if (options && options.verbose) {
		return localize('workspaceNameVerbose', "{0} (Workspace)", uriDisplayService.getLabel(URI.file(join(dirname(workspace.configPath), workspaceName))));
	}

	return localize('workspaceName', "{0} (Workspace)", workspaceName);
}
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:27,代码来源:workspaces.ts


示例2: getWorkspaceLabel

export function getWorkspaceLabel(environmentService: IEnvironmentService, workspace: IWorkspaceIdentifier): string {
	if (isParent(workspace.configPath, environmentService.workspacesHome, !isLinux /* ignore case */)) {
		return localize('untitledWorkspace', "Untitled Workspace");
	}

	const filename = basename(workspace.configPath);
	const workspaceName = filename.substr(0, filename.length - WORKSPACE_EXTENSION.length - 1);

	return localize('workspaceName', "{0} (Workspace)", workspaceName);
}
开发者ID:naturtle,项目名称:vscode,代码行数:10,代码来源:workspaces.ts


示例3: getSimpleWorkspaceLabel

export function getSimpleWorkspaceLabel(workspace: IWorkspaceIdentifier | URI, workspaceHome: string): string {
	if (isSingleFolderWorkspaceIdentifier(workspace)) {
		return resourceBasename(workspace);
	}
	// Workspace: Untitled
	if (isParent(workspace.configPath, workspaceHome, !isLinux /* ignore case */)) {
		return localize('untitledWorkspace', "Untitled (Workspace)");
	}

	const filename = basename(workspace.configPath);
	const workspaceName = filename.substr(0, filename.length - WORKSPACE_EXTENSION.length - 1);
	return localize('workspaceName', "{0} (Workspace)", workspaceName);
}
开发者ID:VishalMadhvani,项目名称:vscode,代码行数:13,代码来源:label.ts


示例4: getEncodingOverride

	private getEncodingOverride(resource: uri): string | null {
		if (resource && this.encodingOverride && this.encodingOverride.length) {
			for (const override of this.encodingOverride) {

				// check if the resource is child of encoding override path
				if (override.parent && isParent(resource.fsPath, override.parent.fsPath, !isLinux /* ignorecase */)) {
					return override.encoding;
				}

				// check if the resource extension is equal to encoding override
				if (override.extension && extname(resource.fsPath) === `.${override.extension}`) {
					return override.encoding;
				}
			}
		}

		return null;
	}
开发者ID:joelday,项目名称:vscode,代码行数:18,代码来源:encoding.ts


示例5: getWorkspaceLabel

export function getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier), environmentService: IEnvironmentService, options?: { verbose: boolean }): string {

	// Workspace: Single Folder
	if (isSingleFolderWorkspaceIdentifier(workspace)) {
		return tildify(workspace, environmentService.userHome);
	}

	// Workspace: Untitled
	if (isParent(workspace.configPath, environmentService.workspacesHome, !isLinux /* ignore case */)) {
		return localize('untitledWorkspace', "Untitled (Workspace)");
	}

	// Workspace: Saved
	const filename = basename(workspace.configPath);
	const workspaceName = filename.substr(0, filename.length - WORKSPACE_EXTENSION.length - 1);
	if (options && options.verbose) {
		return localize('workspaceNameVerbose', "{0} (Workspace)", getPathLabel(join(dirname(workspace.configPath), workspaceName), null, environmentService));
	}

	return localize('workspaceName', "{0} (Workspace)", workspaceName);
}
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:21,代码来源:workspaces.ts


示例6: isUntitledWorkspace

function isUntitledWorkspace(path: string, environmentService: IEnvironmentService): boolean {
	return isParent(path, environmentService.workspacesHome, !isLinux /* ignore case */);
}
开发者ID:JarnoNijboer,项目名称:vscode,代码行数:3,代码来源:workspaceCommands.ts


示例7: test

	test('isParent (ignorecase)', function () {
		if (isWindows) {
			assert(isParent('c:\\some\\path', 'c:\\', true));
			assert(isParent('c:\\some\\path', 'c:\\some', true));
			assert(isParent('c:\\some\\path', 'c:\\some\\', true));
			assert(isParent('c:\\someöäü\\path', 'c:\\someöäü', true));
			assert(isParent('c:\\someöäü\\path', 'c:\\someöäü\\', true));
			assert(isParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\bar', true));
			assert(isParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\bar\\', true));

			assert(isParent('c:\\some\\path', 'C:\\', true));
			assert(isParent('c:\\some\\path', 'c:\\SOME', true));
			assert(isParent('c:\\some\\path', 'c:\\SOME\\', true));

			assert(!isParent('c:\\some\\path', 'd:\\', true));
			assert(!isParent('c:\\some\\path', 'c:\\some\\path', true));
			assert(!isParent('c:\\some\\path', 'd:\\some\\path', true));
			assert(!isParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\barr', true));
			assert(!isParent('c:\\foo\\bar\\test.ts', 'c:\\foo\\bar\\test', true));
		}

		if (isMacintosh || isLinux) {
			assert(isParent('/some/path', '/', true));
			assert(isParent('/some/path', '/some', true));
			assert(isParent('/some/path', '/some/', true));
			assert(isParent('/someöäü/path', '/someöäü', true));
			assert(isParent('/someöäü/path', '/someöäü/', true));
			assert(isParent('/foo/bar/test.ts', '/foo/bar', true));
			assert(isParent('/foo/bar/test.ts', '/foo/bar/', true));

			assert(isParent('/some/path', '/SOME', true));
			assert(isParent('/some/path', '/SOME/', true));
			assert(isParent('/someöäü/path', '/SOMEÖÄÜ', true));
			assert(isParent('/someöäü/path', '/SOMEÖÄÜ/', true));

			assert(!isParent('/some/path', '/some/path', true));
			assert(!isParent('/foo/bar/test.ts', '/foo/barr', true));
			assert(!isParent('/foo/bar/test.ts', '/foo/bar/test', true));
		}
	});
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:40,代码来源:files.test.ts


示例8:

			if (deletedPaths.some(d => isParent(e.path, d))) {
开发者ID:StateFarmIns,项目名称:vscode,代码行数:1,代码来源:common.ts


示例9:

			if (deletedPaths.some(d => isParent(e.path, d, !isLinux /* ignorecase */))) {
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:1,代码来源:common.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript files.FileChangesEvent类代码示例发布时间:2022-05-25
下一篇:
TypeScript files.isEqualOrParent函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap