本文整理汇总了TypeScript中vs/editor/common/core/arrays.Arrays类的典型用法代码示例。如果您正苦于以下问题:TypeScript Arrays类的具体用法?TypeScript Arrays怎么用?TypeScript Arrays使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Arrays类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getWordAtPosition
public static getWordAtPosition(textSource:ITextSource, position:EditorCommon.IPosition): EditorCommon.IWordAtPosition {
if (!textSource._lineIsTokenized(position.lineNumber)) {
return WordHelper._getWordAtText(position.column, WordHelper.massageWordDefinitionOf(textSource.getMode()), textSource.getLineContent(position.lineNumber), 0);
}
var result: EditorCommon.IWordAtPosition = null;
var txt = textSource.getLineContent(position.lineNumber),
modeTransitions = textSource._getLineModeTransitions(position.lineNumber),
columnIndex = position.column - 1,
modeIndex = Arrays.findIndexInSegmentsArray(modeTransitions, columnIndex);
result = WordHelper._getWordAtColumn(txt, position.column, modeIndex, modeTransitions);
if (!result && modeIndex > 0 && modeTransitions[modeIndex].startIndex === columnIndex) {
// The position is right at the beginning of `modeIndex`, so try looking at `modeIndex` - 1 too
result = WordHelper._getWordAtColumn(txt, position.column, modeIndex - 1, modeTransitions);
}
return result;
}
示例2: findIndexOfOffset
public findIndexOfOffset(offset:number): number {
return Arrays.findIndexInSegmentsArray(this._tokens, offset);
}
示例3: findIndexInSegmentsArray
public static findIndexInSegmentsArray(arr:ViewLineToken[], desiredIndex: number): number {
return Arrays.findIndexInSegmentsArray(arr, desiredIndex);
}
示例4: findIndexInSegmentsArray
public static findIndexInSegmentsArray(arr:ModeTransition[], desiredIndex: number): number {
return Arrays.findIndexInSegmentsArray(arr, desiredIndex);
}