diff --git a/bundles/grammar/test-java.xq b/bundles/grammar/test-java.xq index f98d3d6..5e3cad4 100644 --- a/bundles/grammar/test-java.xq +++ b/bundles/grammar/test-java.xq @@ -1,4 +1,5 @@ +declare base-uri "../.."; import module namespace xq4="java:quodatum.parser.xq4"; -"C:\Users\mrwhe\git\quodatum\basex-lsp\test\sample.docs\pdfbox.xqm" -=>unparsed-text() +(: "test/sample.docs/pdfbox.xqm"=>unparsed-text() :) +"2+4" =>xq4:parseModule() \ No newline at end of file diff --git a/compose.yaml b/compose.yaml index 62dc2a2..05bd149 100644 --- a/compose.yaml +++ b/compose.yaml @@ -10,6 +10,7 @@ services: volumes: - ./data:/srv/basex/data # - ./webapp/web.xml:/srv/basex/webapp/WEB-INF/web.xml # set websocket options 12.1+ + - ./bundles/grammar/xq4.jar:/srv/basex/lib/custom/xq4.jar - ./webapp/lsp:/srv/basex/webapp/lsp - ./webapp/static/clients:/srv/basex/webapp/static/clients diff --git a/webapp/lsp/docs.xqm b/webapp/lsp/docs.xqm index d60c076..4234080 100644 --- a/webapp/lsp/docs.xqm +++ b/webapp/lsp/docs.xqm @@ -4,7 +4,8 @@ @author Andy Bunce :) module namespace docs="lsp/docs"; -import module namespace p="xq4" at "xq4.xqm"; +(: import module namespace p="xq4" at "xq4.xqm"; :) +import module namespace xq4="java:quodatum.parser.xq4"; import module namespace pos="lsp/position" at "position.xqm"; import module namespace rpc = 'rpc' at 'jsonrpc.xqm'; import module namespace lsp-diags = 'lsp-diags' at 'lsp-diags.xqm'; @@ -118,7 +119,7 @@ declare function docs:parse( )as map(*)? { let $text:=docs:get($socket,$file,"textDocument")?text - let $xml:= p:parse-Module($text)=>prof:time("⏱️ p:parse-Module " || $file) + let $xml:= xq4:parseModule($text)=>prof:time("⏱️ p:parse-Module " || $file) return ( ws:set($socket,docs:key($socket,$file,"parse"),$xml), lsp-diags:publish($file, $text, $xml) diff --git a/webapp/lsp/lsp-diags.xqm b/webapp/lsp/lsp-diags.xqm index 6dad336..4b91dee 100644 --- a/webapp/lsp/lsp-diags.xqm +++ b/webapp/lsp/lsp-diags.xqm @@ -19,6 +19,13 @@ declare record lsp-diags:nostic( message as xs:string ); +declare variable $lsp-diags:severities:={ + 'error':1, + 'hint':2, + 'info':3, + 'warning':4 +}; + declare function lsp-diags:publish( $uri as xs:string, $text as xs:string, @@ -42,9 +49,11 @@ as map(*)*{ lsp-diags:nostic(pos:Range(pos:toPosition($text=>trace("EXML "), $xml/@b), pos:toPosition($text, $xml/@e)), - 1,$xml/string())=>trace("EEEE "), + 1, + $xml/string()), -lsp-diags:nostic(pos:Range(pos:toPosition($text=>trace("EXML "), $xml/@e +1 ), +lsp-diags:nostic(pos:Range(pos:toPosition($text, $xml/@e +1 ), pos:toPosition($text, string-length($text)-1)), - 1,"Previous parse error") + 2, + "Previous parse error") }; \ No newline at end of file