-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Indentation is busted for extract function #18091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Another broken case: export function evaluate(node: any): number {
switch (node.kind) {
case "Parenthesized":
while (node.expression.kind === "Parenthesized") {
node = node.expression;
}
return evaluate(node.expression);
}
} Gives me: export function evaluate(node: any): number {
switch (node.kind) {
case "Parenthesized":
var __return: any;
({ __return, node } = newFunction(node));
return __return;
}
}
function newFunction(node: any) {
while(node.expression.kind === "Parenthesized") {
node = node.expression;
}
return { __return: evaluate(node.expression), node };
} |
It's worth mentioning that the repro is from VS Code - it works in VS. |
does it work in VS because we always call format after applying the change? |
VS does format after applying the change. I don't know whether that's why it works in VS. |
yeah. that is why. in vs code if you trigger a format later manually it will be fixed. looks like our base indentation gets messed up when we format the new tree. |
I've noticed the same thing happens with the suggested text changes of code fixes, such as implementing the abstract methods from an abstract class |
Extract the entire function body out into its own function.
Expected:
Actual:
The text was updated successfully, but these errors were encountered: