本文整理匯總了TypeScript中vs/editor/common/core/arrays.Arrays.findIndexInSegmentsArray方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Arrays.findIndexInSegmentsArray方法的具體用法?TypeScript Arrays.findIndexInSegmentsArray怎麽用?TypeScript Arrays.findIndexInSegmentsArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/editor/common/core/arrays.Arrays
的用法示例。
在下文中一共展示了Arrays.findIndexInSegmentsArray方法的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);
}