Sha256: cfe03678eb99895a40fd1f79f5bdbebe040b91d23e1df8366d1b7dffe81b4615
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true module PlatformosCheck module LanguageServer class ObjectCompletionProvider < CompletionProvider def completions(context) content = context.content return [] if content.nil? return [] unless (variable_lookup = VariableLookupFinder.lookup(context)) return [] unless variable_lookup.lookups.empty? return [] if content[context.cursor - 1] == "." PlatformosLiquid::SourceIndex .objects .select(&:global?) .select { |object| object.name.start_with?(partial(variable_lookup)) } .map { |object| object_to_completion(object) } end def partial(variable_lookup) variable_lookup.name || '' end private def object_to_completion(object) content = PlatformosLiquid::Documentation.render_doc(object) { label: object.name, kind: CompletionItemKinds::VARIABLE, **format_hash(object), **doc_hash(content) } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems