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

Function body is indented when followed by a comment #583

Closed
fvermont opened this issue Nov 19, 2014 · 3 comments
Closed

Function body is indented when followed by a comment #583

fvermont opened this issue Nov 19, 2014 · 3 comments
Milestone

Comments

@fvermont
Copy link

Before:

function test() {
  return true;
}
//bla

After:

function test() {
      return true;
   }
   //bla

Note: I have temporarily 'solved' this problem in the beautify.js source handle_comment function, yet might have introduced another one :

        function handle_comment() {
            if (current_token.wanted_newline) {
                print_newline(false, false); /*instead of print_newline(false, true)*/
@bitwiseman
Copy link
Member

Yeah, that will probably break a few other things. But It's good to know this works.

@bitwiseman bitwiseman added this to the v1.6.0 milestone Nov 19, 2014
@bitwiseman bitwiseman modified the milestones: v1.5.5, v1.6.0 Mar 4, 2015
@bitwiseman
Copy link
Member

function foo() { var x; }
function bar() { var y; } // end bar
function baz() { var z; }

beautifies to

function foo() {
    var x;
}

function bar() {
        var y;
    } // end bar
function baz() {
    var z;
}

@bitwiseman
Copy link
Member

This is not cooperating. Punting to 1.6.0.

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