Start leading comments on new line if the comment starts on different line as node

This commit is contained in:
Sheetal Nandi
2014-08-15 12:17:36 -07:00
parent adc700aba5
commit 29dcc5ba41
5 changed files with 33 additions and 14 deletions

View File

@@ -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);
}