[add] no version check
This commit is contained in:
parent
c4f92f0402
commit
1a6be470ee
7 changed files with 75 additions and 45 deletions
|
|
@ -50,9 +50,9 @@ function app:home() as item()* {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
declare %rest:path('/app/profile')
|
declare %rest:path('/app/sockets')
|
||||||
function app:profile() {
|
function app:profile() {
|
||||||
cm:htmx2("profile.htm", map{})
|
cm:htmx2("sockets.htm", map{})
|
||||||
};
|
};
|
||||||
|
|
||||||
declare %rest:path('/app/dev')
|
declare %rest:path('/app/dev')
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ file:resolve-path( $path,file:base-dir())=>file:read-text()
|
||||||
(:~ write a message to standard BaseX log passthru item :)
|
(:~ write a message to standard BaseX log passthru item :)
|
||||||
declare function cm:trace($items as item()*,$msg as xs:string)
|
declare function cm:trace($items as item()*,$msg as xs:string)
|
||||||
as item()*{
|
as item()*{
|
||||||
$items,admin:write-log($msg || ": " || serialize($items,map{"method":"basex"}),"MDUI")
|
$items,admin:write-log($msg || ": " || serialize($items,map{"method":"basex"}),"LSP-MAN")
|
||||||
};
|
};
|
||||||
|
|
||||||
declare function cm:status-404()
|
declare function cm:status-404()
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
"selfRequestsOnly": false
|
"selfRequestsOnly": false
|
||||||
}'
|
}'
|
||||||
/>
|
/>
|
||||||
<title>MDUI</title>
|
<title>LSP manager</title>
|
||||||
<link rel="icon" href="/app/static/favicon.png" />
|
<link rel="icon" href="/app/static/favicon.png" />
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css"/>
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css"/>
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
<nav class="navbar navbar-expand-lg ">
|
<nav class="navbar navbar-expand-lg ">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
|
||||||
<a class="navbar-brand" href="/app">MDUI</a>
|
<a class="navbar-brand" href="/app">LSP manager</a>
|
||||||
<sl-icon id="indicator" class="htmx-indicator" src="/app/static/loader.svg" ></sl-icon>
|
<sl-icon id="indicator" class="htmx-indicator" src="/app/static/loader.svg" ></sl-icon>
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
|
||||||
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
|
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="/app/pdfs">pdf</a>
|
<a class="nav-link" href="/app/sockets">connections </a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
layout:decorate="~{layout.htm}">
|
layout:decorate="~{layout.htm}">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<title>Profile</title>
|
<title>Open sockets</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
@ -128,4 +128,16 @@ declare function docs:parse(
|
||||||
"params":{"uri": $file, "diagnostics": array{$diags}}
|
"params":{"uri": $file, "diagnostics": array{$diags}}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
declare function docs:lineEnd($txt as xs:string)
|
||||||
|
as xs:string{
|
||||||
|
let $nl:= char('\r') || char('\n')
|
||||||
|
return switch(){
|
||||||
|
case contains($txt,$nl) return $nl
|
||||||
|
case contains($txt,char('\r')) return char('\r')
|
||||||
|
case contains($txt,char('\n')) return char('\n')
|
||||||
|
default return char('\n')
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -94,7 +94,7 @@ declare variable $lspt:SymbolKindMap :={
|
||||||
'TypeParameter': 25
|
'TypeParameter': 25
|
||||||
};
|
};
|
||||||
|
|
||||||
declare variable $lspt:DiagnosticSeverityKinds:={
|
declare variable $lspt:SeverityKind:={
|
||||||
'error':1,
|
'error':1,
|
||||||
'warning':2,
|
'warning':2,
|
||||||
'info':3,
|
'info':3,
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,15 @@ renderMessage?: fn(view: EditorView) → Node An optional custom rendering fu
|
||||||
actions?: readonly Action[] An optional array of actions that can be taken on this diagnostic.
|
actions?: readonly Action[] An optional array of actions that can be taken on this diagnostic.
|
||||||
:)
|
:)
|
||||||
import module namespace lspt = 'lsp-typedefs' at "../lsp-typedefs.xqm";
|
import module namespace lspt = 'lsp-typedefs' at "../lsp-typedefs.xqm";
|
||||||
|
import module namespace hnd="lsp/handlers" at "../handlers.xqm";
|
||||||
import module namespace pos="lsp/position" at "../position.xqm";
|
import module namespace pos="lsp/position" at "../position.xqm";
|
||||||
|
|
||||||
declare type lsp-diags:ParseResult as element(Module|ERROR);
|
declare type lsp-diags:ParseResult as element(Module|ERROR);
|
||||||
|
|
||||||
|
declare variable $lsp-diags:actions as hnd:actionMap :={
|
||||||
|
"Module": lsp-diags:Module#2
|
||||||
|
};
|
||||||
|
|
||||||
declare function lsp-diags:list(
|
declare function lsp-diags:list(
|
||||||
$uri as xs:string,
|
$uri as xs:string,
|
||||||
$text as xs:string,
|
$text as xs:string,
|
||||||
|
|
@ -29,46 +34,59 @@ as map(*)*{
|
||||||
'XQLT0001', 'previous parse error'
|
'XQLT0001', 'previous parse error'
|
||||||
:)
|
:)
|
||||||
declare function lsp-diags:parse-error($text as xs:string, $xml as element(ERROR))
|
declare function lsp-diags:parse-error($text as xs:string, $xml as element(ERROR))
|
||||||
as map(*)*{
|
as lspt:Diagnostic*
|
||||||
|
{
|
||||||
|
if(string-length($text) eq 0)
|
||||||
|
then ()
|
||||||
|
else let $last:= string-length($text)-1
|
||||||
|
let $dmesg:=$xml/string()=>trace("parse-error")
|
||||||
|
let $dmesg:=translate($dmesg," ",";")
|
||||||
|
let $b:=number($xml/@b)-1
|
||||||
|
let $e:= number($xml/@e)-1
|
||||||
|
return (
|
||||||
|
(: mark error :)
|
||||||
|
lspt:Diagnostic(lspt:Range(pos:toPosition($text, $b),
|
||||||
|
pos:toPosition($text, $e)
|
||||||
|
),
|
||||||
|
1,
|
||||||
|
$dmesg,'XPST0003'),
|
||||||
|
|
||||||
if(string-length($text) gt 0)
|
(:mark after error:)
|
||||||
then let $last:= string-length($text)-1
|
if($e ge string-length($text))
|
||||||
let $dmesg:=$xml/string()=>trace("parse-error")
|
then ()
|
||||||
let $dmesg:=translate($dmesg," ",";")
|
else lspt:Diagnostic(lspt:Range(pos:toPosition($text, $e +1 ),
|
||||||
let $b:=number($xml/@b)-1
|
pos:toPosition($text, $last)
|
||||||
let $e:= number($xml/@e)-1
|
),
|
||||||
return (
|
2,
|
||||||
(: mark error :)
|
"Unparsed due to previous parser error.",
|
||||||
lspt:Diagnostic(lspt:Range(pos:toPosition($text, $b),
|
"XQLT0001")
|
||||||
pos:toPosition($text, $e)),
|
)
|
||||||
1,
|
|
||||||
$dmesg,'XPST0003'),
|
|
||||||
|
|
||||||
(:mark after error:)
|
|
||||||
if($e ge string-length($text))
|
|
||||||
then ()
|
|
||||||
else lspt:Diagnostic(lspt:Range(pos:toPosition($text, $e +1 ),
|
|
||||||
pos:toPosition($text, $last)),
|
|
||||||
2,
|
|
||||||
"Unparsed due to previous parser error.",
|
|
||||||
"XQLT0001")
|
|
||||||
)
|
|
||||||
else ()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
(: test data :)
|
(: test data :)
|
||||||
declare function lsp-diags:parse-xquery($text as xs:string, $xml as element(Module))
|
declare function lsp-diags:parse-xquery($text as xs:string, $parse as element(Module))
|
||||||
as map(*)*{
|
as map(*)*{
|
||||||
(: lsp-diags:nostic(pos:Range(pos:Position(0,0), pos:Position(0, 5)),
|
let $state:= hnd:Result(())
|
||||||
$lsp-diags:severities('error'),"error"),
|
let $result:= hnd:walk($parse,$lsp-diags:actions,$state)
|
||||||
|
return $result?result
|
||||||
lsp-diags:nostic(pos:Range(pos:Position(1,0), pos:Position(1,5)),
|
|
||||||
$lsp-diags:severities('warning'),"warning"),
|
|
||||||
|
|
||||||
lsp-diags:nostic(pos:Range(pos:Position(2,0), pos:Position(2, 5)),
|
|
||||||
$lsp-diags:severities('info'),"info"),
|
|
||||||
|
|
||||||
lsp-diags:nostic(pos:Range(pos:Position(3,0), pos:Position(3, 6)),
|
|
||||||
$lsp-diags:severities('hint'), "hint") :)
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
declare function lsp-diags:Module($parse as element(Module),$state as hnd:Result )
|
||||||
|
as hnd:Result{
|
||||||
|
let $new:=if(exists($parse/VersionDecl)=>trace("has ver: "))
|
||||||
|
then ()
|
||||||
|
else let $text:="dddjjjjjjjjjjjjjjjj"
|
||||||
|
let $e:=1
|
||||||
|
let $last:=8
|
||||||
|
return lspt:Diagnostic(lspt:Range(
|
||||||
|
pos:toPosition($text, 1 ),
|
||||||
|
pos:toPosition($text, 1)
|
||||||
|
),
|
||||||
|
$lspt:SeverityKind?info,
|
||||||
|
"No XQuery version declaration present",
|
||||||
|
"XQLT???")
|
||||||
|
return (
|
||||||
|
hnd:Result(($state?result,$new=>trace(" VER ")),true())
|
||||||
|
,message(name($parse),"Module: ")
|
||||||
|
)
|
||||||
|
};
|
||||||
Loading…
Add table
Reference in a new issue