[fix] load

This commit is contained in:
Andy Bunce 2025-08-08 12:26:11 +01:00
parent 49b4b1529a
commit 97d0deef0d
5 changed files with 23 additions and 18 deletions

View file

@ -94,15 +94,27 @@ declare function docs:key(
ws:get($socket,"files")($file)($property)
};
(: get $property key for $file from session $socket :)
declare function docs:get(
$socket as xs:string,
$file as xs:string,
$property as docs:property
) as item()?
{
ws:get($socket,
docs:key($socket,$file,$property)
)
};
declare function docs:parse(
$socket as xs:string,
$file as xs:string
)as map(*)?
{
let $text:=docs:key($socket,$file,"textDocument")
let $text:=docs:get($socket,$file,"textDocument")?text
let $xml:= p:parse-Module($text)=>prof:time("⏱️ p:parse-Module " || $file)
return (
ws:set($socket,docs:key($socket,$file,"parse"),$xml),
rpc:log(`done {$xml/name(.)}`)
rpc:log(`{ current-dateTime() } done {$xml/name(.)} size: { string-length( $text) }`)
)
};

View file

@ -57,16 +57,7 @@ function lsp-text:didOpen($json as map(*))
as map(*)?
{
let $uri:=docs:open(ws:id(),$json?params)=>prof:time("⏱️ doc:save ")
(:
let $xml:=prof:time(p:parse-Module($text),"⏱️ p:parse-Module ")
let $x:=job:eval(xs:anyURI("parse.xq"),
{"params" : $json?params,
"webSocket":ws:id()},
{ 'cache': true() }
)
:)
return rpc:log("saved " || $uri)
return docs:parse(ws:id(),$uri)
};
@ -77,7 +68,6 @@ function lsp-text:didChange($json as map(*))
as map(*)?
{
let $uri:=docs:change(ws:id(),$json?params)=>prof:time("⏱️ doc:change ")
return docs:parse(ws:id(),$uri)
};