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
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ group :development do
gem "psych", "~> 5.1", require: false
gem "rake", "~> 13.2"
gem "rubocop-md", "~> 1.2.0", require: false
gem "rubocop-minitest", "~> 0.35.0", require: false
gem "rubocop-minitest", "~> 0.36.0", require: false
gem "rubocop-rake", "~> 0.6.0", require: false
gem "rubocop-shopify", "~> 2.15", require: false
gem "rubocop-sorbet", "~> 0.8", require: false
gem "rubocop", "~> 1.65"
gem "rubocop", "~> 1.70"
gem "simplecov", require: false
gem "syntax_tree", ">= 6.1.1", "< 7"

Expand Down
56 changes: 30 additions & 26 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ GEM
specs:
ansi (1.5.0)
ast (2.4.2)
benchmark (0.4.0)
builder (3.3.0)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
docile (1.4.1)
erubi (1.13.0)
erubi (1.13.1)
io-console (0.7.2)
irb (1.14.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.7.2)
json (2.9.1)
language_server-protocol (3.17.0.3)
logger (1.6.1)
minitest (5.25.1)
Expand All @@ -35,7 +36,7 @@ GEM
ruby2_keywords (>= 0.0.5)
netrc (0.11.0)
parallel (1.26.3)
parser (3.3.5.0)
parser (3.3.6.0)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
Expand All @@ -45,38 +46,38 @@ GEM
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
rbi (0.2.1)
rbi (0.2.3)
prism (~> 1.0)
sorbet-runtime (>= 0.5.9204)
rbs (3.6.1)
logger
rdoc (6.7.0)
psych (>= 4.0.0)
regexp_parser (2.9.2)
regexp_parser (2.10.0)
reline (0.5.10)
io-console (~> 0.5)
rubocop (1.66.1)
rubocop (1.70.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rubocop-ast (>= 1.32.2, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.36.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.32.3)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.37.0)
parser (>= 3.3.1.0)
rubocop-md (1.2.3)
rubocop-md (1.2.4)
rubocop (>= 1.45)
rubocop-minitest (0.35.1)
rubocop-minitest (0.36.0)
rubocop (>= 1.61, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-shopify (2.15.1)
rubocop (~> 1.51)
rubocop-sorbet (0.8.5)
rubocop-sorbet (0.8.7)
rubocop (>= 1)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
Expand All @@ -86,23 +87,24 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.13.1)
simplecov_json_formatter (0.1.4)
sorbet (0.5.11597)
sorbet-static (= 0.5.11597)
sorbet-runtime (0.5.11597)
sorbet-static (0.5.11597-universal-darwin)
sorbet-static (0.5.11597-x86_64-linux)
sorbet-static-and-runtime (0.5.11597)
sorbet (= 0.5.11597)
sorbet-runtime (= 0.5.11597)
spoom (1.5.0)
sorbet (0.5.11758)
sorbet-static (= 0.5.11758)
sorbet-runtime (0.5.11758)
sorbet-static (0.5.11758-universal-darwin)
sorbet-static (0.5.11758-x86_64-linux)
sorbet-static-and-runtime (0.5.11758)
sorbet (= 0.5.11758)
sorbet-runtime (= 0.5.11758)
spoom (1.5.1)
erubi (>= 1.10.0)
prism (>= 0.28.0)
sorbet-static-and-runtime (>= 0.5.10187)
thor (>= 0.19.2)
stringio (3.1.1)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
tapioca (0.16.3)
tapioca (0.16.7)
benchmark
bundler (>= 2.2.25)
netrc (>= 0.11.0)
parallel (>= 1.21.0)
Expand All @@ -112,7 +114,9 @@ GEM
thor (>= 1.2.0)
yard-sorbet
thor (1.3.2)
unicode-display_width (2.6.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
yard (0.9.37)
yard-sorbet (0.9.0)
sorbet-runtime
Expand All @@ -133,9 +137,9 @@ DEPENDENCIES
mocha (~> 2.3)
psych (~> 5.1)
rake (~> 13.2)
rubocop (~> 1.65)
rubocop (~> 1.70)
rubocop-md (~> 1.2.0)
rubocop-minitest (~> 0.35.0)
rubocop-minitest (~> 0.36.0)
rubocop-rake (~> 0.6.0)
rubocop-shopify (~> 2.15)
rubocop-sorbet (~> 0.8)
Expand Down
5 changes: 3 additions & 2 deletions lib/ruby_lsp/listeners/document_highlight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def initialize(response_builder, target, parent, dispatcher, position)
[target, node_value(target)]
when Prism::ModuleNode, Prism::ClassNode, Prism::SingletonClassNode, Prism::DefNode, Prism::CaseNode,
Prism::WhileNode, Prism::UntilNode, Prism::ForNode, Prism::IfNode, Prism::UnlessNode
target
[target, nil]
end

@target = T.let(highlight_target, T.nilable(Prism::Node))
Expand Down Expand Up @@ -620,7 +620,8 @@ def node_value(node)

sig { params(keyword_loc: T.nilable(Prism::Location), end_loc: T.nilable(Prism::Location)).void }
def add_matching_end_highlights(keyword_loc, end_loc)
return unless keyword_loc && end_loc && end_loc.length.positive?
return unless keyword_loc && end_loc
return unless end_loc.length.positive?
return unless covers_target_position?(keyword_loc) || covers_target_position?(end_loc)

add_highlight(Constant::DocumentHighlightKind::TEXT, keyword_loc)
Expand Down
10 changes: 8 additions & 2 deletions lib/ruby_lsp/listeners/document_link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ def extract_document_link(node)
path = uri.path
return unless path

file_path = self.class.gem_paths.dig(uri.gem_name, gem_version, CGI.unescape(path))
gem_name = uri.gem_name
return unless gem_name

file_path = self.class.gem_paths.dig(gem_name, gem_version, CGI.unescape(path))
return if file_path.nil?

@response_builder << Interface::DocumentLink.new(
Expand All @@ -152,7 +155,10 @@ def resolve_version(uri)

return @gem_version unless @gem_version.nil? || @gem_version.empty?

GEM_TO_VERSION_MAP[uri.gem_name]
gem_name = uri.gem_name
return unless gem_name

GEM_TO_VERSION_MAP[gem_name]
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/ruby_lsp/load_sorbet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
begin
T::Configuration.default_checked_level = :never
# Suppresses call validation errors
T::Configuration.call_validation_error_handler = ->(*) {}
T::Configuration.call_validation_error_handler = ->(*arg) {}
# Suppresses errors caused by T.cast, T.let, T.must, etc.
T::Configuration.inline_type_error_handler = ->(*) {}
T::Configuration.inline_type_error_handler = ->(*arg) {}
# Suppresses errors caused by incorrect parameter ordering
T::Configuration.sig_validation_error_handler = ->(*) {}
T::Configuration.sig_validation_error_handler = ->(*arg) {}
rescue
# Need this rescue so that if another gem has
# already set the checked level by the time we
Expand Down
Loading