diff options
author | Hiroshi SHIBATA <[email protected]> | 2023-05-23 10:05:27 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2023-05-23 10:05:47 +0900 |
commit | a7d70321005d302d9b5aaa2b83569aa899a5aaa9 (patch) | |
tree | dd890c3152627ad08d1be2a2cbe511e30d701026 /lib/syntax_suggest/capture_code_context.rb | |
parent | c638ffa700b7a9a28ba29a5b88d934efaba0e575 (diff) |
Manually merge syntax_suggest-1.1.0
Diffstat (limited to 'lib/syntax_suggest/capture_code_context.rb')
-rw-r--r-- | lib/syntax_suggest/capture_code_context.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/syntax_suggest/capture_code_context.rb b/lib/syntax_suggest/capture_code_context.rb index 71f5b271b5..6dc7047176 100644 --- a/lib/syntax_suggest/capture_code_context.rb +++ b/lib/syntax_suggest/capture_code_context.rb @@ -1,6 +1,14 @@ # frozen_string_literal: true module SyntaxSuggest + module Capture + end +end + +require_relative "capture/falling_indent_lines" +require_relative "capture/before_after_keyword_ends" + +module SyntaxSuggest # Turns a "invalid block(s)" into useful context # # There are three main phases in the algorithm: @@ -81,10 +89,10 @@ module SyntaxSuggest # end # def capture_falling_indent(block) - AroundBlockScan.new( + Capture::FallingIndentLines.new( block: block, code_lines: @code_lines - ).on_falling_indent do |line| + ).call do |line| @lines_to_output << line end end @@ -119,8 +127,10 @@ module SyntaxSuggest def capture_before_after_kws(block) return unless block.visible_lines.count == 1 - around_lines = AroundBlockScan.new(code_lines: @code_lines, block: block) - .capture_before_after_kws + around_lines = Capture::BeforeAfterKeywordEnds.new( + code_lines: @code_lines, + block: block + ).call around_lines -= block.lines |