lib/ruby_indexer/lib/ruby_indexer/configuration.rb in ruby-lsp-0.11.2 vs lib/ruby_indexer/lib/ruby_indexer/configuration.rb in ruby-lsp-0.12.0
- old
+ new
@@ -96,10 +96,14 @@
# If the default gem is also a part of the bundle, we skip indexing the default one and index only the one in
# the bundle, which won't be in `default_path`, but will be in `Bundler.bundle_path` instead
next if locked_gems&.any? do |locked_spec|
locked_spec.name == short_name &&
!Gem::Specification.find_by_name(short_name).full_gem_path.start_with?(RbConfig::CONFIG["rubylibprefix"])
+ rescue Gem::MissingSpecError
+ # If a default gem is scoped to a specific platform, then `find_by_name` will raise. We want to skip those
+ # cases
+ true
end
if pathname.directory?
# If the default_path is a directory, we index all the Ruby files in it
indexables.concat(
@@ -140,10 +144,10 @@
indexables
end
sig { returns(Regexp) }
def magic_comment_regex
- @magic_comment_regex ||= T.let(/^\s*#\s*#{@excluded_magic_comments.join("|")}/, T.nilable(Regexp))
+ @magic_comment_regex ||= T.let(/^#\s*#{@excluded_magic_comments.join("|")}/, T.nilable(Regexp))
end
private
sig { params(config: T::Hash[String, T.untyped]).void }