本文整理汇总了TypeScript中vs/base/common/labels.getBaseLabel函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getBaseLabel函数的具体用法?TypeScript getBaseLabel怎么用?TypeScript getBaseLabel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getBaseLabel函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: test
test('getBaseLabel - unix', () => {
if (platform.isWindows) {
assert.ok(true);
return;
}
assert.equal(labels.getBaseLabel('/some/folder/file.txt'), 'file.txt');
assert.equal(labels.getBaseLabel('/some/folder'), 'folder');
assert.equal(labels.getBaseLabel('/'), '/');
});
开发者ID:PKRoma,项目名称:vscode,代码行数:10,代码来源:labels.test.ts
示例3: setFile
public setFile(file: uri, provider: IWorkspaceFolderProvider, userHome: IUserHomeProvider): void {
const parent = paths.dirname(file.fsPath);
this.setValue(getBaseLabel(file), parent && parent !== '.' ? getPathLabel(parent, provider, userHome) : '', { title: file.fsPath });
}
开发者ID:sameer-coder,项目名称:vscode,代码行数:5,代码来源:iconLabel.ts
注:本文中的vs/base/common/labels.getBaseLabel函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论