本文整理汇总了TypeScript中vscode.Uri.with方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Uri.with方法的具体用法?TypeScript Uri.with怎么用?TypeScript Uri.with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vscode.Uri
的用法示例。
在下文中一共展示了Uri.with方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: toGitUri
export function toGitUri(uri: Uri, ref: string, replaceFileExtension = false): Uri {
return uri.with({
scheme: 'git',
path: replaceFileExtension ? `${uri.path}.git` : uri.path,
query: JSON.stringify({
path: uri.fsPath,
ref
})
});
}
示例2: openFile
@command('git.openFile')
async openFile(uri: Uri): Promise<void> {
const scmResource = resolveGitResource(uri);
if (scmResource) {
return await commands.executeCommand<void>('vscode.open', scmResource.uri);
}
return await commands.executeCommand<void>('vscode.open', uri.with({ scheme: 'file' }));
}
示例3: getSCMResource
private getSCMResource(uri?: Uri): Resource | undefined {
uri = uri ? uri : window.activeTextEditor && window.activeTextEditor.document.uri;
if (!uri) {
return undefined;
}
if (uri.scheme === 'git') {
uri = uri.with({ scheme: 'file' });
}
if (uri.scheme === 'file') {
const uriString = uri.toString();
return this.model.workingTreeGroup.resources.filter(r => r.resourceUri.toString() === uriString)[0]
|| this.model.indexGroup.resources.filter(r => r.resourceUri.toString() === uriString)[0];
}
}
示例4: resolveSCMResource
private resolveSCMResource(uri?: Uri): Resource | undefined {
uri = uri || window.activeTextEditor && window.activeTextEditor.document.uri;
if (!uri) {
return;
}
if (uri.scheme === 'scm' && uri.authority === 'git') {
const resource = scm.getResourceFromURI(uri);
return resource instanceof Resource ? resource : undefined;
}
if (uri.scheme === 'git') {
uri = uri.with({ scheme: 'file' });
}
if (uri.scheme === 'file') {
const uriString = uri.toString();
return this.model.workingTreeGroup.resources.filter(r => r.uri.toString() === uriString)[0]
|| this.model.indexGroup.resources.filter(r => r.uri.toString() === uriString)[0];
}
}
示例5: toGitUri
export function toGitUri(uri: Uri, ref: string, options: GitUriOptions = {}): Uri {
const params: GitUriParams = {
path: uri.fsPath,
ref
};
if (options.submoduleOf) {
params.submoduleOf = options.submoduleOf;
}
let path = uri.path;
if (options.replaceFileExtension) {
path = `${path}.git`;
} else if (options.submoduleOf) {
path = `${path}.diff`;
}
return uri.with({
scheme: 'git',
path,
query: JSON.stringify(params)
});
}
示例6: getTokenTreeUri
function getTokenTreeUri(uri: Uri) {
return uri.with({ scheme: ConstVariable.tokenTreeScheme, path: uri.fsPath + ".renderedTokenTree", query: uri.toString() });
}
示例7: getMarkdownUri
function getMarkdownUri(uri: Uri) {
return uri.with({ scheme: ConstVariable.markdownScheme, path: uri.fsPath + ".renderedDfm", query: uri.toString() });
}