[mod] symbols install minimap
This commit is contained in:
parent
95aed988b6
commit
28b4799ee0
11 changed files with 846 additions and 167 deletions
|
|
@ -57,8 +57,8 @@ declare
|
|||
function rpc:method-initialize($json as map(*))
|
||||
as map(*)
|
||||
{
|
||||
json:doc("etc/capabilities.json",{"format":"w3"})
|
||||
=>rpc:result($json)
|
||||
rpc:result($json,
|
||||
json:doc("etc/capabilities.json",{"format":"w3"}))
|
||||
};
|
||||
|
||||
(:~ initialized response :)
|
||||
|
|
@ -90,7 +90,7 @@ as map(*)
|
|||
};
|
||||
|
||||
(:~ rpc response to $json msg :)
|
||||
declare function rpc:result($result,$json as map(*))
|
||||
declare function rpc:result($json as map(*),$result)
|
||||
as map(*)
|
||||
{
|
||||
map{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ module namespace lsp-text = 'lsp-text';
|
|||
|
||||
import module namespace docs="lsp/docs" at "docs.xqm";
|
||||
import module namespace rpc = 'rpc' at 'jsonrpc.xqm';
|
||||
import module namespace lspt = 'lsp-typedefs' at 'lsp-typedefs.xqm';
|
||||
import module namespace pos="lsp/position" at "position.xqm";
|
||||
|
||||
declare variable $lsp-text:methods:=map{
|
||||
|
|
@ -27,7 +28,7 @@ as map(*)
|
|||
`At { pos:ln-col($json?params?position) }, uri: {$json?params?textDocument?uri},
|
||||
[path](https://quodatum.github.io/basex-xqparse/i-BaseX.xhtml#EQName)`
|
||||
]
|
||||
return rpc:result({"contents":$r},$json)
|
||||
return rpc:result($json,{"contents":$r})
|
||||
};
|
||||
|
||||
(:~ symbols :)
|
||||
|
|
@ -37,11 +38,12 @@ as map(*)?
|
|||
{
|
||||
let $uri:=$json?params?textDocument?uri
|
||||
let $text:=docs:get(ws:id(), $uri, "textDocument")?text
|
||||
return map{
|
||||
"jsonrpc": "2.0",
|
||||
"id": $json?id,
|
||||
"result":()
|
||||
}
|
||||
let $fr:=pos:full-range($text)
|
||||
let $result:=map:for-each($lspt:SymbolKindMap,
|
||||
fn($k,$v){
|
||||
lspt:DocumentSymbol($k,$v,$fr,$fr,"todo")
|
||||
})=>array:build()
|
||||
return rpc:result($json,$result)=>trace("SSS")
|
||||
};
|
||||
|
||||
declare
|
||||
|
|
@ -49,11 +51,8 @@ function lsp-text:completion($json as map(*))
|
|||
as map(*)?
|
||||
{
|
||||
let $doc:=$json?params?textDocument?uri
|
||||
return map{
|
||||
"jsonrpc": "2.0",
|
||||
"id": $json?id,
|
||||
"result":()
|
||||
}
|
||||
let $result:=()
|
||||
return rpc:result($json,$result)
|
||||
};
|
||||
|
||||
declare
|
||||
|
|
@ -67,10 +66,11 @@ as map(*)?
|
|||
then rpc:error("Syntax errors found.",$json)
|
||||
else
|
||||
let $xml:=$xml update {lsp-text:tidy(.)}
|
||||
return rpc:result([{
|
||||
let $result:=[{
|
||||
"range":pos:full-range($text),
|
||||
"newText": string($xml)
|
||||
}],$json)
|
||||
}]
|
||||
return rpc:result($json,$result)
|
||||
};
|
||||
|
||||
(:~ didOpen method response :)
|
||||
|
|
|
|||
|
|
@ -64,34 +64,34 @@ therefore must not be an empty string or a string only consisting of white space
|
|||
children? as lspt:DocumentSymbol*
|
||||
);
|
||||
|
||||
|
||||
(: @see https://code.visualstudio.com/api/references/vscode-api#SymbolKind :)
|
||||
declare variable $lspt:SymbolKindMap :={
|
||||
'File': 1 ,
|
||||
'Module': 2 ,
|
||||
'Namespace': 3 ,
|
||||
'Package': 4 ,
|
||||
'Class': 5 ,
|
||||
'Method': 6 ,
|
||||
'Property': 7 ,
|
||||
'Field': 8 ,
|
||||
'Constructor': 9 ,
|
||||
'Enum': 10 ,
|
||||
'Interface': 11 ,
|
||||
'Function': 12 ,
|
||||
'Variable': 13 ,
|
||||
'Constant': 14 ,
|
||||
'String': 15 ,
|
||||
'Number': 16 ,
|
||||
'Boolean': 17 ,
|
||||
'Array': 18 ,
|
||||
'Object': 19 ,
|
||||
'Key': 20 ,
|
||||
'Null': 21 ,
|
||||
'EnumMember': 22 ,
|
||||
'Struct': 23 ,
|
||||
'Event': 24 ,
|
||||
'Operator': 25 ,
|
||||
'TypeParameter': 26
|
||||
'File': 0 ,
|
||||
'Module': 1 ,
|
||||
'Namespace': 2 ,
|
||||
'Package': 3 ,
|
||||
'Class': 4 ,
|
||||
'Method': 5 ,
|
||||
'Property': 6 ,
|
||||
'Field': 7 ,
|
||||
'Constructor': 8 ,
|
||||
'Enum': 9 ,
|
||||
'Interface': 10 ,
|
||||
'Function': 11 ,
|
||||
'Variable': 12 ,
|
||||
'Constant': 13 ,
|
||||
'String': 14 ,
|
||||
'Number': 15 ,
|
||||
'Boolean': 16 ,
|
||||
'Array': 17 ,
|
||||
'Object': 18 ,
|
||||
'Key': 19 ,
|
||||
'Null': 20 ,
|
||||
'EnumMember': 21 ,
|
||||
'Struct': 22 ,
|
||||
'Event': 23 ,
|
||||
'Operator': 24 ,
|
||||
'TypeParameter': 25
|
||||
};
|
||||
|
||||
declare variable $lspt:DiagnosticSeverityKinds:={
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue