本文整理汇总了TypeScript中vs/editor/common/viewLayout/whitespaceComputer.WhitespaceComputer.changeWhitespaceAfterLineNumber方法的典型用法代码示例。如果您正苦于以下问题:TypeScript WhitespaceComputer.changeWhitespaceAfterLineNumber方法的具体用法?TypeScript WhitespaceComputer.changeWhitespaceAfterLineNumber怎么用?TypeScript WhitespaceComputer.changeWhitespaceAfterLineNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/editor/common/viewLayout/whitespaceComputer.WhitespaceComputer
的用法示例。
在下文中一共展示了WhitespaceComputer.changeWhitespaceAfterLineNumber方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('WhitespaceComputer changeWhitespaceAfterLineNumber & getFirstWhitespaceIndexAfterLineNumber', () => {
var whitespaceComputer = new WhitespaceComputer();
var a = whitespaceComputer.insertWhitespace(0, 0, 1);
var b = whitespaceComputer.insertWhitespace(7, 0, 1);
var c = whitespaceComputer.insertWhitespace(3, 0, 1);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(0), a); // 0
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(0), 0);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(1), c); // 3
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(1), 3);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(2), b); // 7
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(2), 7);
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(1), 1); // c
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(2), 1); // c
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(3), 1); // c
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(4), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(5), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(6), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(7), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(8), -1); // --
// Do not really move a
whitespaceComputer.changeWhitespaceAfterLineNumber(a, 1);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(0), a); // 1
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(0), 1);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(1), c); // 3
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(1), 3);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(2), b); // 7
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(2), 7);
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(1), 0); // a
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(2), 1); // c
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(3), 1); // c
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(4), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(5), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(6), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(7), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(8), -1); // --
// Do not really move a
whitespaceComputer.changeWhitespaceAfterLineNumber(a, 2);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(0), a); // 2
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(0), 2);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(1), c); // 3
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(1), 3);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(2), b); // 7
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(2), 7);
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(1), 0); // a
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(2), 0); // a
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(3), 1); // c
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(4), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(5), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(6), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(7), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(8), -1); // --
// Change a to conflict with c => a gets placed after c
whitespaceComputer.changeWhitespaceAfterLineNumber(a, 3);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(0), c); // 3
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(0), 3);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(1), a); // 3
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(1), 3);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(2), b); // 7
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(2), 7);
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(1), 0); // c
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(2), 0); // c
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(3), 0); // c
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(4), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(5), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(6), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(7), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(8), -1); // --
// Make a no-op
whitespaceComputer.changeWhitespaceAfterLineNumber(c, 3);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(0), c); // 3
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(0), 3);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(1), a); // 3
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(1), 3);
assert.equal(whitespaceComputer.getIdForWhitespaceIndex(2), b); // 7
assert.equal(whitespaceComputer.getAfterLineNumberForWhitespaceIndex(2), 7);
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(1), 0); // c
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(2), 0); // c
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(3), 0); // c
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(4), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(5), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(6), 2); // b
assert.equal(whitespaceComputer.getFirstWhitespaceIndexAfterLineNumber(7), 2); // b
//.........这里部分代码省略.........