本文整理汇总了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);
}
}
示例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);
});
示例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);
});
示例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);
});
示例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));
});
示例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);
});
示例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);
}
示例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);
});
示例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);
}
}