Class: Yoda::Evaluation::CommentCompletion

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/evaluation/comment_completion.rb,
lib/yoda/evaluation/comment_completion/tag_provider.rb,
lib/yoda/evaluation/comment_completion/base_provider.rb,
lib/yoda/evaluation/comment_completion/type_provider.rb,
lib/yoda/evaluation/comment_completion/param_provider.rb

Defined Under Namespace

Classes: BaseProvider, ParamProvider, TagProvider, TypeProvider

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(registry, ast, comments, location) ⇒ CommentCompletion

Returns a new instance of CommentCompletion.

Parameters:

  • registry (Store::Registry)
  • ast (::Parser::AST::Node)
  • comments (Array<::Parser::Source::Comment>)
  • location (Location)


25
26
27
28
29
30
# File 'lib/yoda/evaluation/comment_completion.rb', line 25

def initialize(registry, ast, comments, location)
  @registry = registry
  @ast = ast
  @comments = comments
  @location = location
end

Instance Attribute Details

#astObject (readonly)

Returns the value of attribute ast.



13
14
15
# File 'lib/yoda/evaluation/comment_completion.rb', line 13

def ast
  @ast
end

#commentsObject (readonly)

Returns the value of attribute comments.



16
17
18
# File 'lib/yoda/evaluation/comment_completion.rb', line 16

def comments
  @comments
end

#locationObject (readonly)

Returns the value of attribute location.



19
20
21
# File 'lib/yoda/evaluation/comment_completion.rb', line 19

def location
  @location
end

#registryObject (readonly)

Returns the value of attribute registry.



10
11
12
# File 'lib/yoda/evaluation/comment_completion.rb', line 10

def registry
  @registry
end

Instance Method Details

#available?true, false

Returns:

  • (true, false)


33
34
35
# File 'lib/yoda/evaluation/comment_completion.rb', line 33

def available?
  comment? && providers.any?(&:available?)
end

#candidatesArray<Model::CompletionItem>

Returns:



38
39
40
# File 'lib/yoda/evaluation/comment_completion.rb', line 38

def candidates
  available? ? providers.select(&:available?).map(&:candidates).flatten : []
end