Sha256: 1b936efb1574e6c09ffa00e87fff163d84a4ff6d87d94b9f8e3c7cc8898b3f83

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true

module ThemeCheck
  module LanguageServer
    module VariableLookupFinder
      module Constants
        ANY_STARTING_TAG = /\s*#{Liquid::AnyStartingTag}/
        ANY_ENDING_TAG = /#{Liquid::TagEnd}|#{Liquid::VariableEnd}\s*^/om

        UNCLOSED_SQUARE_BRACKET = /\[[^\]]*\Z/
        ENDS_IN_BRACKET_POSITION_THAT_CANT_BE_COMPLETED = %r{
          (
            # quotes not preceded by a [
            (?<!\[)['"]|
            # closing ]
            \]|
            # opening [
            \[
          )$
        }x

        VARIABLE_START = /\s*#{Liquid::VariableStart}/
        VARIABLE_LOOKUP_CHARACTERS = /[a-z0-9_.'"\]\[]/i
        VARIABLE_LOOKUP = /#{VARIABLE_LOOKUP_CHARACTERS}+/o
        SYMBOLS_PRECEDING_POTENTIAL_LOOKUPS = %r{
          (?:
            \s(?:
              if|elsif|unless|and|or|#{Liquid::Condition.operators.keys.join("|")}
              |echo
              |paginate
              |case|when
              |cycle
              |in
            )
            |[:,=]
          )
          \s+
        }omix
        ENDS_WITH_BLANK_POTENTIAL_LOOKUP = /#{SYMBOLS_PRECEDING_POTENTIAL_LOOKUPS}$/oimx
        ENDS_WITH_POTENTIAL_LOOKUP = /#{SYMBOLS_PRECEDING_POTENTIAL_LOOKUPS}#{VARIABLE_LOOKUP}$/oimx
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
theme-check-1.15.0 lib/theme_check/language_server/variable_lookup_finder/constants.rb
theme-check-1.14.0 lib/theme_check/language_server/variable_lookup_finder/constants.rb
theme-check-1.13.0 lib/theme_check/language_server/variable_lookup_finder/constants.rb
theme-check-1.12.1 lib/theme_check/language_server/variable_lookup_finder/constants.rb