Class: Yoda::Services::CodeCompletion::ConstProvider

Inherits:
BaseProvider
  • Object
show all
Defined in:
lib/yoda/services/code_completion/const_provider.rb

Instance Attribute Summary

Attributes inherited from BaseProvider

#ast, #environment, #evaluator, #location

Instance Method Summary collapse

Methods inherited from BaseProvider

#initialize

Constructor Details

This class inherits a constructor from Yoda::Services::CodeCompletion::BaseProvider

Instance Method Details

#candidatesArray<Model::CompletionItem>

Returns constant candidates by using the current lexical scope.

Returns:



12
13
14
15
16
17
18
19
20
21
# File 'lib/yoda/services/code_completion/const_provider.rb', line 12

def candidates
  const_candidates.map do |const_candidate|
    Model::CompletionItem.new(
      description: Model::Descriptions::ValueDescription.new(const_candidate),
      range: substitution_range,
      kind: complete_item_kind(const_candidate),
      prefix: just_after_separator? ? '::' : '',
    )
  end
end

#providable?true, false

Returns:

  • (true, false)


6
7
8
# File 'lib/yoda/services/code_completion/const_provider.rb', line 6

def providable?
  !!current_ancestor_const_node
end