Skip to content

Commit

Permalink
Use indexables when synchronizing document modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock committed Aug 29, 2023
1 parent 2469629 commit 9d1ee79
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/ruby_lsp/executor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,17 @@ def did_change_watched_files(changes)
file_path = uri.to_standardized_path
next if file_path.nil? || File.directory?(file_path)

base_path = $LOAD_PATH.find { |load_path| file_path.start_with?(load_path) }
indexable = RubyIndexer::Indexable.new(base_path, file_path)

case change[:type]
when Constant::FileChangeType::CREATED
@index.index_single(file_path)
@index.index_single(indexable)
when Constant::FileChangeType::CHANGED
@index.delete(file_path)
@index.index_single(file_path)
@index.delete(indexable)
@index.index_single(indexable)
when Constant::FileChangeType::DELETED
@index.delete(file_path)
@index.delete(indexable)
end
end

Expand Down

0 comments on commit 9d1ee79

Please sign in to comment.