diff --git a/webapp/lsp/etc/capabilities.json b/webapp/lsp/etc/capabilities.json index 055451b..497e119 100644 --- a/webapp/lsp/etc/capabilities.json +++ b/webapp/lsp/etc/capabilities.json @@ -6,7 +6,7 @@ "triggerCharacters": [ "\"", ":" ], "documentSelector": [{ "language": "xquery" }] }, - "hoverProvider": false, + "hoverProvider": true, "documentSymbolProvider": false, "documentRangeFormattingProvider": false, "colorProvider": {}, diff --git a/webapp/lsp/lsp-diags.xqm b/webapp/lsp/lsp-diags.xqm index 4b91dee..5507639 100644 --- a/webapp/lsp/lsp-diags.xqm +++ b/webapp/lsp/lsp-diags.xqm @@ -21,9 +21,9 @@ declare record lsp-diags:nostic( declare variable $lsp-diags:severities:={ 'error':1, - 'hint':2, + 'hint':4, 'info':3, - 'warning':4 + 'warning':2 }; declare function lsp-diags:publish( @@ -33,7 +33,7 @@ declare function lsp-diags:publish( as map(*){ let $diagnostics:=if($xml/self::ERROR) then array{lsp-diags:parse-error($text, $xml)} - else [] + else array{lsp-diags:parse-xquery($text,$xml)} return {"jsonrpc": "2.0", "method":"textDocument/publishDiagnostics", @@ -47,13 +47,29 @@ as map(*){ declare function lsp-diags:parse-error($text as xs:string, $xml as element(ERROR)) as map(*)*{ -lsp-diags:nostic(pos:Range(pos:toPosition($text=>trace("EXML "), $xml/@b), +lsp-diags:nostic(pos:Range(pos:toPosition($text, $xml/@b), pos:toPosition($text, $xml/@e)), - 1, + $lsp-diags:severities('error'), $xml/string()), lsp-diags:nostic(pos:Range(pos:toPosition($text, $xml/@e +1 ), pos:toPosition($text, string-length($text)-1)), - 2, + $lsp-diags:severities('warning'), "Previous parse error") -}; \ No newline at end of file +}; + +(: test data :) +declare function lsp-diags:parse-xquery($text as xs:string, $xml as element(Module)) +as map(*)*{ + lsp-diags:nostic(pos:Range(pos:Position(0,0), pos:Position(0, 5)), + $lsp-diags:severities('error'),"111"), + +lsp-diags:nostic(pos:Range(pos:Position(1,0), pos:Position(1,5)), + $lsp-diags:severities('warning'),"2222"), + +lsp-diags:nostic(pos:Range(pos:Position(2,0), pos:Position(2, 5)), + $lsp-diags:severities('info'),"333"), + +lsp-diags:nostic(pos:Range(pos:Position(3,0), pos:Position(3, 12)), + $lsp-diags:severities('hint'), "44") +}; diff --git a/webapp/static/clients/ace/script.js b/webapp/static/clients/ace/script.js index efd045d..54eae22 100644 --- a/webapp/static/clients/ace/script.js +++ b/webapp/static/clients/ace/script.js @@ -9,7 +9,7 @@ var editor = ace.edit("editor", { useWorker: false // Disable web worker for this simple demo }); -//ace.require('ace/ext/settings_menu'); +ace.require('ace/ext/settings_menu'); editor.setTheme("ace/theme/github"); //editor.session.setMode("ace/mode/html"); editor.commands.addCommands([ diff --git a/webapp/static/clients/codemirror/index.html b/webapp/static/clients/codemirror/index.html index aa140ce..07def1f 100644 --- a/webapp/static/clients/codemirror/index.html +++ b/webapp/static/clients/codemirror/index.html @@ -61,6 +61,9 @@ +