Skip to content

Commit 9eca493

Browse files
committed
Fix indexing properly handle single and all files
1 parent cd44b53 commit 9eca493

File tree

1 file changed

+7
-7
lines changed
  • lib/ruby_indexer/lib/ruby_indexer

1 file changed

+7
-7
lines changed

lib/ruby_indexer/lib/ruby_indexer/index.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,14 @@ def index_all(uris: @configuration.indexable_uris, &block)
368368
break unless block.call(progress)
369369
end
370370

371-
index_file(uri, collect_comments: false)
371+
index_file(uri, collect_comments: false, process_unresolved: false)
372372
end
373373

374374
@initial_indexing_completed = true
375375
end
376376

377-
#: (URI::Generic uri, String source, ?collect_comments: bool) -> void
378-
def index_single(uri, source, collect_comments: true)
377+
#: (URI::Generic uri, String source, ?collect_comments: bool, ?process_unresolved: bool) -> void
378+
def index_single(uri, source, collect_comments: true, process_unresolved: true)
379379
dispatcher = Prism::Dispatcher.new
380380

381381
result = Prism.parse(source)
@@ -385,7 +385,7 @@ def index_single(uri, source, collect_comments: true)
385385
require_path = uri.require_path
386386
@require_paths_tree.insert(require_path, uri) if require_path
387387

388-
process_unresolved_entries
388+
process_unresolved_entries if process_unresolved
389389

390390
indexing_errors = listener.indexing_errors.uniq
391391
indexing_errors.each { |error| $stderr.puts(error) } if indexing_errors.any?
@@ -398,10 +398,10 @@ def index_single(uri, source, collect_comments: true)
398398
end
399399

400400
# Indexes a File URI by reading the contents from disk
401-
#: (URI::Generic uri, ?collect_comments: bool) -> void
402-
def index_file(uri, collect_comments: true)
401+
#: (URI::Generic uri, ?collect_comments: bool, ?process_unresolved: bool) -> void
402+
def index_file(uri, collect_comments: true, process_unresolved: true)
403403
path = uri.full_path #: as !nil
404-
index_single(uri, File.read(path), collect_comments: collect_comments)
404+
index_single(uri, File.read(path), collect_comments: collect_comments, process_unresolved: process_unresolved)
405405
rescue Errno::EISDIR, Errno::ENOENT
406406
# If `path` is a directory, just ignore it and continue indexing. If the file doesn't exist, then we also ignore
407407
# it

0 commit comments

Comments
 (0)