-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Wrong indentation when the last line in a case is a right brace #1683
Comments
@bitwiseman Hello! Can I give this issue a try? |
@marianayap Please do! |
@bitwiseman Hello! I won't be able to continue with the issue. It's open for anyone that wants to contribute. Thank you! |
Hello @bitwiseman, I have been given a task to contribute to an open source repo and I am interested in this project! Could I please be assigned this issue? |
pr0grammm
pushed a commit
to pr0grammm/js-beautify
that referenced
this issue
Jun 18, 2021
problem: Wrong indentation observed when the last line in a case is a right brace. solution: Deindent for case/default token is skipped whenever the previous token is a right brace. However this logic doesn't always work as highlighted in the issue. Added code to skip deindent only if the closing right brace corresponds to opening left brace of case action block.
4 tasks
pr0grammm
added a commit
to pr0grammm/js-beautify
that referenced
this issue
Jun 21, 2021
pr0grammm
added a commit
to pr0grammm/js-beautify
that referenced
this issue
Jun 21, 2021
pr0grammm
added a commit
to pr0grammm/js-beautify
that referenced
this issue
Jun 21, 2021
bitwiseman
added a commit
that referenced
this issue
Jun 23, 2021
issue #1683: fix switch case indentation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
The indentation is wrong if the last line of code is a right brace in a case code block.
However, if you put another statement (something other than a comment) after the right brace, it becomes correct.
Input
The code looked like this before beautification:
Expected Output
The code should have kept the same after beautification:
Actual Output
The code actually looked like this after beautification:
The last case is mistakenly indented.
If you add one line after the brace, it will keep the same:
Environment
OS: macOS 10.14.5
Settings
As default:
The text was updated successfully, but these errors were encountered: