Sha256: de13ca9ee42db8e258e9abb170737c1ca90956f926acf1fc1daf3c2feaf05c4d
Contents?: true
Size: 806 Bytes
Versions: 25
Compression:
Stored size: 806 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) || '' ShopifyLiquid::Tag.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
25 entries across 25 versions & 1 rubygems