From 30f913906dcca26ee12504cce858d6cb57d1e890 Mon Sep 17 00:00:00 2001 From: Andy Bunce Date: Thu, 30 Oct 2025 10:42:59 +0000 Subject: [PATCH] [mod] tidy --- webapp/lsp/jsonrpc.xqm | 3 +- webapp/lsp/position.xqm | 11 ++++ webapp/static/clients/codemirror/grail.html | 57 ++++++++++++--------- webapp/static/clients/codemirror/script.js | 3 +- 4 files changed, 46 insertions(+), 28 deletions(-) diff --git a/webapp/lsp/jsonrpc.xqm b/webapp/lsp/jsonrpc.xqm index b69e822..f673186 100644 --- a/webapp/lsp/jsonrpc.xqm +++ b/webapp/lsp/jsonrpc.xqm @@ -70,7 +70,8 @@ declare function rpc:send($msg as map(*)) as empty-sequence() { - rpc:admin-log($msg,"⬅️"),ws:send($msg ,ws:id()) + rpc:admin-log($msg,"⬅️"), + ws:send($msg ,ws:id()) }; (:~ canned initialize response :) diff --git a/webapp/lsp/position.xqm b/webapp/lsp/position.xqm index 303f8fe..b278f0c 100644 --- a/webapp/lsp/position.xqm +++ b/webapp/lsp/position.xqm @@ -84,3 +84,14 @@ declare function pos:full-range($text as xs:string) as lspt:Range{ lspt:Range(pos:toPosition($text,0), pos:toPosition($text, string-length($text))) }; + +(:~ range for $text from indices:) +declare function pos:range-from-ast( + $text as xs:string, +$ast as element(*)) +as lspt:Range{ + lspt:Range( + pos:toPosition($text,number($ast/@start)), + pos:toPosition($text, number($ast/@end)) + ) +}; diff --git a/webapp/static/clients/codemirror/grail.html b/webapp/static/clients/codemirror/grail.html index 9b74b73..d815632 100644 --- a/webapp/static/clients/codemirror/grail.html +++ b/webapp/static/clients/codemirror/grail.html @@ -1,5 +1,5 @@ - + @@ -8,8 +8,14 @@ - - + + + + + + @@ -27,7 +33,7 @@ - + Editor @@ -37,8 +43,8 @@ Dba - - +