revert change of trailing comment parsing
This commit is contained in:
parent
68133e5fad
commit
451ff29263
|
@ -664,9 +664,6 @@ namespace ts {
|
|||
let collecting = trailing;
|
||||
let accumulator = initial;
|
||||
if (pos === 0) {
|
||||
if (collecting) {
|
||||
return accumulator;
|
||||
}
|
||||
collecting = true;
|
||||
const shebang = getShebang(text);
|
||||
if (shebang) {
|
||||
|
|
|
@ -28,22 +28,5 @@ namespace ts {
|
|||
assert.strictEqual(result!.length, 1);
|
||||
assert.strictEqual(result![0].kind, SyntaxKind.SingleLineCommentTrivia);
|
||||
});
|
||||
|
||||
it("returns no trailing comments at start of file", () => {
|
||||
const result = getTrailingCommentRanges(noShebang, 0);
|
||||
assert.isUndefined(result);
|
||||
});
|
||||
|
||||
it("returns no trailing comments at start of file if shebang is present", () => {
|
||||
const result = getTrailingCommentRanges(withShebang, 0);
|
||||
assert.isUndefined(result);
|
||||
});
|
||||
|
||||
it("returns trailing comments if position is not 0", () => {
|
||||
const result = getTrailingCommentRanges(withTrailing, 1);
|
||||
assert.isDefined(result);
|
||||
assert.strictEqual(result!.length, 1);
|
||||
assert.strictEqual(result![0].kind, SyntaxKind.MultiLineCommentTrivia);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue