mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
![]() I previously left a comment stating I didn't know why a certain method existed. In investigating the code in `CaptureCodeContext#capture_before_after_kws` I found that it was added as to give a slightly less noisy output.
The docs for AroundBlockScan#capture_neighbor_context only describe keywords as being a primary concern. I modified that code to only include lines that are keywords or ends. This reduces the output noise even more.
This allows me to remove that `start_at_next_line` method.
One weird side effect of the prior logic is it would cause this code to produce this output:
```
class OH
def hello
def hai
end
end
```
```
1 class OH
> 2 def hello
4 def hai
5 end
6 end
```
But this code to produce this output:
```
class OH
def hello
def hai
end
end
```
```
1 class OH
> 2 def hello
4 end
5 end
```
Note the missing `def hai`. The only difference between them is that space.
With this change, they're now both consistent.
|
||
---|---|---|
.. | ||
api.rb | ||
around_block_scan.rb | ||
block_expand.rb | ||
capture_code_context.rb | ||
clean_document.rb | ||
cli.rb | ||
code_block.rb | ||
code_frontier.rb | ||
code_line.rb | ||
code_search.rb | ||
core_ext.rb | ||
display_code_with_line_numbers.rb | ||
display_invalid_blocks.rb | ||
explain_syntax.rb | ||
left_right_lex_count.rb | ||
lex_all.rb | ||
lex_value.rb | ||
parse_blocks_from_indent_line.rb | ||
pathname_from_message.rb | ||
priority_engulf_queue.rb | ||
priority_queue.rb | ||
ripper_errors.rb | ||
syntax_suggest.gemspec | ||
unvisited_lines.rb | ||
version.rb |