diff options
author | Schneems <richard.schneeman+foo@gmail.com> | 2023-12-04 16:17:19 -0600 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-12-04 22:18:40 +0000 |
commit | 13482ab1e61e0c337badd6308412621f807df9c1 (patch) | |
tree | 274b4222aad75f93f9d3cd2776bb3fbf2e90c44b /lib/syntax_suggest | |
parent | 81a700853d1d3bdf7973c7d7175711e7e8c508c7 (diff) |
[ruby/syntax_suggest] Update standardrb to Ruby 3.0 standards
https://github.com/ruby/syntax_suggest/commit/2771dcabe0
Diffstat (limited to 'lib/syntax_suggest')
-rw-r--r-- | lib/syntax_suggest/clean_document.rb | 8 | ||||
-rw-r--r-- | lib/syntax_suggest/lex_all.rb | 2 | ||||
-rw-r--r-- | lib/syntax_suggest/scan_history.rb | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/syntax_suggest/clean_document.rb b/lib/syntax_suggest/clean_document.rb index 2c26061bfc..44aae262ef 100644 --- a/lib/syntax_suggest/clean_document.rb +++ b/lib/syntax_suggest/clean_document.rb @@ -224,7 +224,7 @@ module SyntaxSuggest # def join_consecutive! consecutive_groups = @document.select(&:ignore_newline_not_beg?).map do |code_line| - take_while_including(code_line.index..-1) do |line| + take_while_including(code_line.index..) do |line| line.ignore_newline_not_beg? end end @@ -245,7 +245,7 @@ module SyntaxSuggest # expect(lines[1].to_s).to eq("") def join_trailing_slash! trailing_groups = @document.select(&:trailing_slash?).map do |code_line| - take_while_including(code_line.index..-1) { |x| x.trailing_slash? } + take_while_including(code_line.index..) { |x| x.trailing_slash? } end join_groups(trailing_groups) self @@ -279,7 +279,7 @@ module SyntaxSuggest ) # Hide the rest of the lines - lines[1..-1].each do |line| + lines[1..].each do |line| # The above lines already have newlines in them, if add more # then there will be double newline, use an empty line instead @document[line.index] = CodeLine.new(line: "", index: line.index, lex: []) @@ -293,7 +293,7 @@ module SyntaxSuggest # Like `take_while` except when it stops # iterating, it also returns the line # that caused it to stop - def take_while_including(range = 0..-1) + def take_while_including(range = 0..) take_next_and_stop = false @document[range].take_while do |line| next if take_next_and_stop diff --git a/lib/syntax_suggest/lex_all.rb b/lib/syntax_suggest/lex_all.rb index 132cba9f5d..962d0d5a93 100644 --- a/lib/syntax_suggest/lex_all.rb +++ b/lib/syntax_suggest/lex_all.rb @@ -17,7 +17,7 @@ module SyntaxSuggest last_lineno = source_lines.length until lineno >= last_lineno - lines = source_lines[lineno..-1] + lines = source_lines[lineno..] @lex.concat( Ripper::Lexer.new(lines.join, "-", lineno + 1).parse.sort_by(&:pos) diff --git a/lib/syntax_suggest/scan_history.rb b/lib/syntax_suggest/scan_history.rb index d15597c440..dc36e6ba2e 100644 --- a/lib/syntax_suggest/scan_history.rb +++ b/lib/syntax_suggest/scan_history.rb @@ -118,7 +118,7 @@ module SyntaxSuggest # Returns an array of all the CodeLines that exist after # the currently scanned block private def after_lines - @code_lines[@after_index.next..-1] || [] + @code_lines[@after_index.next..] || [] end private def current |