本文整理匯總了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);
}
}