Skip to content
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

Incorrect Formatting on if (a) try {} finally {} #60887

Open
hyrious opened this issue Dec 31, 2024 · 2 comments Β· May be fixed by #60898
Open

Incorrect Formatting on if (a) try {} finally {} #60887

hyrious opened this issue Dec 31, 2024 · 2 comments Β· May be fixed by #60898
Labels
Bug A bug in TypeScript Domain: Formatter The issue relates to the built-in formatter Help Wanted You can do this
Milestone

Comments

@hyrious
Copy link

hyrious commented Dec 31, 2024

πŸ”Ž Search Terms

format, formatter, finally

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried (it didn't change between TS3.3 and TS5.8).

⏯ Playground Link

Playground Link

πŸ’» Code

if (true) try {
    // ...
} finally {
    // ...
}

Click "Format Document" from the context menu or via keyboard shortcut (opt+shift+f).

πŸ™ Actual behavior

The format result is

if (true) try {
    // ...
} finally {
        // ...
    }

πŸ™‚ Expected behavior

Do not add indentation to the finally block.

Additional information about the issue

Note that if (a) try {} catch {} works fine. Maybe there're something related. Playground Link

Related #3817

@jcalz

This comment has been minimized.

@hyrious
Copy link
Author

hyrious commented Dec 31, 2024

@jcalz Sure, updated.

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this Domain: Formatter The issue relates to the built-in formatter labels Jan 2, 2025
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Formatter The issue relates to the built-in formatter Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants