From c4d2770bae5b78dcf64635771f3184e4bd940f9f Mon Sep 17 00:00:00 2001 From: Andy Bunce Date: Mon, 27 Oct 2025 23:02:21 +0000 Subject: [PATCH] [mod] symbol opts --- test/ast.xq | 10 ++++++++++ webapp/lsp/ast/ast.xqm | 9 +++++---- webapp/static/clients/codemirror/grail.html | 13 +++++++++---- 3 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 test/ast.xq diff --git a/test/ast.xq b/test/ast.xq new file mode 100644 index 0000000..575520b --- /dev/null +++ b/test/ast.xq @@ -0,0 +1,10 @@ +import module namespace syms="lsp/symbols" at "../webapp/lsp/ast/ast.xqm"; + +declare $file:="C:\Users\mrwhe\git\quodatum\basex-lsp\test\sample.docs\pdfbox.xqm"; + +declare variable $A:=doc("C:\Users\mrwhe\git\quodatum\basex-lsp\test\sample.docs\parse-pdfbox.xml"); +$A update{ + for $e in .//element() + let $len:=string-length($e) + return insert node attribute len { $len } into $e +} diff --git a/webapp/lsp/ast/ast.xqm b/webapp/lsp/ast/ast.xqm index 51ac864..b731136 100644 --- a/webapp/lsp/ast/ast.xqm +++ b/webapp/lsp/ast/ast.xqm @@ -34,10 +34,11 @@ declare function ast:flatten($input as element()) as element() { (:-------------------------------------------:) declare function ast:report($el as element(*)) { - - {count($el//element())} - {ast:max-node-depth($el)} - +{ + "total-elements": count($el//element()), + "max-depth": ast:max-node-depth($el), + "char-count": string-length($el) +} }; declare function ast:max-depth($nodes as node()*) as xs:integer { diff --git a/webapp/static/clients/codemirror/grail.html b/webapp/static/clients/codemirror/grail.html index d24d46e..9b74b73 100644 --- a/webapp/static/clients/codemirror/grail.html +++ b/webapp/static/clients/codemirror/grail.html @@ -165,11 +165,16 @@ - Show canvas - Show grid - Show source + Follow cursor + - Preferences… + + sort by: position + sort by: name + sort by: category + + +