[add] diag code and source
This commit is contained in:
parent
8453101c03
commit
1483a807f4
2 changed files with 9 additions and 4 deletions
|
@ -1 +1 @@
|
|||
{"cells":[{"kind":2,"language":"xquery","value":"(:<:)\r\n\r\nimport module namespace docs=\"lsp/docs\" at \"/srv/basex/webapp/lsp/docs.xqm\";"},{"kind":2,"language":"xquery","value":"ws:ids()"},{"kind":2,"language":"xquery","value":"let $sock:=foot(ws:ids())\r\nlet $f:=docs:list($sock)\r\nlet $t:=docs:get($sock,$f,\"textDocument\")\r\nreturn $t"},{"kind":2,"language":"xquery","value":"let $sock:=foot(ws:ids())\r\nlet $f:=docs:list($sock)\r\nlet $t:=docs:get($sock,$f,\"parse\")\r\nreturn $t/self::ERROR"},{"kind":2,"language":"xquery","value":"let $sock:=foot(ws:ids())\r\nlet $f:=docs:list($sock)\r\nlet $t:=docs:get($sock,$f,\"textDocument\")?text\r\nreturn string-to-codepoints($t)=>index-of(10)"}]}
|
||||
{"cells":[{"kind":2,"language":"xquery","value":"(:<:)\r\n\r\nimport module namespace docs=\"lsp/docs\" at \"/srv/basex/webapp/lsp/docs.xqm\";"},{"kind":2,"language":"xquery","value":"ws:ids()"},{"kind":2,"language":"xquery","value":"let $sock:=foot(ws:ids())\r\nlet $f:=docs:list($sock)\r\nlet $t:=docs:get($sock,$f,\"textDocument\")\r\nreturn map:put($t,\"text\",substring($t?text,1,15))"},{"kind":2,"language":"xquery","value":"let $sock:=foot(ws:ids())\r\nlet $f:=docs:list($sock)\r\nlet $t:=docs:get($sock,$f,\"parse\")\r\nreturn $t/self::ERROR"},{"kind":2,"language":"xquery","value":"let $sock:=foot(ws:ids())\r\nlet $f:=docs:list($sock)\r\nlet $t:=docs:get($sock,$f,\"textDocument\")?text\r\nreturn $t"}]}
|
|
@ -16,7 +16,9 @@ actions?: readonly Action[] An optional array of actions that can be taken on
|
|||
declare record lsp-diags:nostic(
|
||||
range as pos:Range,
|
||||
severity as xs:integer, (: enum('error', 'hint', 'info', 'warning') :)
|
||||
message as xs:string
|
||||
message as xs:string,
|
||||
code? as xs:string,
|
||||
source as xs:string:="xquery"
|
||||
);
|
||||
|
||||
declare variable $lsp-diags:severities:={
|
||||
|
@ -43,6 +45,8 @@ as map(*){
|
|||
|
||||
(:~
|
||||
<ERROR b="10819" e="10820" o="234" s="43">syntax error, found '}' while expecting [S,'else'] at line 290, column 3: ...} }; ? return bookmark info for children of $outlineItem as s...</ERROR>
|
||||
assert.equal(markers[0].code, 'XPST0003', 'parse error');
|
||||
assert.equal(markers[1].code, 'XQLT0001', 'previous parse error');
|
||||
:)
|
||||
declare function lsp-diags:parse-error($text as xs:string, $xml as element(ERROR))
|
||||
as map(*)*{
|
||||
|
@ -52,12 +56,13 @@ return (
|
|||
lsp-diags:nostic(pos:Range(pos:toPosition($text, $xml/@b),
|
||||
pos:toPosition($text, $xml/@e)),
|
||||
$lsp-diags:severities('error'),
|
||||
$dmesg),
|
||||
$dmesg,code:="XPST0003"),
|
||||
|
||||
lsp-diags:nostic(pos:Range(pos:toPosition($text, $xml/@e +1 ),
|
||||
pos:toPosition($text, string-length($text)-1)),
|
||||
$lsp-diags:severities('warning'),
|
||||
"Unparsed due to previous parser error.")
|
||||
"Unparsed due to previous parser error.",
|
||||
code:="XQLT0001")
|
||||
)
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue