本文整理汇总了TypeScript中vs/editor/common/model/modelLine.ModelLine.getTokens方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ModelLine.getTokens方法的具体用法?TypeScript ModelLine.getTokens怎么用?TypeScript ModelLine.getTokens使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/common/model/modelLine.ModelLine
的用法示例。
在下文中一共展示了ModelLine.getTokens方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: testLineSplitTokens
function testLineSplitTokens(initialText:string, initialTokens: LineToken[], splitColumn:number, expectedText1:string, expectedText2:string, expectedTokens: LineToken[]): void {
var line = new modelLine.ModelLine(1, initialText);
line.setTokens(new TokensInflatorMap(), initialTokens, null, []);
var other = line.split({}, splitColumn, false);
assert.equal(line.text, expectedText1);
assert.equal(other.text, expectedText2);
assertLineTokens(line.getTokens(), expectedTokens);
}
示例2: testLineEditTokens
function testLineEditTokens(initialText: string, initialTokens: Token[], edits: ILineEdit[], expectedText: string, expectedTokens: Token[]): void {
let line = new ModelLine(1, initialText, NO_TAB_SIZE);
let map = new TokensInflatorMap(null);
line.setTokens(map, initialTokens, []);
line.applyEdits({}, edits, NO_TAB_SIZE);
assert.equal(line.text, expectedText);
assertLineTokens(line.getTokens(map), expectedTokens);
}
示例3: testLineSplitTokens
function testLineSplitTokens(initialText: string, initialTokens: TestToken[], splitColumn: number, expectedText1: string, expectedText2: string, expectedTokens: TestToken[]): void {
let line = new ModelLine(1, initialText, NO_TAB_SIZE);
line.setTokens(0, TestToken.toTokens(initialTokens));
let other = line.split(new MarkersTracker(), splitColumn, false, NO_TAB_SIZE);
assert.equal(line.text, expectedText1);
assert.equal(other.text, expectedText2);
assertLineTokens(line.getTokens(0, []), expectedTokens);
}
示例4: test
test('insertion on empty line', () => {
let line = new ModelLine(1, 'some text', NO_TAB_SIZE);
line.setTokens(0, TestToken.toTokens([new TestToken(0, 1)]));
line.applyEdits(new MarkersTracker(), [{ startColumn: 1, endColumn: 10, text: '', forceMoveMarkers: false }], NO_TAB_SIZE);
line.setTokens(0, new Uint32Array(0));
line.applyEdits(new MarkersTracker(), [{ startColumn: 1, endColumn: 1, text: 'a', forceMoveMarkers: false }], NO_TAB_SIZE);
assertLineTokens(line.getTokens(0, []), [new TestToken(0, 1)]);
});
示例5: testLineSplitTokens
function testLineSplitTokens(initialText: string, initialTokens: TestToken[], splitColumn: number, expectedText1: string, expectedText2: string, expectedTokens: TestToken[]): void {
let line = new ModelLine(initialText);
line.setTokens(0, TestToken.toTokens(initialTokens));
let other = line.split(splitColumn);
assert.equal(line.text, expectedText1);
assert.equal(other.text, expectedText2);
assertLineTokens(line.getTokens(0), expectedTokens);
}
示例6: test
test('insertion on empty line', () => {
let line = new ModelLine('some text');
line.setTokens(0, TestToken.toTokens([new TestToken(0, 1)]));
line.applyEdits([{ startColumn: 1, endColumn: 10, text: '' }]);
line.setTokens(0, new Uint32Array(0));
line.applyEdits([{ startColumn: 1, endColumn: 1, text: 'a' }]);
assertLineTokens(line.getTokens(0), [new TestToken(0, 1)]);
});
示例7: testLineSplitTokens
function testLineSplitTokens(initialText:string, initialTokens: Token[], splitColumn:number, expectedText1:string, expectedText2:string, expectedTokens: Token[]): void {
let line = new ModelLine(1, initialText, NO_TAB_SIZE);
let map = new TokensInflatorMap();
line.setTokens(map, initialTokens, null, []);
let other = line.split({}, splitColumn, false, NO_TAB_SIZE);
assert.equal(line.text, expectedText1);
assert.equal(other.text, expectedText2);
assertLineTokens(line.getTokens(map), expectedTokens);
}
示例8: test
test('insertion on empty line', () => {
let line = new ModelLine(1, 'some text', NO_TAB_SIZE);
let map = new TokensInflatorMap();
line.setTokens(map, [new Token(0, 'bar')], null, []);
line.applyEdits({}, [{startColumn:1, endColumn:10, text:'', forceMoveMarkers: false}], NO_TAB_SIZE);
line.setTokens(map, [], null, []);
line.applyEdits({}, [{startColumn:1, endColumn:1, text:'a', forceMoveMarkers: false}], NO_TAB_SIZE);
assertLineTokens(line.getTokens(map), [new Token(0, '')]);
});
示例9: testLineAppendTokens
function testLineAppendTokens(aText: string, aTokens: TestToken[], bText: string, bTokens: TestToken[], expectedText: string, expectedTokens: TestToken[]): void {
let a = new ModelLine(1, aText, NO_TAB_SIZE);
a.setTokens(0, TestToken.toTokens(aTokens));
let b = new ModelLine(2, bText, NO_TAB_SIZE);
b.setTokens(0, TestToken.toTokens(bTokens));
a.append(new MarkersTracker(), b, NO_TAB_SIZE);
assert.equal(a.text, expectedText);
assertLineTokens(a.getTokens(0, []), expectedTokens);
}
示例10: testLineAppendTokens
function testLineAppendTokens(aText: string, aTokens: TestToken[], bText: string, bTokens: TestToken[], expectedText: string, expectedTokens: TestToken[]): void {
let a = new ModelLine(aText);
a.setTokens(0, TestToken.toTokens(aTokens));
let b = new ModelLine(bText);
b.setTokens(0, TestToken.toTokens(bTokens));
a.append(b);
assert.equal(a.text, expectedText);
assertLineTokens(a.getTokens(0), expectedTokens);
}