• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript uri.isUri函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中vs/base/common/uri.isUri函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isUri函数的具体用法?TypeScript isUri怎么用?TypeScript isUri使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了isUri函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: getMultiSelectedResources

export function getMultiSelectedResources(resource: URI | object, listService: IListService, editorService: IEditorService): URI[] {
	const list = listService.lastFocusedList;
	if (list && list.isDOMFocused()) {
		// Explorer
		if (list instanceof Tree) {
			const selection = list.getSelection().map((fs: ExplorerItem) => fs.resource);
			const focus = list.getFocus();
			const mainUriStr = URI.isUri(resource) ? resource.toString() : focus instanceof ExplorerItem ? focus.resource.toString() : undefined;
			// If the resource is passed it has to be a part of the returned context.
			// We only respect the selection if it contains the focused element.
			if (selection.some(s => URI.isUri(s) && s.toString() === mainUriStr)) {
				return selection;
			}
		}

		// Open editors view
		if (list instanceof List) {
			const selection = list.getSelectedElements().filter(s => s instanceof OpenEditor).map((oe: OpenEditor) => oe.getResource());
			const focusedElements = list.getFocusedElements();
			const focus = focusedElements.length ? focusedElements[0] : undefined;
			const mainUriStr = URI.isUri(resource) ? resource.toString() : (focus instanceof OpenEditor) ? focus.getResource().toString() : undefined;
			// We only respect the selection if it contains the main element.
			if (selection.some(s => s.toString() === mainUriStr)) {
				return selection;
			}
		}
	}

	const result = getResourceForCommand(resource, listService, editorService);
	return !!result ? [result] : [];
}
开发者ID:liunian,项目名称:vscode,代码行数:31,代码来源:files.ts


示例2: toPromise

		p = toPromise(emitter.event).then(e => {
			assert.equal(e.length, 2);
			assert.ok(URI.isUri(e[0]));
			assert.ok(URI.isUri(e[1]));
			assert.equal(e[0].toString(), 'aa:bb');
			assert.equal(e[1].toString(), 'aa:cc');
		});
开发者ID:jinlongchen2018,项目名称:vscode,代码行数:7,代码来源:extHostDiagnostics.test.ts


示例3: getMultiSelectedResources

export function getMultiSelectedResources(resource: URI | {}, listService: IListService, editorService: IWorkbenchEditorService): URI[] {
	const list = listService.lastFocusedList;
	if (list && list.isDOMFocused()) {
		// Explorer
		if (list instanceof Tree) {
			const focus: IFileStat = list.getFocus();
			// If the resource is passed it has to be a part of the returned context.
			if (focus && (!URI.isUri(resource) || focus.resource.toString() === resource.toString())) {
				const selection = list.getSelection();
				// We only respect the selection if it contains the focused element.
				if (selection && selection.indexOf(focus) >= 0) {
					return selection.map(fs => fs.resource);
				}
			}
		}

		// Open editors view
		if (list instanceof List) {
			const focus = list.getFocusedElements();
			// If the resource is passed it has to be a part of the returned context.
			if (focus.length && (!URI.isUri(resource) || (focus[0] instanceof OpenEditor && focus[0].getResource().toString() === resource.toString()))) {
				const selection = list.getSelectedElements();
				// We only respect the selection if it contains the focused element.
				if (selection && selection.indexOf(focus[0]) >= 0) {
					return selection.filter(s => s instanceof OpenEditor).map((oe: OpenEditor) => oe.getResource());
				}
			}
		}
	}

	const result = getResourceForCommand(resource, listService, editorService);
	return !!result ? [result] : [];
}
开发者ID:sameer-coder,项目名称:vscode,代码行数:33,代码来源:files.ts


示例4: getResourceForCommand

export function getResourceForCommand(resource: URI | object, listService: IListService, editorService: IEditorService): URI {
	if (URI.isUri(resource)) {
		return resource;
	}

	let list = listService.lastFocusedList;
	if (list && list.isDOMFocused()) {
		let focus: any;
		if (list instanceof List) {
			const focused = list.getFocusedElements();
			if (focused.length) {
				focus = focused[0];
			}
		} else {
			focus = list.getFocus();
		}

		if (focus instanceof ExplorerItem) {
			return focus.resource;
		} else if (focus instanceof OpenEditor) {
			return focus.getResource();
		}
	}

	return toResource(editorService.activeEditor, { supportSideBySide: true });
}
开发者ID:liunian,项目名称:vscode,代码行数:26,代码来源:files.ts


示例5: getResourceForCommand

export function getResourceForCommand(resource: URI | {}, listService: IListService, editorService: IWorkbenchEditorService): URI {
	if (URI.isUri(resource)) {
		return resource;
	}

	const list = listService.lastFocusedList;
	if (list && list.isDOMFocused()) {
		const focus = list.getFocus();
		if (focus instanceof FileStat) {
			return focus.resource;
		} else if (focus instanceof OpenEditor) {
			return focus.getResource();
		}
	}

	return toResource(editorService.getActiveEditorInput(), { supportSideBySide: true });
}
开发者ID:sameer-coder,项目名称:vscode,代码行数:17,代码来源:files.ts


示例6: getResourceForCommand

	id: OPEN_TO_SIDE_COMMAND_ID, handler: (accessor, resource: URI) => {
		const editorService = accessor.get(IWorkbenchEditorService);
		const listService = accessor.get(IListService);
		const tree = listService.lastFocusedList;
		resource = getResourceForCommand(resource, listService, editorService);

		// Remove highlight
		if (tree instanceof Tree) {
			tree.clearHighlight();
		}

		// Set side input
		if (URI.isUri(resource)) {
			return editorService.openEditor({ resource, options: { preserveFocus: false } }, true);
		}

		return TPromise.as(true);
	}
开发者ID:servicesgpr,项目名称:vscode,代码行数:18,代码来源:fileCommands.ts


示例7: isTextChange

		function isTextChange(thing: [URI, types.TextEdit[]] | [URI, URI]): thing is [URI, types.TextEdit[]] {
			const [f, s] = thing;
			return URI.isUri(f) && Array.isArray(s);
		}
开发者ID:JarnoNijboer,项目名称:vscode,代码行数:4,代码来源:extHostTypes.test.ts


示例8: isFileChange

		function isFileChange(thing: [URI, types.TextEdit[]] | [URI, URI]): thing is [URI, URI] {
			const [f, s] = thing;
			return URI.isUri(f) && URI.isUri(s);
		}
开发者ID:JarnoNijboer,项目名称:vscode,代码行数:4,代码来源:extHostTypes.test.ts


示例9: isFileChange

		function isFileChange(thing: [URI, types.TextEdit[]] | [URI, URI, { overwrite?: boolean }]): thing is [URI, URI, { overwrite?: boolean }] {
			const [f, s] = thing;
			return URI.isUri(f) && URI.isUri(s);
		}
开发者ID:liunian,项目名称:vscode,代码行数:4,代码来源:extHostTypes.test.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript uri.parse函数代码示例发布时间:2022-05-25
下一篇:
TypeScript uri.isURI函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap