Class: BELParser::Completion::ExactMatchParameterCompleter
- Inherits:
-
BaseCompleter
- Object
- BaseCompleter
- BELParser::Completion::ExactMatchParameterCompleter
- Includes:
- QuotedValue
- Defined in:
- lib/bel_parser/completion.rb
Instance Method Summary collapse
Methods included from QuotedValue
Methods inherited from BaseCompleter
Methods included from Parsers::AST::Sexp
#annotation_definition, #argument, #blank_line, build, #comment, #comment_line, #document_property, #domain, #function, #identifier, #keyword, #list, #list_item, #multi_identifier, #name, #namespace_definition, #nested_statement, #object, #observed_term, #parameter, #pattern, #prefix, #relationship, #set, #simple_statement, #statement, #string, #subject, #term, #unset, #uri, #url, #value
Constructor Details
This class inherits a constructor from BELParser::Completion::BaseCompleter
Instance Method Details
#complete(string_literal, caret_position, options = {}) ⇒ Object
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 |
# File 'lib/bel_parser/completion.rb', line 868 def complete(string_literal, caret_position, = {}) # find namespace URI if prefix was provided prefix = [: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 |