本文整理汇总了TypeScript中vs/editor/common/core/viewLineToken.ViewLineTokenFactory类的典型用法代码示例。如果您正苦于以下问题:TypeScript ViewLineTokenFactory类的具体用法?TypeScript ViewLineTokenFactory怎么用?TypeScript ViewLineTokenFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ViewLineTokenFactory类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: assertLineTokens
function assertLineTokens(_actual: LineTokens, _expected: TestToken[]): void {
let expected = ViewLineTokenFactory.inflateArr(TestToken.toTokens(_expected), _actual.getLineContent().length);
let actual = _actual.inflate();
let decode = (token: ViewLineToken) => {
return {
endIndex: token.endIndex,
type: token.getType()
};
};
assert.deepEqual(actual.map(decode), expected.map(decode));
}
示例2: inflate
public inflate(): ViewLineToken[] {
return ViewLineTokenFactory.inflateArr(this._tokens, this._textLength);
}
示例3: sliceAndInflate
public sliceAndInflate(startOffset: number, endOffset: number, deltaOffset: number): ViewLineToken[] {
return ViewLineTokenFactory.sliceAndInflate(this._tokens, startOffset, endOffset, deltaOffset, this._textLength);
}
示例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 ViewLineTokenFactory.findIndexInSegmentsArray(this._tokens, offset);
}