[add] no version check

This commit is contained in:
Andy Bunce 2025-10-17 22:33:42 +01:00
parent c4f92f0402
commit 1a6be470ee
7 changed files with 75 additions and 45 deletions

View file

@ -50,9 +50,9 @@ function app:home() as item()* {
declare %rest:path('/app/profile')
declare %rest:path('/app/sockets')
function app:profile() {
cm:htmx2("profile.htm", map{})
cm:htmx2("sockets.htm", map{})
};
declare %rest:path('/app/dev')

View file

@ -68,7 +68,7 @@ file:resolve-path( $path,file:base-dir())=>file:read-text()
(:~ write a message to standard BaseX log passthru item :)
declare function cm:trace($items as item()*,$msg as xs:string)
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()

View file

@ -17,7 +17,7 @@
"selfRequestsOnly": false
}'
/>
<title>MDUI</title>
<title>LSP manager</title>
<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"/>
@ -45,7 +45,7 @@
<nav class="navbar navbar-expand-lg ">
<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>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false"
@ -59,7 +59,7 @@
</li>
<li class="nav-item">
<a class="nav-link" href="/app/pdfs">pdf</a>
<a class="nav-link" href="/app/sockets">connections </a>
</li>
<li class="nav-item">

View file

@ -3,7 +3,7 @@
layout:decorate="~{layout.htm}">
<head>
<title>Profile</title>
<title>Open sockets</title>
</head>
<body>

View file

@ -129,3 +129,15 @@ declare function docs:parse(
}
)
};
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')
}
};

View file

@ -94,7 +94,7 @@ declare variable $lspt:SymbolKindMap :={
'TypeParameter': 25
};
declare variable $lspt:DiagnosticSeverityKinds:={
declare variable $lspt:SeverityKind:={
'error':1,
'warning':2,
'info':3,

View file

@ -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.
:)
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";
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(
$uri as xs:string,
$text as xs:string,
@ -29,10 +34,11 @@ as map(*)*{
'XQLT0001', 'previous parse error'
:)
declare function lsp-diags:parse-error($text as xs:string, $xml as element(ERROR))
as map(*)*{
if(string-length($text) gt 0)
then let $last:= string-length($text)-1
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,"&#10;",";")
let $b:=number($xml/@b)-1
@ -40,7 +46,8 @@ as map(*)*{
return (
(: mark error :)
lspt:Diagnostic(lspt:Range(pos:toPosition($text, $b),
pos:toPosition($text, $e)),
pos:toPosition($text, $e)
),
1,
$dmesg,'XPST0003'),
@ -48,27 +55,38 @@ as map(*)*{
if($e ge string-length($text))
then ()
else lspt:Diagnostic(lspt:Range(pos:toPosition($text, $e +1 ),
pos:toPosition($text, $last)),
pos:toPosition($text, $last)
),
2,
"Unparsed due to previous parser error.",
"XQLT0001")
)
else ()
};
(: 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(*)*{
(: lsp-diags:nostic(pos:Range(pos:Position(0,0), pos:Position(0, 5)),
$lsp-diags:severities('error'),"error"),
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") :)
let $state:= hnd:Result(())
let $result:= hnd:walk($parse,$lsp-diags:actions,$state)
return $result?result
};
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: ")
)
};