本文整理匯總了TypeScript中vscode.Uri.toString方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Uri.toString方法的具體用法?TypeScript Uri.toString怎麽用?TypeScript Uri.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vscode.Uri
的用法示例。
在下文中一共展示了Uri.toString方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: equals
equals(lhs: Uri | undefined, rhs: Uri | undefined, options: { exact?: boolean } = { exact: false }) {
if (lhs === rhs) return true;
if (lhs === undefined || rhs === undefined) return false;
if (options.exact) {
return lhs.toString(true) === rhs.toString(true);
}
return lhs.scheme === rhs.scheme && lhs.fsPath === rhs.fsPath;
}
示例2: next
handleDiagnostics: (uri: Uri, diagnostics: Diagnostic[], next: HandleDiagnosticsSignature) => {
const schemaErrorIndex = diagnostics.findIndex(candidate => candidate.code === /* SchemaResolveError */ 0x300);
if (schemaErrorIndex === -1) {
fileSchemaErrors.delete(uri.toString());
return next(uri, diagnostics);
}
const schemaResolveDiagnostic = diagnostics[schemaErrorIndex];
fileSchemaErrors.set(uri.toString(), schemaResolveDiagnostic.message);
if (window.activeTextEditor && window.activeTextEditor.document.uri.toString() === uri.toString()) {
schemaResolutionErrorStatusBarItem.show();
}
next(uri, diagnostics);
}
示例3: ensureContentUpdated
function ensureContentUpdated(virtualURI: Uri, expectedVersion: number) {
let virtualURIString = virtualURI.toString();
let virtualDocVersion = openVirtualDocuments[virtualURIString];
if (isDefined(virtualDocVersion) && virtualDocVersion !== expectedVersion) {
return new Promise<void>((resolve, reject) => {
let subscription = workspace.onDidChangeTextDocument(d => {
if (d.document.uri.toString() === virtualURIString) {
subscription.dispose();
resolve();
}
});
embeddedContentChanged.fire(virtualURI);
});
}
return Promise.resolve();
};
示例4: activateCurrent
export async function activateCurrent(selector: Uri) {
try {
const server = fromUri(selector)
if (!server)
throw Error("ABAP connection not found for" + uriToNodePath.toString())
const editor = findEditor(selector.toString())
const obj = await server.findAbapObject(selector)
// if editor is dirty, save before activate
if (editor && editor.document.isDirty) {
await editor.document.save()
await obj.loadMetadata(server.client)
} else if (!obj.structure) await obj.loadMetadata(server.client)
await server.activate(obj)
if (editor === window.activeTextEditor) await showHideActivate(editor, obj)
} catch (e) {
window.showErrorMessage(e.toString())
}
}
示例5: 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];
}
}
示例6: openChange
@command('git.openChange')
async openChange(uri: Uri): Promise<void> {
const scmResource = resolveGitResource(uri);
if (scmResource) {
return await this.open(scmResource);
}
if (uri.scheme === 'file') {
const uriString = uri.toString();
const resource = this.model.workingTreeGroup.resources.filter(r => r.uri.toString() === uriString)[0]
|| this.model.indexGroup.resources.filter(r => r.uri.toString() === uriString)[0];
if (resource) {
return await this.open(resource);
}
}
}
示例7: manageIncludes
export async function manageIncludes(uri: Uri, opened: boolean) {
const key = uri.toString()
if (opened) {
const include = includes.get(key)
if (isString(include)) return
const server = fromUri(uri)
const obj = await server.findAbapObject(uri)
if (obj.type !== "PROG/I") includes.set(key, "")
else {
let main = ""
try {
main = await await server.activator.selectMain(obj)
} finally {
includes.set(key, main || "")
// if(main)
}
}
} else includes.delete(key)
}
示例8: openFile
@command('git.openFile')
async openFile(arg?: Resource | Uri): Promise<void> {
let uri: Uri | undefined;
if (arg instanceof Uri) {
if (arg.scheme === 'git') {
uri = Uri.file(fromGitUri(arg).path);
} else if (arg.scheme === 'file') {
uri = arg;
}
} else {
let resource = arg;
if (!(resource instanceof Resource)) {
// can happen when called from a keybinding
resource = this.getSCMResource();
}
if (resource) {
uri = resource.resourceUri;
}
}
if (!uri) {
return;
}
const activeTextEditor = window.activeTextEditor && window.activeTextEditor;
const isSameUri = activeTextEditor && activeTextEditor.document.uri.toString() === uri.toString();
const selections = activeTextEditor && activeTextEditor.selections;
const viewColumn = activeTextEditor && activeTextEditor.viewColumn || ViewColumn.One;
await commands.executeCommand<void>('vscode.open', uri, viewColumn);
if (isSameUri && selections && window.activeTextEditor) {
window.activeTextEditor.selections = selections;
}
}
示例9: 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];
}
}
示例10: getSCMResource
private getSCMResource(uri?: Uri): Resource | undefined {
uri = uri ? uri : window.activeTextEditor && window.activeTextEditor.document.uri;
if (!uri) {
return undefined;
}
if (uri.scheme === 'git') {
const { path } = fromGitUri(uri);
uri = Uri.file(path);
}
if (uri.scheme === 'file') {
const uriString = uri.toString();
const repository = this.model.getRepository(uri);
if (!repository) {
return undefined;
}
return repository.workingTreeGroup.resourceStates.filter(r => r.resourceUri.toString() === uriString)[0]
|| repository.indexGroup.resourceStates.filter(r => r.resourceUri.toString() === uriString)[0];
}
}