Class: Ibex::LSP::SymbolIndexBuilder

Inherits:
Object
  • Object
show all
Includes:
SymbolIndexPrecedenceReferences, SymbolIndexSourceQueries
Defined in:
lib/ibex/lsp/symbol_index_builder.rb

Overview

Builds source occurrences and hover metadata from lossless frontend documents.

Instance Method Summary collapse

Constructor Details

#initialize(store, files) ⇒ SymbolIndexBuilder

Returns a new instance of SymbolIndexBuilder.



11
12
13
14
15
16
17
18
19
# File 'lib/ibex/lsp/symbol_index_builder.rb', line 11

def initialize(store, files)
  @store = store
  @files = files
  @occurrences = [] #: Array[SymbolOccurrence]
  @documents = {} #: Hash[String, Frontend::SourceDocument]
  @global_kinds = {} #: Hash[String, Symbol]
  @rule_data = {} #: Hash[String, Hash[Symbol, untyped]]
  @terminal_data = Hash.new { |hash, key| hash[key] = {} } #: Hash[String, Hash[Symbol, untyped]]
end

Instance Method Details

#buildObject



22
23
24
25
26
27
28
29
30
# File 'lib/ibex/lsp/symbol_index_builder.rb', line 22

def build
  collect_documents
  # Definitions from every closure file must exist before references are classified.
  # rubocop:disable Style/CombinableLoops
  @documents.each { |path, document| collect_definitions(path, document) }
  @documents.each { |path, document| collect_references(path, document) }
  # rubocop:enable Style/CombinableLoops
  [@occurrences.freeze, @documents.freeze]
end