Merge pull request #23423 from Kingwl/add-braces

add support for add or remove braces to arrow function
This commit is contained in:
Mohamed Hegazy authored and GitHub committed 2018-06-11 13:09:38 -07:00
commit e07e2e0e1f
31 files changed
+408 -16

No files matched your search

@@ -202,22 +202,6 @@ namespace ts.codefix {
}
}
function copyComments(sourceNode: Node, targetNode: Node, sourceFile: SourceFile) {
forEachLeadingCommentRange(sourceFile.text, sourceNode.pos, (pos, end, kind, htnl) => {
if (kind === SyntaxKind.MultiLineCommentTrivia) {
// Remove leading /*
pos += 2;
// Remove trailing */
end -= 2;
}
else {
// Remove leading //
pos += 2;
}
addSyntheticLeadingComment(targetNode, kind, sourceFile.text.slice(pos, end), htnl);
});
}
function getModifierKindFromSource(source: Node, kind: SyntaxKind): ReadonlyArray<Modifier> | undefined {
return filter(source.modifiers, modifier => modifier.kind === kind);
}