Sha256: 925b22f64bccbc67e641d19afc5447e28a3ea3abe75e23ffb2129c67dbfa0c9d
Contents?: true
Size: 837 Bytes
Versions: 3
Compression:
Stored size: 837 Bytes
Contents
# frozen_string_literal: true module ThemeCheck module LanguageServer class ObjectCompletionProvider < CompletionProvider def completions(content, cursor) return [] unless can_complete?(content, cursor) partial = first_word(content) || '' ShopifyLiquid::Object.labels .select { |w| w.starts_with?(partial) } .map { |object| object_to_completion(object) } end def can_complete?(content, cursor) content.match?(Liquid::VariableStart) && ( cursor_on_first_word?(content, cursor) || cursor_on_start_content?(content, cursor, Liquid::VariableStart) ) end private def object_to_completion(object) { label: object, kind: CompletionItemKinds::VARIABLE, } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems