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