class BELParser::Completion::ExactMatchParameterCompleter
Public Instance Methods
complete(string_literal, caret_position, options = {})
click to toggle source
# File lib/bel_parser/completion.rb, line 868 def complete(string_literal, caret_position, options = {}) # find namespace URI if prefix was provided prefix = options[:prefix] if prefix specified_prefix = prefix.to_s.upcase matched_namespace = @namespaces[specified_prefix] uri = matched_namespace ? matched_namespace.uri : nil else uri = nil end @search .search(string_literal, :namespace_concept, uri, nil, size: 100, exact_match: true) .map { |match| match_namespace = @namespaces.values.find { |ns| ns.uri == match.scheme_uri } next unless match_namespace prefix = match_namespace.keyword ns_value, value_ast = map_value(prefix, match.pref_label) [ ns_value, argument( parameter( prefix( identifier( prefix)), value_ast)) ] } .to_a .compact end