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


TypeScript tokensBinaryEncoding.TokensBinaryEncoding類代碼示例

本文整理匯總了TypeScript中vs/editor/common/model/tokensBinaryEncoding.TokensBinaryEncoding的典型用法代碼示例。如果您正苦於以下問題:TypeScript TokensBinaryEncoding類的具體用法?TypeScript TokensBinaryEncoding怎麽用?TypeScript TokensBinaryEncoding使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TokensBinaryEncoding類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: toLineTokensFromInflated

function toLineTokensFromInflated(map:TokensInflatorMap, tokens:Token[], textLength:number): number[] {
	if (textLength === 0) {
		return null;
	}
	if (!tokens || tokens.length === 0) {
		return null;
	}
	if (tokens.length === 1) {
		if (tokens[0].startIndex === 0 && tokens[0].type === '') {
			return null;
		}
	}

	return TokensBinaryEncoding.deflateArr(map, tokens);
}
開發者ID:aminroosta,項目名稱:vscode,代碼行數:15,代碼來源:modelLine.ts

示例2: sliceAndInflate

	public sliceAndInflate(startOffset: number, endOffset: number, deltaStartIndex: number): ViewLineToken[] {
		return TokensBinaryEncoding.sliceAndInflate(this._map, this._tokens, startOffset, endOffset, deltaStartIndex);
	}
開發者ID:rebornix,項目名稱:vscode,代碼行數:3,代碼來源:lineTokens.ts

示例3: inflate

	public inflate(): ViewLineToken[] {
		return TokensBinaryEncoding.inflateArr(this._map, this._tokens);
	}
開發者ID:rebornix,項目名稱:vscode,代碼行數:3,代碼來源:lineTokens.ts

示例4: findTokenIndexAtOffset

	/**
	 * Find the token containing offset `offset`.
	 *    For example, with the following tokens [0, 5), [5, 9), [9, infinity)
	 *    Searching for 0, 1, 2, 3 or 4 will return 0.
	 *    Searching for 5, 6, 7 or 8 will return 1.
	 *    Searching for 9, 10, 11, ... will return 2.
	 * @param offset The search offset
	 * @return The index of the token containing the offset.
	 */
	public findTokenIndexAtOffset(offset: number): number {
		return TokensBinaryEncoding.findIndexOfOffset(this._tokens, offset);
	}
開發者ID:rebornix,項目名稱:vscode,代碼行數:12,代碼來源:lineTokens.ts

示例5: getTokenEndOffset

	public getTokenEndOffset(tokenIndex: number): number {
		if (tokenIndex + 1 < this._tokens.length) {
			return TokensBinaryEncoding.getStartIndex(this._tokens[tokenIndex + 1]);
		}
		return this._textLength;
	}
開發者ID:rebornix,項目名稱:vscode,代碼行數:6,代碼來源:lineTokens.ts

示例6: getTokenType

	public getTokenType(tokenIndex: number): string {
		return TokensBinaryEncoding.getType(this._map, this._tokens[tokenIndex]);
	}
開發者ID:rebornix,項目名稱:vscode,代碼行數:3,代碼來源:lineTokens.ts

示例7: getTokenStartOffset

	public getTokenStartOffset(tokenIndex: number): number {
		return TokensBinaryEncoding.getStartIndex(this._tokens[tokenIndex]);
	}
開發者ID:rebornix,項目名稱:vscode,代碼行數:3,代碼來源:lineTokens.ts

示例8: createFakeLineTokens

export function createFakeLineTokens(line: string, modeId: string, tokens: Token[], modeTransitions: ModeTransition[]): LineTokens {
	let map = new TokensInflatorMap(modeId);
	let deflatedTokens = TokensBinaryEncoding.deflateArr(map, tokens);
	return new LineTokens(map, deflatedTokens, modeTransitions, line);
}
開發者ID:StateFarmIns,項目名稱:vscode,代碼行數:5,代碼來源:modesTestUtils.ts


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