Skip to content

Add dot-chaining syntax to main indent logic #248

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

Conversation

sukima
Copy link

@sukima sukima commented Mar 3, 2015

Most style guides depict chained methods to have a leading dot ans be indented on level deeper then the initial statement.

This patch adds a period as a key symbol for a nested indent. In the same fashion as the leading comma does.

It allows an indent of the following:

var x = {
  x: 'foo',
  y: 'bar',
  z: (function() {
    return [1, 2, 3]
      .map(toFruits)
      .compact()
      .sortBy('color');
  })()
};

This should close issue #139.

Most style guides depict chained methods to have a leading dot ans be
indented on level deeper then the initial statement.

This patch adds a period as a key symbol for a nested indent. In the
same fashion as the leading comma does.

It allows an indent of the following:

      var x = {
        x: 'foo',
        y: 'bar',
        z: (function() {
          return [1, 2, 3]
            .map(toFruits)
            .compact()
            .sortBy('color');
        })()
      };

This should close issue pangloss#139.
@goatslacker
Copy link
Collaborator

Cool. Let me load this one and live with it for a while and see if anything breaks.

@goatslacker
Copy link
Collaborator

There's a little more work that needs to go into this one. While this doesn't re-indent chained dots it doesn't automatically indent them either

@sukima
Copy link
Author

sukima commented Mar 3, 2015

Crumbs, I'll look into it.

@sukima
Copy link
Author

sukima commented Mar 3, 2015

Yeah, looking into this the fix won't help. Closing this and will make a new pull request later. Bummed out but glad you checked it.

@sukima sukima closed this Mar 3, 2015
@goatslacker
Copy link
Collaborator

It may be worthwhile checking this in regardless if it doesn't screw with anything else. Because the re-indenting of dot chain calls is super annoying.

@sukima
Copy link
Author

sukima commented Mar 3, 2015

@goatslacker up to you. I don't mind. I'm still going to hunt down a proper solution eventually.

@ksmithbaylor
Copy link

Any update on this? I'd love to see it move forward and would be willing to help out.

@sukima
Copy link
Author

sukima commented Feb 12, 2016

@ksmithbaylor no update. I just learned to live with it.

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

Successfully merging this pull request may close these issues.

3 participants