From 2a3e962c585b096535f76553679ca7a6c330cf5f Mon Sep 17 00:00:00 2001 From: Andy Bunce Date: Sun, 21 Sep 2025 18:00:51 +0100 Subject: [PATCH] [add] symbol wc --- webapp/lsp/lsp-text.xqm | 5 +- webapp/static/clients/codemirror/data.json | 26 ++++++++ webapp/static/clients/codemirror/grail.css | 1 - webapp/static/clients/codemirror/grail.html | 8 ++- webapp/static/clients/codemirror/list.js | 68 +++++++++++++++++++++ webapp/static/clients/codemirror/script.js | 37 ++++++++++- 6 files changed, 138 insertions(+), 7 deletions(-) create mode 100644 webapp/static/clients/codemirror/data.json create mode 100644 webapp/static/clients/codemirror/list.js diff --git a/webapp/lsp/lsp-text.xqm b/webapp/lsp/lsp-text.xqm index 2e96949..1a5bb20 100644 --- a/webapp/lsp/lsp-text.xqm +++ b/webapp/lsp/lsp-text.xqm @@ -15,7 +15,7 @@ declare variable $lsp-text:methods:=map{ "textDocument/hover": lsp-text:hover#1, "textDocument/completion": lsp-text:completion#1, "textDocument/formatting" : lsp-text:format#1, - "textDocument/documentSymbol" : lsp-text:symbols#1 + "textDocument/documentSymbol" : lsp-text:symbols#1 }; (:~ hover :) @@ -35,7 +35,8 @@ declare function lsp-text:symbols($json as map(*)) as map(*)? { - let $doc:=$json?params?textDocument?uri + let $uri:=$json?params?textDocument?uri + let $text:=docs:get(ws:id(), $uri, "textDocument")?text return map{ "jsonrpc": "2.0", "id": $json?id, diff --git a/webapp/static/clients/codemirror/data.json b/webapp/static/clients/codemirror/data.json new file mode 100644 index 0000000..3722f88 --- /dev/null +++ b/webapp/static/clients/codemirror/data.json @@ -0,0 +1,26 @@ +[ + { + "name": "symbol 1", + "description": "This is the first item" + }, + { + "name": "symbol 2", + "description": "This is the second item" + }, + { + "name": "symbol 3", + "description": "This is the third item" + }, + { + "name": "symbol 4", + "description": "This is the third item" + }, + { + "name": "symbol 5", + "description": "This is the third item" + }, + { + "name": "symbol 6", + "description": "This is the third item" + } +] \ No newline at end of file diff --git a/webapp/static/clients/codemirror/grail.css b/webapp/static/clients/codemirror/grail.css index 3786aeb..3a3467e 100644 --- a/webapp/static/clients/codemirror/grail.css +++ b/webapp/static/clients/codemirror/grail.css @@ -59,7 +59,6 @@ body { .page-sidebar { grid-column: 1 / 2; grid-row: 2 / 4; - background: #e1bee7; } .page-nav { grid-column: 2 / 3; diff --git a/webapp/static/clients/codemirror/grail.html b/webapp/static/clients/codemirror/grail.html index faac481..ae19aeb 100644 --- a/webapp/static/clients/codemirror/grail.html +++ b/webapp/static/clients/codemirror/grail.html @@ -88,13 +88,16 @@ +
-
+