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


TypeScript Range.isIRange方法代码示例

本文整理汇总了TypeScript中vs/editor/common/core/range.Range.isIRange方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Range.isIRange方法的具体用法?TypeScript Range.isIRange怎么用?TypeScript Range.isIRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vs/editor/common/core/range.Range的用法示例。


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

示例1: _moveToNextMatch

	private _moveToNextMatch(arg: any): void {
		// @sandeep TS(2.0.2) - Adding cast to keep semantic. Necessary since the test are for interface but the code expects
		// implemations.
		let nextMatch = Range.isIRange(arg) ? arg : Position.isIPosition(arg) ? this._getNextMatch(arg as Position) : null;
		if (nextMatch) {
			this._setCurrentFindMatch(nextMatch as Range);
		}
	}
开发者ID:asotog,项目名称:vscode,代码行数:8,代码来源:findModel.ts

示例2: function

CommonEditorRegistry.registerLanguageCommand('_executeFormatRangeProvider', function (accessor, args) {
	const { resource, range, options } = args;
	if (!(resource instanceof URI) || !Range.isIRange(range)) {
		throw illegalArgument();
	}
	const model = accessor.get(IModelService).getModel(resource);
	if (!model) {
		throw illegalArgument('resource');
	}
	return getDocumentRangeFormattingEdits(model, Range.lift(range), options);
});
开发者ID:Chan-PH,项目名称:vscode,代码行数:11,代码来源:format.ts

示例3: function

CommonEditorRegistry.registerLanguageCommand('_executeFormatRangeProvider', function(accessor, args) {
	const {resource, range, options} = args;
	if (!URI.isURI(resource) || !Range.isIRange(range)) {
		throw illegalArgument();
	}
	const model = accessor.get(IModelService).getModel(resource);
	if (!model) {
		throw illegalArgument('resource');
	}
	return formatRange(model, range, options);
});
开发者ID:sangohan,项目名称:KodeStudio,代码行数:11,代码来源:format.ts

示例4: registerLanguageCommand

registerLanguageCommand('_executeFormatRangeProvider', function (accessor, args) {
	const { resource, range, options } = args;
	if (!(resource instanceof URI) || !Range.isIRange(range)) {
		throw illegalArgument();
	}
	const model = accessor.get(IModelService).getModel(resource);
	if (!model) {
		throw illegalArgument('resource');
	}
	return getDocumentRangeFormattingEditsUntilResult(accessor.get(IEditorWorkerService), model, Range.lift(range), options, CancellationToken.None);
});
开发者ID:joelday,项目名称:vscode,代码行数:11,代码来源:format.ts

示例5: registerLanguageCommand

registerLanguageCommand('_executeCodeActionProvider', function (accessor, args) {
	const { resource, range } = args;
	if (!(resource instanceof URI) || !Range.isIRange(range)) {
		throw illegalArgument();
	}

	const model = accessor.get(IModelService).getModel(resource);
	if (!model) {
		throw illegalArgument();
	}

	return getCodeActions(model, model.validateRange(range));
});
开发者ID:AllureFer,项目名称:vscode,代码行数:13,代码来源:codeAction.ts

示例6: registerLanguageCommand

registerLanguageCommand('_executeCodeActionProvider', function (accessor, args): Promise<ReadonlyArray<CodeAction>> {
	const { resource, range, kind } = args;
	if (!(resource instanceof URI) || !Range.isIRange(range)) {
		throw illegalArgument();
	}

	const model = accessor.get(IModelService).getModel(resource);
	if (!model) {
		throw illegalArgument();
	}

	return getCodeActions(
		model,
		model.validateRange(range),
		{ type: 'manual', filter: { includeSourceActions: true, kind: kind && kind.value ? new CodeActionKind(kind.value) : undefined } },
		CancellationToken.None).then(actions => actions.actions);
});
开发者ID:eamodio,项目名称:vscode,代码行数:17,代码来源:codeAction.ts

示例7: findMatches

	public findMatches(searchString:string, rawSearchScope:any, isRegex:boolean, matchCase:boolean, wholeWord:boolean, limitResultCount:number = LIMIT_FIND_COUNT): EditorCommon.IEditorRange[] {
		if (this._isDisposed) {
			throw new Error('Model.findMatches: Model is disposed');
		}

		var regex = this._toRegExp(searchString, isRegex, matchCase, wholeWord);
		if (!regex) {
			return [];
		}

		var searchRange:EditorCommon.IEditorRange;
		if (Range.isIRange(rawSearchScope)) {
			searchRange = rawSearchScope;
		} else {
			searchRange = this.getFullModelRange();
		}

		return this._doFindMatches(searchRange, regex, limitResultCount);
	}
开发者ID:inspiredjw,项目名称:VisualStudioCode,代码行数:19,代码来源:textModel.ts

示例8: registerLanguageCommand

registerLanguageCommand('_executeColorPresentationProvider', function (accessor, args) {

	const { resource, color, range } = args;
	if (!(resource instanceof URI) || !Array.isArray(color) || color.length !== 4 || !Range.isIRange(range)) {
		throw illegalArgument();
	}
	const [red, green, blue, alpha] = color;

	const model = accessor.get(IModelService).getModel(resource);
	if (!model) {
		throw illegalArgument();
	}

	const colorInfo = {
		range,
		color: { red, green, blue, alpha }
	};

	const presentations: IColorPresentation[] = [];
	const providers = ColorProviderRegistry.ordered(model).reverse();
	const promises = providers.map(provider => Promise.resolve(provider.provideColorPresentations(model, colorInfo, CancellationToken.None)).then(result => {
		if (Array.isArray(result)) {
			presentations.push(...result);
		}
	}));
	return Promise.all(promises).then(() => presentations);
});
开发者ID:DonJayamanne,项目名称:vscode,代码行数:27,代码来源:color.ts

示例9: _moveToNextMatch

	private _moveToNextMatch(arg: any): void {
		let nextMatch = Range.isIRange(arg) ? arg : Position.isIPosition(arg) ? this._getNextMatch(arg) : null;
		if (nextMatch) {
			this._setCurrentFindMatch(nextMatch);
		}
	}
开发者ID:GYGit,项目名称:vscode,代码行数:6,代码来源:findModel.ts


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