本文整理汇总了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);
}
示例2: sliceAndInflate
public sliceAndInflate(startOffset: number, endOffset: number, deltaStartIndex: number): ViewLineToken[] {
return TokensBinaryEncoding.sliceAndInflate(this._map, this._tokens, startOffset, endOffset, deltaStartIndex);
}
示例3: inflate
public inflate(): ViewLineToken[] {
return TokensBinaryEncoding.inflateArr(this._map, this._tokens);
}
示例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);
}
示例5: getTokenEndOffset
public getTokenEndOffset(tokenIndex: number): number {
if (tokenIndex + 1 < this._tokens.length) {
return TokensBinaryEncoding.getStartIndex(this._tokens[tokenIndex + 1]);
}
return this._textLength;
}
示例6: getTokenType
public getTokenType(tokenIndex: number): string {
return TokensBinaryEncoding.getType(this._map, this._tokens[tokenIndex]);
}
示例7: getTokenStartOffset
public getTokenStartOffset(tokenIndex: number): number {
return TokensBinaryEncoding.getStartIndex(this._tokens[tokenIndex]);
}
示例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);
}