diff --git a/README.md b/README.md
index ef9f437..13746ea 100644
--- a/README.md
+++ b/README.md
@@ -24,4 +24,6 @@ http://localhost:3000/exampleServer
https://github.com/mkslanc/ace-linters/blob/c1b317e01299016ac7da6588361228637f4eac25/packages/demo/websockets-lsp/server/server.ts
-https://www.jsonrpc.org/specification
\ No newline at end of file
+https://www.jsonrpc.org/specification
+
+yyy **GGG**
\ No newline at end of file
diff --git a/samples/didopen/client.json b/samples/didopen/client.json
new file mode 100644
index 0000000..6b4ebcc
--- /dev/null
+++ b/samples/didopen/client.json
@@ -0,0 +1,12 @@
+{
+ "jsonrpc": "2.0",
+ "method": "textDocument/didOpen",
+ "params": {
+ "textDocument": {
+ "uri": "file:///some/file.xml",
+ "languageId": "xml",
+ "text": "testvvvbvbvbvbvbv\nvv\n\nvcccccccccccccc\n",
+ "version": 0
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/logMessage/server.json b/samples/logMessage/server.json
new file mode 100644
index 0000000..ba3dac5
--- /dev/null
+++ b/samples/logMessage/server.json
@@ -0,0 +1,5 @@
+{
+ "jsonrpc": "2.0"
+
+
+}
\ No newline at end of file
diff --git a/webapp/lsp/lsp-text.xqm b/webapp/lsp/lsp-text.xqm
index 70ca252..c497e63 100644
--- a/webapp/lsp/lsp-text.xqm
+++ b/webapp/lsp/lsp-text.xqm
@@ -26,13 +26,13 @@ as map(*)?
"contents": [
{
"language": "markdown",
- "value": `this is **bold** markdown
- a link (here)[http://google.com]
- The last line`
+ "value": `markdown: this is **bold**
+ a [link](http://google.com)
+ The last line.`
},
{
"language": "plaintext",
- "value": "A hover for " || json:serialize($json)
+ "value": "plaintext: A hover for " || json:serialize($json?params?position)
}]
}
}
@@ -56,8 +56,13 @@ function lsp-text:didOpen($json as map(*))
as map(*)?
{
let $textDoc:=$json?params?textDocument
- let $text:=$textDoc?text=>trace("TXT")
- return ()
+
+ let $x:=job:eval(xs:anyURI("parse.xq"),
+ {"textDocument":$textDoc,"webSocket":ws:id()},
+ { 'cache': true() }
+ )
+
+ return ws:set(ws:id(),$textDoc?uri,$textDoc)
};
(:~ unknown method response :)
diff --git a/webapp/lsp/parse.xq b/webapp/lsp/parse.xq
new file mode 100644
index 0000000..ba1eaf7
--- /dev/null
+++ b/webapp/lsp/parse.xq
@@ -0,0 +1,24 @@
+(: parse a didOpen :)
+import module namespace p="xq4" at "xq4.xqm";
+
+declare variable $textDocument external;
+declare variable $webSocket as xs:string external;
+
+let $text as xs:string:=$textDocument?text
+let $uri:=$textDocument?uri
+let $files:=ws:get($webSocket,"files",{})
+let $files:=if(map:contains($files,$uri))
+ then $files
+ else map:put($files,$uri,{"textDocument":random:uuid(),"parse":random:uuid() })
+let $keys:=$files($uri)
+let $xml:=p:parse-Module($text)
+
+return (
+ ws:set($webSocket,"files",$files),
+ ws:set($webSocket,$keys?textDocument,$textDocument),
+ ws:set($webSocket,$keys?parse,$xml),
+ ws:send({"jsonrpc": "2.0","method":"window/logMessage",
+ "params":{"type":1,"message":"TODO"}},$webSocket)
+)
+
+
\ No newline at end of file
diff --git a/webapp/lsp/smoke.xq b/webapp/lsp/smoke.xq
new file mode 100644
index 0000000..d52c7f0
--- /dev/null
+++ b/webapp/lsp/smoke.xq
@@ -0,0 +1,4 @@
+job:eval(xs:anyURI("parse.xq"),
+ {"textDocument":"2+3","webSocket":ws:id()},
+ { 'cache': true() }
+ )
\ No newline at end of file
diff --git a/webapp/static/codemirror/index.html b/webapp/static/codemirror/index.html
index 5c104d1..e938dce 100644
--- a/webapp/static/codemirror/index.html
+++ b/webapp/static/codemirror/index.html
@@ -34,7 +34,7 @@
something
-