Module: ThemeCheck::LanguageServer::VariableLookupFinder

Extended by:
VariableLookupFinder
Includes:
TypeHelper, Constants
Included in:
VariableLookupFinder
Defined in:
lib/theme_check/language_server/variable_lookup_finder.rb,
lib/theme_check/language_server/variable_lookup_finder/constants.rb,
lib/theme_check/language_server/variable_lookup_finder/liquid_fixer.rb,
lib/theme_check/language_server/variable_lookup_finder/tolerant_parser.rb,
lib/theme_check/language_server/variable_lookup_finder/potential_lookup.rb,
lib/theme_check/language_server/variable_lookup_finder/assignments_finder.rb,
lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope.rb,
lib/theme_check/language_server/variable_lookup_finder/assignments_finder/node_handler.rb,
lib/theme_check/language_server/variable_lookup_finder/assignments_finder/scope_visitor.rb

Defined Under Namespace

Modules: Constants, TolerantParser Classes: AssignmentsFinder, LiquidFixer, PotentialLookup

Constant Summary

Constants included from Constants

Constants::ANY_ENDING_TAG, Constants::ANY_STARTING_TAG, Constants::ENDS_IN_BRACKET_POSITION_THAT_CANT_BE_COMPLETED, Constants::ENDS_WITH_BLANK_POTENTIAL_LOOKUP, Constants::ENDS_WITH_POTENTIAL_LOOKUP, Constants::SYMBOLS_PRECEDING_POTENTIAL_LOOKUPS, Constants::UNCLOSED_SQUARE_BRACKET, Constants::VARIABLE_LOOKUP, Constants::VARIABLE_LOOKUP_CHARACTERS, Constants::VARIABLE_START

Instance Method Summary collapse

Methods included from TypeHelper

#input_type_of

Instance Method Details

#lookup(context) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/theme_check/language_server/variable_lookup_finder.rb', line 12

def lookup(context)
  content = context.content
  cursor = context.cursor

  return if cursor_is_on_bracket_position_that_cant_be_completed(content, cursor)

  variable_lookup = lookup_liquid_variable(content, cursor) || lookup_liquid_tag(content, cursor)

  return variable_lookup if variable_lookup.is_a?(PotentialLookup)
  return unless variable_lookup.is_a?(Liquid::VariableLookup)

  potential_lookup(variable_lookup, context)
end

#lookup_literal(context) ⇒ Object



26
27
28
# File 'lib/theme_check/language_server/variable_lookup_finder.rb', line 26

def lookup_literal(context)
  lookup_liquid_variable(context.content, context.cursor)
end