Module: Ibex::LSP::DocumentStoreValidation
- Included in:
- DocumentStore
- Defined in:
- lib/ibex/lsp/document_store_validation.rb
Overview
Validates versions, source bounds, and prospective multi-file workspace edits.
Instance Method Summary collapse
Instance Method Details
#valid_replacements?(replacements) ⇒ Boolean
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ibex/lsp/document_store_validation.rb', line 8 def valid_replacements?(replacements) # @type self: DocumentStore candidate = Frontend::SourceLoader.new @snapshots.each_value do |entry| candidate.(entry.fetch(:path), entry.fetch(:source)) if entry.fetch(:open) end replacements.each do |path, source| candidate.(path, source) parse_candidate(path, source) end roots = replacements.keys.flat_map { |path| affected_roots(path) }.uniq roots.each { |root| Frontend::Resolver.new(root, mode: :extended, loader: candidate).resolve } true rescue Ibex::Error, SystemCallError false end |