当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Uri.toString方法代码示例

本文整理汇总了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;
    }
开发者ID:chrisleaman,项目名称:vscode-gitlens,代码行数:9,代码来源:comparers.ts

示例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);
			}
开发者ID:joelday,项目名称:vscode,代码行数:17,代码来源:jsonMain.ts

示例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();
	};
开发者ID:elemongw,项目名称:vscode,代码行数:16,代码来源:embeddedContentDocuments.ts

示例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())
  }
}
开发者ID:valdirmendesgt,项目名称:vscode_abap_remote_fs,代码行数:18,代码来源:commands.ts

示例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];
		}
	}
开发者ID:m-khosravi,项目名称:vscode,代码行数:18,代码来源:commands.ts

示例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);
			}
		}
	}
开发者ID:diarmaidm,项目名称:vscode,代码行数:18,代码来源:commands.ts

示例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)
}
开发者ID:valdirmendesgt,项目名称:vscode_abap_remote_fs,代码行数:19,代码来源:langClient.ts

示例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;
		}
	}
开发者ID:Chan-PH,项目名称:vscode,代码行数:38,代码来源:commands.ts

示例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];
		}
	}
开发者ID:yuit,项目名称:vscode,代码行数:23,代码来源:commands.ts

示例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];
		}
	}
开发者ID:golf1052,项目名称:vscode,代码行数:24,代码来源:commands.ts


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