本文整理汇总了TypeScript中vs/base/common/uri.with函数的典型用法代码示例。如果您正苦于以下问题:TypeScript with函数的具体用法?TypeScript with怎么用?TypeScript with使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了with函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
savePromise = textFileService.save(resource).then((result) => {
if (result) {
return resource.with({ scheme: Schemas.file });
}
return null;
});
开发者ID:liunian,项目名称:vscode,代码行数:7,代码来源:fileCommands.ts
示例2: dirname
export function dirname(resource: uri): uri {
const dirname = paths.dirname(resource.path);
if (resource.authority && dirname && !paths.isAbsolute(dirname)) {
return null; // If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character
}
return resource.with({
path: dirname
});
}
开发者ID:jinlongchen2018,项目名称:vscode,代码行数:10,代码来源:resources.ts
示例3: getPathLabel
export function getPathLabel(resource: URI | string, userHomeProvider: IUserHomeProvider, rootProvider?: IWorkspaceFolderProvider): string {
if (!resource) {
return null;
}
if (typeof resource === 'string') {
resource = URI.file(resource);
}
// return early if we can resolve a relative path label from the root
const baseResource = rootProvider ? rootProvider.getWorkspaceFolder(resource) : null;
if (baseResource) {
const hasMultipleRoots = rootProvider.getWorkspace().folders.length > 1;
let pathLabel: string;
if (isEqual(baseResource.uri, resource, !isLinux)) {
pathLabel = ''; // no label if paths are identical
} else {
pathLabel = normalize(ltrim(resource.path.substr(baseResource.uri.path.length), sep), true);
}
if (hasMultipleRoots) {
const rootName = (baseResource && baseResource.name) ? baseResource.name : pathsBasename(baseResource.uri.fsPath);
pathLabel = pathLabel ? (rootName + ' ⢠' + pathLabel) : rootName; // always show root basename if there are multiple
}
return pathLabel;
}
// return if the resource is neither file:// nor untitled:// and no baseResource was provided
if (resource.scheme !== Schemas.file && resource.scheme !== Schemas.untitled) {
return resource.with({ query: null, fragment: null }).toString(true);
}
// convert c:\something => C:\something
if (hasDriveLetter(resource.fsPath)) {
return normalize(normalizeDriveLetter(resource.fsPath), true);
}
// normalize and tildify (macOS, Linux only)
let res = normalize(resource.fsPath, true);
if (!isWindows && userHomeProvider) {
res = tildify(res, userHomeProvider.userHome);
}
return res;
}
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:47,代码来源:labels.ts
示例4: joinPath
export function joinPath(resource: uri, pathFragment: string): uri {
const joinedPath = paths.join(resource.path || '/', pathFragment);
return resource.with({
path: joinedPath
});
}
开发者ID:jinlongchen2018,项目名称:vscode,代码行数:6,代码来源:resources.ts
示例5:
.then(info => {
return uri.with({ query: `${uri.query ? uri.query + '&' : ''}utm_source=VsCode&utm_medium=${encodeURIComponent(origin)}&utm_campaign=${encodeURIComponent(info.instanceId)}&utm_content=${encodeURIComponent(experiment)}` });
});
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:3,代码来源:telemetryNodeUtils.ts
示例6: dirname
export function dirname(resource: uri): uri {
return resource.with({
path: paths.dirname(resource.path)
});
}
开发者ID:jamesforest,项目名称:vscode,代码行数:5,代码来源:resources.ts
注:本文中的vs/base/common/uri.with函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论