class Yoda::Evaluation::CommentCompletion

Attributes

ast[R]

@type ::Parser::AST::Node

comments[R]

@type Array<::Parser::Source::Comment>

location[R]

@type Location

registry[R]

Public Class Methods

new(registry, ast, comments, location) click to toggle source

@param registry [Store::Registry] @param ast [::Parser::AST::Node] @param comments [Array<::Parser::Source::Comment>] @param location [Location]

# File lib/yoda/evaluation/comment_completion.rb, line 25
def initialize(registry, ast, comments, location)
  @registry = registry
  @ast = ast
  @comments = comments
  @location = location
end

Public Instance Methods

available?() click to toggle source

@return [true, false]

# File lib/yoda/evaluation/comment_completion.rb, line 33
def available?
  comment? && providers.any?(&:available?)
end
candidates() click to toggle source

@return [Array<Model::CompletionItem>]

# File lib/yoda/evaluation/comment_completion.rb, line 38
def candidates
  available? ? providers.select(&:available?).map(&:candidates).flatten : []
end

Private Instance Methods

comment?() click to toggle source
# File lib/yoda/evaluation/comment_completion.rb, line 64
def comment?
  return @is_comment if instance_variable_defined?(:@is_comment)
  @is_comment = !!Parsing::Query::CurrentCommentQuery.new(comments, location).current_comment
end
param_provider() click to toggle source

@return [ParamProvider]

# File lib/yoda/evaluation/comment_completion.rb, line 50
def param_provider
  @param_provider ||= ParamProvider.new(registry, ast, comments, location)
end
providers() click to toggle source

@return [Array<CommentCompletion::BaseProvider>]

# File lib/yoda/evaluation/comment_completion.rb, line 45
def providers
  [param_provider, tag_provider, type_provider]
end
tag_provider() click to toggle source

@return [TagProvider]

# File lib/yoda/evaluation/comment_completion.rb, line 55
def tag_provider
  @tag_provider ||= TagProvider.new(registry, ast, comments, location)
end
type_provider() click to toggle source

@return [TypeProvider]

# File lib/yoda/evaluation/comment_completion.rb, line 60
def type_provider
  @type_provider ||= TypeProvider.new(registry, ast, comments, location)
end