mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Merge pull request #23423 from Kingwl/add-braces
add support for add or remove braces to arrow function
This commit is contained in:
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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user