當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。