Sha256: d880c4fa059bd2911b9466557defd9f86c725c778ae779bcf2379bed44aa0c8d
Contents?: true
Size: 903 Bytes
Versions: 30
Compression:
Stored size: 903 Bytes
Contents
# frozen_string_literal: true module ThemeCheck module LanguageServer class ObjectCompletionProvider < CompletionProvider def completions(content, cursor) return [] unless (variable_lookup = variable_lookup_at_cursor(content, cursor)) return [] unless variable_lookup.lookups.empty? return [] if content[cursor - 1] == "." ShopifyLiquid::Object.labels .select { |w| w.start_with?(partial(variable_lookup)) } .map { |object| object_to_completion(object) } end def variable_lookup_at_cursor(content, cursor) VariableLookupFinder.lookup(content, cursor) end def partial(variable_lookup) variable_lookup.name || '' end private def object_to_completion(object) { label: object, kind: CompletionItemKinds::VARIABLE, } end end end end
Version data entries
30 entries across 30 versions & 1 rubygems