Skip to content

Commit 9e42fc0

Browse files
committed
Remove now unneeded ripper workaround
See for context 293b673 I confirmed that the bug was present in 2.7.8 and got fixed in 3.0.0
1 parent 12e755a commit 9e42fc0

3 files changed

Lines changed: 5 additions & 19 deletions

File tree

lib/syntax_suggest/clean_document.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ module SyntaxSuggest
8686
class CleanDocument
8787
def initialize(source:)
8888
lines = clean_sweep(source: source)
89-
@document = CodeLine.from_source(lines.join, lines: lines)
89+
@document = CodeLine.from_source(lines.join)
9090
end
9191

9292
# Call all of the document "cleaners"

lib/syntax_suggest/code_line.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ class CodeLine
2626

2727
# Returns an array of CodeLine objects
2828
# from the source string
29-
def self.from_source(source, lines: nil)
30-
lines ||= source.lines
31-
lex_array_for_line = LexAll.new(source: source, source_lines: lines).each_with_object(Hash.new { |h, k| h[k] = [] }) { |lex, hash| hash[lex.line] << lex }
32-
lines.map.with_index do |line, index|
29+
def self.from_source(source)
30+
lex_array_for_line = LexAll.new(source: source).each_with_object(Hash.new { |h, k| h[k] = [] }) { |lex, hash| hash[lex.line] << lex }
31+
source.lines.map.with_index do |line, index|
3332
CodeLine.new(
3433
line: line,
3534
index: index,

lib/syntax_suggest/lex_all.rb

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,8 @@ module SyntaxSuggest
1818
class LexAll
1919
include Enumerable
2020

21-
def initialize(source:, source_lines: nil)
21+
def initialize(source:)
2222
@lex = self.class.lex(source, 1)
23-
lineno = @lex.last[0][0] + 1
24-
source_lines ||= source.lines
25-
last_lineno = source_lines.length
26-
27-
until lineno >= last_lineno
28-
lines = source_lines[lineno..]
29-
30-
@lex.concat(
31-
self.class.lex(lines.join, lineno + 1)
32-
)
33-
34-
lineno = @lex.last[0].first + 1
35-
end
3623

3724
last_lex = nil
3825
@lex.map! { |elem|

0 commit comments

Comments
 (0)