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

unindent_chained_methods breaks indentation for if statements without brackets #1378

Closed
hstig opened this issue Apr 19, 2018 · 5 comments
Closed

Comments

@hstig
Copy link

hstig commented Apr 19, 2018

Input

The code looked like this before beautification:

      var g = 0;
      if (g === 1)
        g = 0;
      else
        g = 1; 

Expected Output

The code should have looked like this after beautification:

      var g = 0;
      if (g === 1)
        g = 0;
      else
        g = 1; 

Actual Output

The code actually looked like this after beautification:

      var g = 0;
      if (g === 1)
      g = 0;
      else
      g = 1; 

Steps to Reproduce

Environment

OS: Debian GNU/Linux 9 (stretch) 64-bit
CLI: js-beutify Ver: 1.7.5

Settings

js-beautify -u -s 2 -a -b collapse,preserve-inline

@bitwiseman
Copy link
Member

I can't reproduce this on http://jsbeautifier.org/ Not sure what would cause that to happen.

@hstig
Copy link
Author

hstig commented Apr 20, 2018

I've used the command line tool of js-beutify, ver: 1.7.5.

@bitwiseman
Copy link
Member

@hstig
What is the full command line you're using? (Including file name)

@hstig
Copy link
Author

hstig commented Apr 23, 2018

js-beautify -u -s 2 -a -b collapse,preserve-inline \#1378.js

@bitwiseman
Copy link
Member

@hstig
Ah, I see you only get it with unindent_chained_methods. I see it now. Thanks!

@bitwiseman bitwiseman added this to the v1.7.x milestone Apr 23, 2018
MacKLess added a commit to MacKLess/js-beautify that referenced this issue Jun 28, 2018
MacKLess added a commit to MacKLess/js-beautify that referenced this issue Jun 28, 2018
@bitwiseman bitwiseman modified the milestones: v1.7.x, v1.7.6 Jun 28, 2018
MacKLess added a commit to MacKLess/js-beautify that referenced this issue Jun 28, 2018
@bitwiseman bitwiseman modified the milestones: v1.8.0-rc2, 1.8.0 Aug 22, 2018
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

2 participants