24 lines
No EOL
756 B
Text
24 lines
No EOL
756 B
Text
(: parse a didOpen :)
|
|
import module namespace p="xq4" at "xq4.xqm";
|
|
|
|
declare variable $textDocument external;
|
|
declare variable $webSocket as xs:string external;
|
|
|
|
let $text as xs:string:=$textDocument?text
|
|
let $uri:=$textDocument?uri
|
|
let $files:=ws:get($webSocket,"files",{})
|
|
let $files:=if(map:contains($files,$uri))
|
|
then $files
|
|
else map:put($files,$uri,{"textDocument":random:uuid(),"parse":random:uuid() })
|
|
let $keys:=$files($uri)
|
|
let $xml:=p:parse-Module($text)
|
|
|
|
return (
|
|
ws:set($webSocket,"files",$files),
|
|
ws:set($webSocket,$keys?textDocument,$textDocument),
|
|
ws:set($webSocket,$keys?parse,$xml),
|
|
ws:send({"jsonrpc": "2.0","method":"window/logMessage",
|
|
"params":{"type":1,"message":"TODO"}},$webSocket)
|
|
)
|
|
|
|
|