Sha256: 4b29da0389ac926bd391d01b1914b16184b20d10596cd9ad69973ac46cfff0f3
Contents?: true
Size: 878 Bytes
Versions: 11
Compression:
Stored size: 878 Bytes
Contents
# frozen_string_literal: true module ThemeCheck module LanguageServer class TagCompletionProvider < CompletionProvider def completions(content, cursor) return [] unless can_complete?(content, cursor) partial = first_word(content) || '' labels = ShopifyLiquid::Tag.labels labels += ShopifyLiquid::Tag.end_labels labels .select { |w| w.start_with?(partial) } .map { |tag| tag_to_completion(tag) } end def can_complete?(content, cursor) content.start_with?(Liquid::TagStart) && ( cursor_on_first_word?(content, cursor) || cursor_on_start_content?(content, cursor, Liquid::TagStart) ) end private def tag_to_completion(tag) { label: tag, kind: CompletionItemKinds::KEYWORD, } end end end end
Version data entries
11 entries across 11 versions & 1 rubygems