67 lines
No EOL
1.9 KiB
Text
67 lines
No EOL
1.9 KiB
Text
(:~ handle text messages
|
|
: @author andy bunce
|
|
:)
|
|
module namespace lsp-text = 'lsp-text';
|
|
import module namespace p="xq4" at "xq4.xqm";
|
|
|
|
declare variable $lsp-text:methods:=map{
|
|
"textDocument/didOpen": lsp-text:didOpen#1,
|
|
"textDocument/didClose" : lsp-text:method-unknown#1,
|
|
"textDocument/didChange": lsp-text:method-unknown#1,
|
|
"textDocument/hover": lsp-text:hover#1,
|
|
"textDocument/completion": lsp-text:completion#1
|
|
};
|
|
(:~ hover
|
|
|
|
:)
|
|
declare
|
|
function lsp-text:hover($json as map(*))
|
|
as map(*)?
|
|
{
|
|
let $doc:=$json?params?textDocument?uri
|
|
return map{
|
|
"jsonrpc": "2.0",
|
|
"id": $json?id,
|
|
"result":{
|
|
"contents": [{
|
|
"language": "PlainText",
|
|
"value": "VPCONFLICTQ : [NONE,AVX512_CD] Detect Conflicts Within a Vector of Packed Dword/Qword Values into Dense Memory/ Register\n"
|
|
},
|
|
{
|
|
"language": "Markdown",
|
|
"value": "```text\n µOps µOps µOps \nArchitecture Instruction Fused Unfused Port Latency Throughput \nSkylakeX VPCONFLICTQ x,x 3 3 p01 p5 4 2 \nSkylakeX VPCONFLICTQ y,y 15 15 p01 p5 13 7 \nSkylakeX VPCONFLICTQ z,z 22 22 p0 p5 17 12 \n```"
|
|
}]
|
|
}
|
|
}
|
|
};
|
|
|
|
declare
|
|
function lsp-text:completion($json as map(*))
|
|
as map(*)?
|
|
{
|
|
let $doc:=$json?params?textDocument?uri
|
|
return map{
|
|
"jsonrpc": "2.0",
|
|
"id": $json?id,
|
|
"result":()
|
|
}
|
|
};
|
|
|
|
(:~ didOpen method response :)
|
|
declare
|
|
function lsp-text:didOpen($json as map(*))
|
|
as map(*)?
|
|
{
|
|
let $textDoc:=$json?params?textDocument
|
|
let $text:=$textDoc?text=>trace("TXT")
|
|
return ()
|
|
};
|
|
|
|
(:~ unknown method response :)
|
|
declare
|
|
function lsp-text:method-unknown($json as map(*))
|
|
as map(*)?
|
|
{
|
|
let $_:=trace($json?method,"unknown")
|
|
return ()
|
|
}; |