Skip to content

Closing bracket & indentation - unexpected behaviour #2462

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

Closed
dstepanov opened this issue Jul 26, 2012 · 2 comments
Closed

Closing bracket & indentation - unexpected behaviour #2462

dstepanov opened this issue Jul 26, 2012 · 2 comments

Comments

@dstepanov
Copy link

I'm not new to coffeescript but this kind of behavior really surprised me.

I would expect there will be no difference if I put closing bracket on line 7 between indent of '$' to indent of 'false' :

  $(document)

    .on "click", (event) ->

       $(".xyz").click( -> 
              false
       ) # <-- 

       false
$(document).on("click", function(event) {
  $(".xyz").click(function() {
    return false;
  });
  return false;
});

http://coffeescript.org/#try:%0A%20%20%24(document)%0A%20%20%0A%20%20%20%20.on%20%22click%22%2C%20(event)%20-%3E%0A%0A%20%20%20%20%20%20%20%24(%22.xyz%22).click(%20-%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20false%0A%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20false

Closing bracket on line 7 indented with 1-2 spaces

  $(document)

    .on "click", (event) ->

       $(".xyz").click( -> 
              false
        )

       false
$(document).on("click", function(event) {
  return $(".xyz").click(function() {
    return false;
  });
});

false;

http://coffeescript.org/#try:%0A%20%20%24(document)%0A%20%20%0A%20%20%20%20.on%20%22click%22%2C%20(event)%20-%3E%0A%0A%20%20%20%20%20%20%20%24(%22.xyz%22).click(%20-%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20false%0A%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20false

Closing bracket on line 7 indented with 3-4 spaces

  $(document)

    .on "click", (event) ->

       $(".xyz").click( -> 
              false
          )

       false
$(document).on("click", function(event) {
  return $(".xyz").click(function() {
    return false;
  });
});

http://coffeescript.org/#try:%0A%20%20%24(document)%0A%20%20%0A%20%20%20%20.on%20%22click%22%2C%20(event)%20-%3E%0A%0A%20%20%20%20%20%20%20%24(%22.xyz%22).click(%20-%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20false%0A%20%20%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20false

Closing bracket on line 7 indented with 5 spaces

  $(document)

    .on "click", (event) ->

       $(".xyz").click( -> 
              false
            )

       false
$(document).on("click", function(event) {
  $(".xyz").click(function() {
    return false;
  });
  return false;
});

http://coffeescript.org/#try:%0A%20%20%24(document)%0A%20%20%0A%20%20%20%20.on%20%22click%22%2C%20(event)%20-%3E%0A%0A%20%20%20%20%20%20%20%24(%22.xyz%22).click(%20-%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20false%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20false

Closing bracket on line 7 indented with 6 spaces

  $(document)

    .on "click", (event) ->

       $(".xyz").click( -> 
              false
             )

       false
$(document).on("click", function(event) {
  return $(".xyz").click(function() {
    return false;
  });
});

false;

http://coffeescript.org/#try:%0A%20%20%24(document)%0A%20%20%0A%20%20%20%20.on%20%22click%22%2C%20(event)%20-%3E%0A%0A%20%20%20%20%20%20%20%24(%22.xyz%22).click(%20-%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20false%0A%20%20%20%20%20%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20false

Closing bracket on line 7 indented with 7 spaces

  $(document)

    .on "click", (event) ->

       $(".xyz").click( -> 
              false
              )

       false
$(document).on("click", function(event) {
  $(".xyz").click(function() {
    return false;
  });
  return false;
});

http://coffeescript.org/#try:%0A%20%20%24(document)%0A%20%20%0A%20%20%20%20.on%20%22click%22%2C%20(event)%20-%3E%0A%0A%20%20%20%20%20%20%20%24(%22.xyz%22).click(%20-%3E%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20false%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%0A%0A%20%20%20%20%20%20%20false

@michaelficarra
Copy link
Collaborator

I believe you're running into #1275

@dstepanov
Copy link
Author

You right

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