Sha256: dc6378c1dda7580f0a5e04b9b6f3088a49ad21b00feb11f5092a7e6f45a31cee
Contents?: true
Size: 836 Bytes
Versions: 6
Compression:
Stored size: 836 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.start_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
6 entries across 6 versions & 1 rubygems