Navigation Menu

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

Add Parser::Source::Range#line_span #84

Merged
merged 1 commit into from Aug 1, 2020

Conversation

marcandre
Copy link
Contributor

I've seen about 20 occurrences of range.{first}line..{.}range.last_line or calls to line_range(node) (defined in util.rb)

I feel the name line_span is more descriptive and is less confusing with Source::Buffer#line_range which returns a range of columns for the given line.

I notice that there currently are no extension to parser's classes, but this one seems reasonable.

The result can be particularly useful when dealing with comments, say with each_comment_in_lines of #83

@bbatsov
Copy link
Contributor

bbatsov commented Aug 1, 2020

I notice that there currently are no extension to parser's classes, but this one seems reasonable.

Agreed.

@marcandre marcandre merged commit 3736bcb into rubocop:master Aug 1, 2020
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.

None yet

2 participants