diff --git a/Gemfile.lock b/Gemfile.lock index 24a8fbe9..0a1fbc26 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -241,14 +241,14 @@ GEM sorbet-runtime (>= 0.5.10782) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - sorbet (0.5.11406) - sorbet-static (= 0.5.11406) - sorbet-runtime (0.5.11406) - sorbet-static (0.5.11406-universal-darwin) - sorbet-static (0.5.11406-x86_64-linux) - sorbet-static-and-runtime (0.5.11406) - sorbet (= 0.5.11406) - sorbet-runtime (= 0.5.11406) + sorbet (0.5.11554) + sorbet-static (= 0.5.11554) + sorbet-runtime (0.5.11554) + sorbet-static (0.5.11554-universal-darwin) + sorbet-static (0.5.11554-x86_64-linux) + sorbet-static-and-runtime (0.5.11554) + sorbet (= 0.5.11554) + sorbet-runtime (= 0.5.11554) spoom (1.3.0) erubi (>= 1.10.0) prism (>= 0.19.0) diff --git a/lib/ruby_lsp/ruby_lsp_rails/support/location_builder.rb b/lib/ruby_lsp/ruby_lsp_rails/support/location_builder.rb index b21c0ee7..d7fa2a99 100644 --- a/lib/ruby_lsp/ruby_lsp_rails/support/location_builder.rb +++ b/lib/ruby_lsp/ruby_lsp_rails/support/location_builder.rb @@ -11,18 +11,18 @@ class << self sig { params(location_string: String).returns(Interface::Location) } def line_location_from_s(location_string) *file_parts, line = location_string.split(":") - - raise ArgumentError, "Invalid location string given" unless file_parts + raise ArgumentError, "Invalid location string given" if file_parts.empty? # On Windows, file paths will look something like `C:/path/to/file.rb:123`. Only the last colon is the line # number and all other parts compose the file path file_path = file_parts.join(":") + line_as_number = line ? Integer(line.to_i) - 1 : 0 Interface::Location.new( uri: URI::Generic.from_path(path: file_path).to_s, range: Interface::Range.new( - start: Interface::Position.new(line: Integer(line) - 1, character: 0), - end: Interface::Position.new(line: Integer(line) - 1, character: 0), + start: Interface::Position.new(line: line_as_number, character: 0), + end: Interface::Position.new(line: line_as_number, character: 0), ), ) end