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

Fixed indentation of leading-dot multi-line method-chains. ugh #47

Merged
merged 1 commit into from
Apr 6, 2014

Conversation

zenspider
Copy link
Owner

Should fix #46. I'd like @vzvu3k6k to look at this and sanity check. They know this section of the code better than I do.

@zenspider zenspider self-assigned this Apr 5, 2014
@vzvu3k6k
Copy link

vzvu3k6k commented Apr 6, 2014

It looks good to me. And much interesting.

Ripper.lex <<HERE
foo
  .bar
HERE

#=> [[[1, 0], :on_ident, "foo"],
#    [[1, 3], :on_period, "\n"], # "\n" is period!
#    [[2, 0], :on_ident, "  .bar"],
#    [[2, 6], :on_nl, "\n"]]

I doubt this ripper's behavior is by design, but I can't find any case where this patch fails, and it seems to work fine in probably all version of ruby which enhanced-ruby-mode supports.

(And I wrote a simple test script for rbenv users.)

zenspider added a commit that referenced this pull request Apr 6, 2014
Fixed indentation of leading-dot multi-line method-chains. ugh
@zenspider zenspider merged commit b4bbc3c into master Apr 6, 2014
@zenspider zenspider deleted the leading-dots branch April 6, 2014 10:31
@wjlroe
Copy link

wjlroe commented May 16, 2015

This seems to have reared its ugly head again:

 % rbenv each ruby ~/Dropbox/Code/test-ruby-indent.rb
2.2.0-p0: false
2.2.1-p85: false
2.2.2-p95: false

The output of Ripper.lex for all these rubies is:

[[[1, 0], :on_ident, "foo"],
 [[1, 3], :on_ignored_nl, "\n"],
 [[2, 0], :on_sp, "  "],
 [[2, 2], :on_period, "."],
 [[2, 3], :on_ident, "bar"],
 [[2, 6], :on_nl, "\n"]]

Repository owner locked and limited conversation to collaborators Jan 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix indentation of multi-line method chains with leading dots
3 participants