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

Wrong indentation of comments when semicolons are missing #1083

Closed
adrianton3 opened this issue Dec 27, 2016 · 3 comments
Closed

Wrong indentation of comments when semicolons are missing #1083

adrianton3 opened this issue Dec 27, 2016 · 3 comments

Comments

@adrianton3
Copy link

Input

The code looked like this before beautification:

f()
/* a */

Expected Output

The code should have looked like this after beautification:

f()
/* a */

Actual Output

The code actually looked like this after beautification:

f()
    /* a */

Steps to Reproduce

  1. Open http://jsbeautifier.org/
  2. Paste the code
  3. Hit the beautify button
  4. Observe the misalignment of /* a */
  5. Add a ; for f()
  6. Hit beautify again
  7. Observe the correct alignment of /* a */

Environment

OS: N/A

Settings

The default settings for http://jsbeautifier.org/
This is the options argument supplied to the js_beautify function:

{
"brace_style": "collapse",
"break_chained_methods": false,
"comma_first": false,
"e4x": false,
"end_with_newline": false,
"indent_char": " ",
"indent_inner_html": false,
"indent_scripts": "normal",
"indent_size": "4",
"jslint_happy": false,
"keep_array_indentation": false,
"max_preserve_newlines": "5",
"preserve_newlines": true,
"space_before_conditional": true,
"unescape_strings": false,
"wrap_line_length": "0"
}
@tobias-zucali
Copy link

There is a missing semicolon. Does it work with this?
f();
/* a */

@adrianton3
Copy link
Author

Yes it does (see the title and repro steps), but I'd expect the indentation to be the same. Semicolons shouldn't affect indentation since they're optional. I don't re-indent my code when I add/remove ; from my code.

@bitwiseman
Copy link
Member

See #815

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants