From afe98e48e2072219bd1056028a953734d1a0d0e0 Mon Sep 17 00:00:00 2001 From: Andy Bunce Date: Sun, 22 Feb 2026 12:17:47 +0000 Subject: [PATCH] [mod] tidy --- compose.yaml | 5 +- webapp/lsp/storex.xqm | 68 + webapp/static/clients/codemirror/index.html | 31 +- .../static/clients/codemirror/lsp.bundle.js | 4649 +++++++++-------- .../clients/codemirror/lsp.bundle.js.map | 2 +- webapp/static/clients/codemirror/script.js | 22 +- webapp/static/clients/codemirror/wa.html | 340 -- webapp/static/clients/codemirror/wa2.css | 3 +- webapp/static/clients/monaco/index.html | 26 + webapp/static/clients/monaco/style.css | 10 + 10 files changed, 2561 insertions(+), 2595 deletions(-) create mode 100644 webapp/lsp/storex.xqm delete mode 100644 webapp/static/clients/codemirror/wa.html create mode 100644 webapp/static/clients/monaco/index.html create mode 100644 webapp/static/clients/monaco/style.css diff --git a/compose.yaml b/compose.yaml index 537bc7a..2e4930f 100644 --- a/compose.yaml +++ b/compose.yaml @@ -13,7 +13,7 @@ services: - ./webapp/custom:/srv/basex/lib/custom:ro # jars - ./webapp/lsp:/srv/basex/webapp/lsp - ./webapp/static/clients:/srv/basex/webapp/static/clients:ro - - webawesome-3.2.1:/srv/basex/webapp/static/webawesome:ro + - webawesome:/srv/basex/webapp/static/webawesome:ro - ./webapp/lsp-manager:/srv/basex/webapp/lsp-manager # - ./repo:/srv/basex/repo environment: @@ -22,5 +22,6 @@ services: volumes: basex-lsp: - webawesome-3.2.1: + webawesome: external: true + name: webawesome-3.2.1 diff --git a/webapp/lsp/storex.xqm b/webapp/lsp/storex.xqm new file mode 100644 index 0000000..193ac15 --- /dev/null +++ b/webapp/lsp/storex.xqm @@ -0,0 +1,68 @@ +(:~ + Manage a store for websocket info.It is named as the websocket $sid +:) +module namespace storex = 'storex'; + +(: cache has index :) +declare variable $storex:rules:={ + "doc":{ + "description":"A text document" + }, + + "parse":{ + "description":"XML parse tree" , + "depends":"text", + "calc": "xqparse" + }, + + "symbols":{ + "description":"LSP symbols", + "depends":"parse", + "calc": "symbols" + } + +}; +(:~ in store $sid, and key $uri get value of $property :) +declare function storex:get($uri as xs:string,$sid as xs:string,$property as xs:string) +{ +let $id:=storex:id($uri,$sid ) +let $property:=storex:property($property) +return store:get($property || $id,$sid) + otherwise error(xs:QName("storex:get"),`property unknown: '{$property}'`) +}; + +(:~ get value of $property :) +declare function storex:put($uri as xs:string, + $sid as xs:string, + $property as xs:string, + $value as item()) +{ +let $id:=storex:id($uri,$sid ,true() ) +let $property:=storex:property($property) +return store:put($property || $id,$value,$sid) +}; + +(:~ key for $sid and $uri, error if not found unless $add. +if $add then add entry for uri + :) +declare function storex:id($uri as xs:string,$sid as xs:string,$add as xs:boolean:=false()) +{ +let $index:=store:get-or-put("index",fn(){{}},$sid) +return if(map:contains($index,$uri)) + then $index?uri + else if($add) + then let $id:=random:uuid() + return ($id,store:put("index",map:put($index,$uri,$id),$sid)) + else error(xs:QName("storex:get"),`Uri not found: '{$uri}'`) +}; + +(:~ key for $sid and $uri, error if not found unless $add. +if $add then add entry for uri + :) +declare function storex:property($property as xs:string) +as xs:string +{ + if(map:contains($storex:rules,$property)) + then $property + else error(xs:QName("storex:get"),`property not in rules: '{$property}'`) +}; \ No newline at end of file diff --git a/webapp/static/clients/codemirror/index.html b/webapp/static/clients/codemirror/index.html index 16d4d52..5721e7e 100644 --- a/webapp/static/clients/codemirror/index.html +++ b/webapp/static/clients/codemirror/index.html @@ -71,9 +71,9 @@
-
- WORKSPACE - +