Skip to content

Commit

Permalink
Use Ruby LSP's URI#to_standardized_path method when available and not…
Browse files Browse the repository at this point in the history
… returning nil
  • Loading branch information
searls committed Jun 23, 2024
1 parent 2f2d54b commit f00f3e0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/ruby_lsp/standard/wraps_built_in_lsp_standardizer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ def run_diagnostic(uri, document)
private

# duplicated from: lib/standard/lsp/routes.rb
# modified to incorporate Ruby LSP's to_standardized_path method
def uri_to_path(uri)
uri.to_s.sub(%r{^file://}, "")
if uri.respond_to?(:to_standardized_path) && !(standardized_path = uri.to_standardized_path).nil?
standardized_path
else
uri.to_s.sub(%r{^file://}, "")
end
end

# lifted from:
Expand Down

0 comments on commit f00f3e0

Please sign in to comment.