當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript arrays.Arrays類代碼示例

本文整理匯總了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;
	}
開發者ID:amamut,項目名稱:vscode,代碼行數:21,代碼來源:textModelWithTokensHelpers.ts

示例2: findIndexOfOffset

	public findIndexOfOffset(offset:number): number {
		return Arrays.findIndexInSegmentsArray(this._tokens, offset);
	}
開發者ID:578723746,項目名稱:vscode,代碼行數:3,代碼來源:modesTestUtils.ts

示例3: findIndexInSegmentsArray

	public static findIndexInSegmentsArray(arr:ViewLineToken[], desiredIndex: number): number {
		return Arrays.findIndexInSegmentsArray(arr, desiredIndex);
	}
開發者ID:13572293130,項目名稱:vscode,代碼行數:3,代碼來源:viewLineToken.ts

示例4: findIndexInSegmentsArray

	public static findIndexInSegmentsArray(arr:ModeTransition[], desiredIndex: number): number {
		return Arrays.findIndexInSegmentsArray(arr, desiredIndex);
	}
開發者ID:GYGit,項目名稱:vscode,代碼行數:3,代碼來源:modeTransition.ts


注:本文中的vs/editor/common/core/arrays.Arrays類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。