module namespace comp = 'lsp-completions';
import module namespace lspt = 'lsp-typedefs' at "../lsp-typedefs.xqm";
import module namespace ctx="lsp/context"  at "../context.xqm";

declare variable $comp:snippet-source:="../etc/snippets.json";
declare variable $comp:snippets:=json:doc($comp:snippet-source,{"format":"w3"});

(: (:{"triggerCharacter":":","triggerKind":2.0e0}:):)
declare function comp:list($context as map(*))
as lspt:CompletionItem*
{
    message($context,"context: "),
    ctx:functions("fn")!ctx:map(.)
};

declare function comp:dummy($context as map(*))
as lspt:CompletionItem*
{
  message($context,"context: "),
  map:for-each(
    $lspt:CompletionItemKindMap,
    fn($k,$v){
      let $d:=lspt:MarkupContent(
        'markdown',
        `More about
        <a href="https://quodatum.github.io/basex-xqparse/i-BaseX.xhtml#EQName" target="_blank">{$k}</a>
         `
      )
      return lspt:CompletionItem($k,$v,detail:="detail",documentation:=$d)
    })
};