mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 15:25:54 -06:00
Print new nodes in correct order
This commit is contained in:
parent
f5f01a162f
commit
965d43c6a5
@ -10,8 +10,8 @@ namespace ts.codefix {
|
||||
|
||||
const changeTracker = textChanges.ChangeTracker.fromCodeFixContext(context);
|
||||
|
||||
for (let i = newNodes.length - 1; i >= 0; i--) {
|
||||
changeTracker.insertNodeAfter(sourceFile, insertAfter, newNodes[i], { insertTrailingNewLine: true });
|
||||
for (const newNode of newNodes) {
|
||||
changeTracker.insertNodeAfter(sourceFile, insertAfter, newNode, { insertTrailingNewLine: true });
|
||||
}
|
||||
return changeTracker.getChanges();
|
||||
}
|
||||
@ -52,7 +52,8 @@ namespace ts.codefix {
|
||||
|
||||
const declaration = declarations[0] as Declaration;
|
||||
const name = declaration.name ? declaration.name.getText() : undefined;
|
||||
const modifiers = [createVisibilityModifier(getModifierFlags(declaration))];
|
||||
const visibilityModifier = createVisibilityModifier(getModifierFlags(declaration));
|
||||
const modifiers = visibilityModifier ? [visibilityModifier] : undefined;
|
||||
const type = checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration);
|
||||
|
||||
switch (declaration.kind) {
|
||||
@ -64,7 +65,7 @@ namespace ts.codefix {
|
||||
// TODO: add modifiers.
|
||||
const property = createProperty(
|
||||
/*decorators*/undefined
|
||||
, /*modifiers*/ undefined
|
||||
, modifiers
|
||||
, name
|
||||
, /*questionToken*/ undefined
|
||||
, typeNode
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user