Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions lib/ruby_lsp/ruby_lsp_rails/support/location_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down