mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
Start leading comments on new line if the comment starts on different line as node
This commit is contained in:
@@ -1932,6 +1932,11 @@ module ts {
|
||||
|
||||
function emitLeadingDeclarationComments(node: Declaration) {
|
||||
var leadingComments = getLeadingComments(currentSourceFile.text, node.pos);
|
||||
// If the leading comments start on different line than the start of node, write new line
|
||||
if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos &&
|
||||
currentSourceFile.getLineAndCharacterFromPosition(node.pos).line !== currentSourceFile.getLineAndCharacterFromPosition(leadingComments[0].pos).line) {
|
||||
writer.writeLine();
|
||||
}
|
||||
emitComments(leadingComments, writer, writeComment);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user