Compare commits

...

4 commits

Author SHA1 Message Date
24082ad97b [add] fn completion 2025-10-11 15:50:06 +01:00
9894581d19 [mod] better completion info 2025-10-10 15:39:51 +01:00
a2fa9cb062 [mod] completions 2025-10-10 12:17:46 +01:00
732a1c98e3 [mod] symbols vs dummy 2025-10-10 11:28:31 +01:00
19 changed files with 318 additions and 201 deletions

View file

@ -308,6 +308,8 @@ public class xq4
{
try
{
Atts atts = new Atts();
atts.add(Token.token("b"), Token.token(pe.getBegin() + 1));
builder.openElem(Token.token(name), atts, nsp);
}
catch (IOException e)

View file

@ -1 +1 @@
{"cells":[{"kind":2,"language":"xquery","value":"(:<:)\r\n\r\nimport module namespace docs=\"lsp/docs\" at \"/srv/basex/webapp/lsp/docs.xqm\";\r\ndeclare variable $LAST:=foot(ws:ids());"},{"kind":2,"language":"xquery","value":"2+2"},{"kind":2,"language":"xquery","value":"ws:ids()"},{"kind":2,"language":"xquery","value":"let $sock:=foot(ws:ids())\r\nlet $f:=docs:list($sock)\r\nlet $t:=docs:get($sock,$f,\"textDocument\")\r\nreturn $t?text=>substring(1,100)"},{"kind":2,"language":"xquery","value":"let $sock:=foot(ws:ids())\r\nlet $f:=docs:list($sock)\r\nlet $t:=docs:get($sock,$f,\"parse\")\r\nreturn $t?text"},{"kind":2,"language":"xquery","value":"let $sock:=foot(ws:ids())\r\nlet $f:=docs:list($sock)\r\nlet $t:=docs:get($sock,$f,\"textDocument\")\r\nreturn $t"},{"kind":2,"language":"xquery","value":"(: client capabilities :)\r\nws:get($LAST,\"client\")"}]}
{"cells":[{"kind":2,"language":"xquery","value":"(:<:)\r\n\r\nimport module namespace docs=\"lsp/docs\" at \"/srv/basex/webapp/lsp/docs.xqm\";\r\ndeclare variable $LAST:=foot(ws:ids());"},{"kind":2,"language":"xquery","value":"2+2"},{"kind":2,"language":"xquery","value":"ws:ids()"},{"kind":2,"language":"xquery","value":"let $sock:=foot(ws:ids())\r\nlet $f:=docs:list($sock)\r\nlet $t:=docs:get($sock,$f,\"textDocument\")\r\nreturn $t?text=>substring(1,100)"},{"kind":2,"language":"xquery","value":"let $sock:=foot(ws:ids())\r\nlet $f:=docs:list($sock)\r\nlet $t:=docs:get($sock,$f,\"parse\")\r\nreturn $t?text"},{"kind":2,"language":"xquery","value":"let $sock:=foot(ws:ids())\r\nlet $f:=docs:list($sock)\r\nlet $t:=docs:get($sock,$f,\"textDocument\")\r\nreturn $t"},{"kind":2,"language":"xquery","value":"(: client capabilities :)\r\nws:get($LAST,\"client\")=>serialize({ \"method\": \"json\",\"indent\": true()})"}]}

View file

@ -1 +1 @@
{"cells":[{"kind":1,"language":"markdown","value":"XPath name charactors"},{"kind":2,"language":"xquery","value":"let $s:=`[A-Z]\r\n | '_'\r\n | [a-z]\r\n | [#xC0-#xD6]\r\n | [#xD8-#xF6]\r\n | [#xF8-#x2FF]\r\n | [#x370-#x37D]\r\n | [#x37F-#x1FFF]\r\n | [#x200C-#x200D]\r\n | [#x2070-#x218F]\r\n | [#x2C00-#x2FEF]\r\n | [#x3001-#xD7FF]\r\n | [#xF900-#xFDCF]\r\n | [#xFDF0-#xFFFD]\r\n `\r\nlet $sreg:= normalize-space($s)\r\n =>tokenize(\"\\|\")\r\n =!>normalize-space()\r\n =!>replace(\"(#x[0-9A-F]+)\",fn($s,$m){\r\n convert:integer-from-base(substring($m,3),16)\r\n =>codepoints-to-string()\r\n })\r\n =!>translate(\"'\",\"\")\r\n =>string-join(\"|\")\r\nreturn $sreg"}]}
{"cells":[{"kind":1,"language":"markdown","value":"XPath name charactors"},{"kind":2,"language":"xquery","value":"let $s:=`[A-Z]\r\n | '_'\r\n | [a-z]\r\n | [#xC0-#xD6]\r\n | [#xD8-#xF6]\r\n | [#xF8-#x2FF]\r\n | [#x370-#x37D]\r\n | [#x37F-#x1FFF]\r\n | [#x200C-#x200D]\r\n | [#x2070-#x218F]\r\n | [#x2C00-#x2FEF]\r\n | [#x3001-#xD7FF]\r\n | [#xF900-#xFDCF]\r\n | [#xFDF0-#xFFFD]\r\n `\r\nlet $sreg:= normalize-space($s)\r\n =>tokenize(\"\\|\")\r\n =!>normalize-space()\r\n =!>replace(\"(#x[0-9A-F]+)\",fn($s,$m){\r\n convert:integer-from-base(substring($m,3),16)\r\n =>codepoints-to-string()\r\n })\r\n =!>translate(\"'\",\"\")\r\n =>string-join(\"|\")\r\nreturn $sreg"},{"kind":1,"language":"markdown","value":"# Functions"},{"kind":2,"language":"xquery","value":"declare namespace fos=\"http://www.w3.org/xpath-functions/spec/namespace\";\r\ndoc(\"C:/Users/mrwhe/git/quodatum/basex-lsp/bundles/grammar/function-catalog.xml\")\r\n//fos:function[@prefix=\"fn\"]/@name"}]}

256
package-lock.json generated
View file

@ -30,9 +30,9 @@
}
},
"node_modules/@codemirror/autocomplete": {
"version": "6.18.7",
"resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.18.7.tgz",
"integrity": "sha512-8EzdeIoWPJDsMBwz3zdzwXnUpCzMiCyz5/A3FIPpriaclFCGDkAzK13sMcnsu5rowqiyeQN2Vs2TsOcoDPZirQ==",
"version": "6.19.0",
"resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.19.0.tgz",
"integrity": "sha512-61Hfv3cF07XvUxNeC3E7jhG8XNi1Yom1G0lRC936oLnlF+jrbrv8rc/J98XlYzcsAoTVupfsf5fLej1aI8kyIg==",
"license": "MIT",
"dependencies": {
"@codemirror/language": "^6.0.0",
@ -42,9 +42,9 @@
}
},
"node_modules/@codemirror/commands": {
"version": "6.8.1",
"resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.8.1.tgz",
"integrity": "sha512-KlGVYufHMQzxbdQONiLyGQDUW0itrLZwq3CcY7xpv9ZLRHqzkBSoteocBHtMCoY7/Ci4xhzSrToIeLg7FxHuaw==",
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.9.0.tgz",
"integrity": "sha512-454TVgjhO6cMufsyyGN70rGIfJxJEjcqjBG2x2Y03Y/+Fm99d3O/Kv1QDYWuG6hvxsgmjXmBuATikIIYvERX+w==",
"license": "MIT",
"dependencies": {
"@codemirror/language": "^6.0.0",
@ -104,9 +104,9 @@
}
},
"node_modules/@codemirror/lang-html": {
"version": "6.4.10",
"resolved": "https://registry.npmjs.org/@codemirror/lang-html/-/lang-html-6.4.10.tgz",
"integrity": "sha512-h/SceTVsN5r+WE+TVP2g3KDvNoSzbSrtZXCKo4vkKdbfT5t4otuVgngGdFukOO/rwRD2++pCxoh6xD4TEVMkQA==",
"version": "6.4.11",
"resolved": "https://registry.npmjs.org/@codemirror/lang-html/-/lang-html-6.4.11.tgz",
"integrity": "sha512-9NsXp7Nwp891pQchI7gPdTwBuSuT3K65NGTHWHNJ55HjYcHLllr0rbIZNdOzas9ztc1EUVBlHou85FFZS4BNnw==",
"license": "MIT",
"dependencies": {
"@codemirror/autocomplete": "^6.0.0",
@ -117,7 +117,7 @@
"@codemirror/view": "^6.17.0",
"@lezer/common": "^1.0.0",
"@lezer/css": "^1.1.0",
"@lezer/html": "^1.3.0"
"@lezer/html": "^1.3.12"
}
},
"node_modules/@codemirror/lang-java": {
@ -185,9 +185,9 @@
}
},
"node_modules/@codemirror/lang-markdown": {
"version": "6.3.4",
"resolved": "https://registry.npmjs.org/@codemirror/lang-markdown/-/lang-markdown-6.3.4.tgz",
"integrity": "sha512-fBm0BO03azXnTAsxhONDYHi/qWSI+uSEIpzKM7h/bkIc9fHnFp9y7KTMXKON0teNT97pFhc1a9DQTtWBYEZ7ug==",
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/@codemirror/lang-markdown/-/lang-markdown-6.4.0.tgz",
"integrity": "sha512-ZeArR54seh4laFbUTVy0ZmQgO+C/cxxlW4jEoQMhL3HALScBpZBeZcLzrQmJsTEx4is9GzOe0bFAke2B1KZqeA==",
"license": "MIT",
"dependencies": {
"@codemirror/autocomplete": "^6.7.1",
@ -362,18 +362,18 @@
}
},
"node_modules/@codemirror/legacy-modes": {
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/@codemirror/legacy-modes/-/legacy-modes-6.5.1.tgz",
"integrity": "sha512-DJYQQ00N1/KdESpZV7jg9hafof/iBNp9h7TYo1SLMk86TWl9uDsVdho2dzd81K+v4retmK6mdC7WpuOQDytQqw==",
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/@codemirror/legacy-modes/-/legacy-modes-6.5.2.tgz",
"integrity": "sha512-/jJbwSTazlQEDOQw2FJ8LEEKVS72pU0lx6oM54kGpL8t/NJ2Jda3CZ4pcltiKTdqYSRk3ug1B3pil1gsjA6+8Q==",
"license": "MIT",
"dependencies": {
"@codemirror/language": "^6.0.0"
}
},
"node_modules/@codemirror/lint": {
"version": "6.8.5",
"resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.8.5.tgz",
"integrity": "sha512-s3n3KisH7dx3vsoeGMxsbRAgKe4O1vbrnKBClm99PU0fWxmxsx5rR2PfqQgIt+2MMJBHbiJ5rfIdLYfB9NNvsA==",
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.9.0.tgz",
"integrity": "sha512-wZxW+9XDytH3SKvS8cQzMyQCaaazH8XL1EMHleHe00wVzsv7NBQKVW2yzEHrRhmM7ZOhVdItPbvlRBvMp9ej7A==",
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.0.0",
@ -430,9 +430,9 @@
}
},
"node_modules/@codemirror/view": {
"version": "6.38.3",
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.38.3.tgz",
"integrity": "sha512-x2t87+oqwB1mduiQZ6huIghjMt4uZKFEdj66IcXw7+a5iBEvv9lh7EWDRHI7crnD4BMGpnyq/RzmCGbiEZLcvQ==",
"version": "6.38.5",
"resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.38.5.tgz",
"integrity": "sha512-SFVsNAgsAoou+BjRewMqN+m9jaztB9wCWN9RSRgePqUbq8UVlvJfku5zB2KVhLPgH/h0RLk38tvd4tGeAhygnw==",
"license": "MIT",
"dependencies": {
"@codemirror/state": "^6.5.0",
@ -540,9 +540,9 @@
}
},
"node_modules/@lezer/html": {
"version": "1.3.10",
"resolved": "https://registry.npmjs.org/@lezer/html/-/html-1.3.10.tgz",
"integrity": "sha512-dqpT8nISx/p9Do3AchvYGV3qYc4/rKr3IBZxlHmpIKam56P47RSHkSF5f13Vu9hebS1jM0HmtJIwLbWz1VIY6w==",
"version": "1.3.12",
"resolved": "https://registry.npmjs.org/@lezer/html/-/html-1.3.12.tgz",
"integrity": "sha512-RJ7eRWdaJe3bsiiLLHjCFT1JMk8m1YP9kaUbvu2rMLEoOnke9mcTVDyfOslsln0LtujdWespjJ39w6zo+RsQYw==",
"license": "MIT",
"dependencies": {
"@lezer/common": "^1.2.0",
@ -603,9 +603,9 @@
}
},
"node_modules/@lezer/php": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@lezer/php/-/php-1.0.4.tgz",
"integrity": "sha512-D2dJ0t8Z28/G1guztRczMFvPDUqzeMLSQbdWQmaiHV7urc8NlEOnjYk9UrZ531OcLiRxD4Ihcbv7AsDpNKDRaQ==",
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@lezer/php/-/php-1.0.5.tgz",
"integrity": "sha512-W7asp9DhM6q0W6DYNwIkLSKOvxlXRrif+UXBMxzsJUuqmhE7oVU+gS3THO4S/Puh7Xzgm858UNaFi6dxTP8dJA==",
"license": "MIT",
"dependencies": {
"@lezer/common": "^1.2.0",
@ -773,9 +773,9 @@
}
},
"node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.52.0.tgz",
"integrity": "sha512-VxDYCDqOaR7NXzAtvRx7G1u54d2kEHopb28YH/pKzY6y0qmogP3gG7CSiWsq9WvDFxOQMpNEyjVAHZFXfH3o/A==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.52.4.tgz",
"integrity": "sha512-BTm2qKNnWIQ5auf4deoetINJm2JzvihvGb9R6K/ETwKLql/Bb3Eg2H1FBp1gUb4YGbydMA3jcmQTR73q7J+GAA==",
"cpu": [
"arm"
],
@ -787,9 +787,9 @@
]
},
"node_modules/@rollup/rollup-android-arm64": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.52.0.tgz",
"integrity": "sha512-pqDirm8koABIKvzL59YI9W9DWbRlTX7RWhN+auR8HXJxo89m4mjqbah7nJZjeKNTNYopqL+yGg+0mhCpf3xZtQ==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.52.4.tgz",
"integrity": "sha512-P9LDQiC5vpgGFgz7GSM6dKPCiqR3XYN1WwJKA4/BUVDjHpYsf3iBEmVz62uyq20NGYbiGPR5cNHI7T1HqxNs2w==",
"cpu": [
"arm64"
],
@ -801,9 +801,9 @@
]
},
"node_modules/@rollup/rollup-darwin-arm64": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.52.0.tgz",
"integrity": "sha512-YCdWlY/8ltN6H78HnMsRHYlPiKvqKagBP1r+D7SSylxX+HnsgXGCmLiV3Y4nSyY9hW8qr8U9LDUx/Lo7M6MfmQ==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.52.4.tgz",
"integrity": "sha512-QRWSW+bVccAvZF6cbNZBJwAehmvG9NwfWHwMy4GbWi/BQIA/laTIktebT2ipVjNncqE6GLPxOok5hsECgAxGZg==",
"cpu": [
"arm64"
],
@ -815,9 +815,9 @@
]
},
"node_modules/@rollup/rollup-darwin-x64": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.52.0.tgz",
"integrity": "sha512-z4nw6y1j+OOSGzuVbSWdIp1IUks9qNw4dc7z7lWuWDKojY38VMWBlEN7F9jk5UXOkUcp97vA1N213DF+Lz8BRg==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.52.4.tgz",
"integrity": "sha512-hZgP05pResAkRJxL1b+7yxCnXPGsXU0fG9Yfd6dUaoGk+FhdPKCJ5L1Sumyxn8kvw8Qi5PvQ8ulenUbRjzeCTw==",
"cpu": [
"x64"
],
@ -829,9 +829,9 @@
]
},
"node_modules/@rollup/rollup-freebsd-arm64": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.52.0.tgz",
"integrity": "sha512-Q/dv9Yvyr5rKlK8WQJZVrp5g2SOYeZUs9u/t2f9cQ2E0gJjYB/BWoedXfUT0EcDJefi2zzVfhcOj8drWCzTviw==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.52.4.tgz",
"integrity": "sha512-xmc30VshuBNUd58Xk4TKAEcRZHaXlV+tCxIXELiE9sQuK3kG8ZFgSPi57UBJt8/ogfhAF5Oz4ZSUBN77weM+mQ==",
"cpu": [
"arm64"
],
@ -843,9 +843,9 @@
]
},
"node_modules/@rollup/rollup-freebsd-x64": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.52.0.tgz",
"integrity": "sha512-kdBsLs4Uile/fbjZVvCRcKB4q64R+1mUq0Yd7oU1CMm1Av336ajIFqNFovByipciuUQjBCPMxwJhCgfG2re3rg==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.52.4.tgz",
"integrity": "sha512-WdSLpZFjOEqNZGmHflxyifolwAiZmDQzuOzIq9L27ButpCVpD7KzTRtEG1I0wMPFyiyUdOO+4t8GvrnBLQSwpw==",
"cpu": [
"x64"
],
@ -857,9 +857,9 @@
]
},
"node_modules/@rollup/rollup-linux-arm-gnueabihf": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.52.0.tgz",
"integrity": "sha512-aL6hRwu0k7MTUESgkg7QHY6CoqPgr6gdQXRJI1/VbFlUMwsSzPGSR7sG5d+MCbYnJmJwThc2ol3nixj1fvI/zQ==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.52.4.tgz",
"integrity": "sha512-xRiOu9Of1FZ4SxVbB0iEDXc4ddIcjCv2aj03dmW8UrZIW7aIQ9jVJdLBIhxBI+MaTnGAKyvMwPwQnoOEvP7FgQ==",
"cpu": [
"arm"
],
@ -871,9 +871,9 @@
]
},
"node_modules/@rollup/rollup-linux-arm-musleabihf": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.52.0.tgz",
"integrity": "sha512-BTs0M5s1EJejgIBJhCeiFo7GZZ2IXWkFGcyZhxX4+8usnIo5Mti57108vjXFIQmmJaRyDwmV59Tw64Ap1dkwMw==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.52.4.tgz",
"integrity": "sha512-FbhM2p9TJAmEIEhIgzR4soUcsW49e9veAQCziwbR+XWB2zqJ12b4i/+hel9yLiD8pLncDH4fKIPIbt5238341Q==",
"cpu": [
"arm"
],
@ -885,9 +885,9 @@
]
},
"node_modules/@rollup/rollup-linux-arm64-gnu": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.52.0.tgz",
"integrity": "sha512-uj672IVOU9m08DBGvoPKPi/J8jlVgjh12C9GmjjBxCTQc3XtVmRkRKyeHSmIKQpvJ7fIm1EJieBUcnGSzDVFyw==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.52.4.tgz",
"integrity": "sha512-4n4gVwhPHR9q/g8lKCyz0yuaD0MvDf7dV4f9tHt0C73Mp8h38UCtSCSE6R9iBlTbXlmA8CjpsZoujhszefqueg==",
"cpu": [
"arm64"
],
@ -899,9 +899,9 @@
]
},
"node_modules/@rollup/rollup-linux-arm64-musl": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.52.0.tgz",
"integrity": "sha512-/+IVbeDMDCtB/HP/wiWsSzduD10SEGzIZX2945KSgZRNi4TSkjHqRJtNTVtVb8IRwhJ65ssI56krlLik+zFWkw==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.52.4.tgz",
"integrity": "sha512-u0n17nGA0nvi/11gcZKsjkLj1QIpAuPFQbR48Subo7SmZJnGxDpspyw2kbpuoQnyK+9pwf3pAoEXerJs/8Mi9g==",
"cpu": [
"arm64"
],
@ -913,9 +913,9 @@
]
},
"node_modules/@rollup/rollup-linux-loong64-gnu": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.52.0.tgz",
"integrity": "sha512-U1vVzvSWtSMWKKrGoROPBXMh3Vwn93TA9V35PldokHGqiUbF6erSzox/5qrSMKp6SzakvyjcPiVF8yB1xKr9Pg==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.52.4.tgz",
"integrity": "sha512-0G2c2lpYtbTuXo8KEJkDkClE/+/2AFPdPAbmaHoE870foRFs4pBrDehilMcrSScrN/fB/1HTaWO4bqw+ewBzMQ==",
"cpu": [
"loong64"
],
@ -927,9 +927,9 @@
]
},
"node_modules/@rollup/rollup-linux-ppc64-gnu": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.52.0.tgz",
"integrity": "sha512-X/4WfuBAdQRH8cK3DYl8zC00XEE6aM472W+QCycpQJeLWVnHfkv7RyBFVaTqNUMsTgIX8ihMjCvFF9OUgeABzw==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.52.4.tgz",
"integrity": "sha512-teSACug1GyZHmPDv14VNbvZFX779UqWTsd7KtTM9JIZRDI5NUwYSIS30kzI8m06gOPB//jtpqlhmraQ68b5X2g==",
"cpu": [
"ppc64"
],
@ -941,9 +941,9 @@
]
},
"node_modules/@rollup/rollup-linux-riscv64-gnu": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.52.0.tgz",
"integrity": "sha512-xIRYc58HfWDBZoLmWfWXg2Sq8VCa2iJ32B7mqfWnkx5mekekl0tMe7FHpY8I72RXEcUkaWawRvl3qA55og+cwQ==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.52.4.tgz",
"integrity": "sha512-/MOEW3aHjjs1p4Pw1Xk4+3egRevx8Ji9N6HUIA1Ifh8Q+cg9dremvFCUbOX2Zebz80BwJIgCBUemjqhU5XI5Eg==",
"cpu": [
"riscv64"
],
@ -955,9 +955,9 @@
]
},
"node_modules/@rollup/rollup-linux-riscv64-musl": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.52.0.tgz",
"integrity": "sha512-mbsoUey05WJIOz8U1WzNdf+6UMYGwE3fZZnQqsM22FZ3wh1N887HT6jAOjXs6CNEK3Ntu2OBsyQDXfIjouI4dw==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.52.4.tgz",
"integrity": "sha512-1HHmsRyh845QDpEWzOFtMCph5Ts+9+yllCrREuBR/vg2RogAQGGBRC8lDPrPOMnrdOJ+mt1WLMOC2Kao/UwcvA==",
"cpu": [
"riscv64"
],
@ -969,9 +969,9 @@
]
},
"node_modules/@rollup/rollup-linux-s390x-gnu": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.52.0.tgz",
"integrity": "sha512-qP6aP970bucEi5KKKR4AuPFd8aTx9EF6BvutvYxmZuWLJHmnq4LvBfp0U+yFDMGwJ+AIJEH5sIP+SNypauMWzg==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.52.4.tgz",
"integrity": "sha512-seoeZp4L/6D1MUyjWkOMRU6/iLmCU2EjbMTyAG4oIOs1/I82Y5lTeaxW0KBfkUdHAWN7j25bpkt0rjnOgAcQcA==",
"cpu": [
"s390x"
],
@ -983,9 +983,9 @@
]
},
"node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.52.0.tgz",
"integrity": "sha512-nmSVN+F2i1yKZ7rJNKO3G7ZzmxJgoQBQZ/6c4MuS553Grmr7WqR7LLDcYG53Z2m9409z3JLt4sCOhLdbKQ3HmA==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.52.4.tgz",
"integrity": "sha512-Wi6AXf0k0L7E2gteNsNHUs7UMwCIhsCTs6+tqQ5GPwVRWMaflqGec4Sd8n6+FNFDw9vGcReqk2KzBDhCa1DLYg==",
"cpu": [
"x64"
],
@ -997,9 +997,9 @@
]
},
"node_modules/@rollup/rollup-linux-x64-musl": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.52.0.tgz",
"integrity": "sha512-2d0qRo33G6TfQVjaMR71P+yJVGODrt5V6+T0BDYH4EMfGgdC/2HWDVjSSFw888GSzAZUwuska3+zxNUCDco6rQ==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.52.4.tgz",
"integrity": "sha512-dtBZYjDmCQ9hW+WgEkaffvRRCKm767wWhxsFW3Lw86VXz/uJRuD438/XvbZT//B96Vs8oTA8Q4A0AfHbrxP9zw==",
"cpu": [
"x64"
],
@ -1011,9 +1011,9 @@
]
},
"node_modules/@rollup/rollup-openharmony-arm64": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.52.0.tgz",
"integrity": "sha512-A1JalX4MOaFAAyGgpO7XP5khquv/7xKzLIyLmhNrbiCxWpMlnsTYr8dnsWM7sEeotNmxvSOEL7F65j0HXFcFsw==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.52.4.tgz",
"integrity": "sha512-1ox+GqgRWqaB1RnyZXL8PD6E5f7YyRUJYnCqKpNzxzP0TkaUh112NDrR9Tt+C8rJ4x5G9Mk8PQR3o7Ku2RKqKA==",
"cpu": [
"arm64"
],
@ -1025,9 +1025,9 @@
]
},
"node_modules/@rollup/rollup-win32-arm64-msvc": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.52.0.tgz",
"integrity": "sha512-YQugafP/rH0eOOHGjmNgDURrpYHrIX0yuojOI8bwCyXwxC9ZdTd3vYkmddPX0oHONLXu9Rb1dDmT0VNpjkzGGw==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.52.4.tgz",
"integrity": "sha512-8GKr640PdFNXwzIE0IrkMWUNUomILLkfeHjXBi/nUvFlpZP+FA8BKGKpacjW6OUUHaNI6sUURxR2U2g78FOHWQ==",
"cpu": [
"arm64"
],
@ -1039,9 +1039,9 @@
]
},
"node_modules/@rollup/rollup-win32-ia32-msvc": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.52.0.tgz",
"integrity": "sha512-zYdUYhi3Qe2fndujBqL5FjAFzvNeLxtIqfzNEVKD1I7C37/chv1VxhscWSQHTNfjPCrBFQMnynwA3kpZpZ8w4A==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.52.4.tgz",
"integrity": "sha512-AIy/jdJ7WtJ/F6EcfOb2GjR9UweO0n43jNObQMb6oGxkYTfLcnN7vYYpG+CN3lLxrQkzWnMOoNSHTW54pgbVxw==",
"cpu": [
"ia32"
],
@ -1053,9 +1053,9 @@
]
},
"node_modules/@rollup/rollup-win32-x64-gnu": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.52.0.tgz",
"integrity": "sha512-fGk03kQylNaCOQ96HDMeT7E2n91EqvCDd3RwvT5k+xNdFCeMGnj5b5hEgTGrQuyidqSsD3zJDQ21QIaxXqTBJw==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.52.4.tgz",
"integrity": "sha512-UF9KfsH9yEam0UjTwAgdK0anlQ7c8/pWPU2yVjyWcF1I1thABt6WXE47cI71pGiZ8wGvxohBoLnxM04L/wj8mQ==",
"cpu": [
"x64"
],
@ -1067,9 +1067,9 @@
]
},
"node_modules/@rollup/rollup-win32-x64-msvc": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.52.0.tgz",
"integrity": "sha512-6iKDCVSIUQ8jPMoIV0OytRKniaYyy5EbY/RRydmLW8ZR3cEBhxbWl5ro0rkUNe0ef6sScvhbY79HrjRm8i3vDQ==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.52.4.tgz",
"integrity": "sha512-bf9PtUa0u8IXDVxzRToFQKsNCRz9qLYfR/MpECxl4mRoWYjAeFjgxj1XdZr2M/GNVpT05p+LgQOHopYDlUu6/w==",
"cpu": [
"x64"
],
@ -1101,9 +1101,9 @@
"license": "BSD-3-Clause"
},
"node_modules/ace-linters": {
"version": "1.8.3",
"resolved": "https://registry.npmjs.org/ace-linters/-/ace-linters-1.8.3.tgz",
"integrity": "sha512-bLz4j8Qe8OFyym4Eb1CqMFPgR4if3M1RdNReXhBR9tNHEFYRUwAV3kMdHDT740DwljhPjFdwT2b9ighou+rBuA==",
"version": "1.8.4",
"resolved": "https://registry.npmjs.org/ace-linters/-/ace-linters-1.8.4.tgz",
"integrity": "sha512-hcJvFeXxStKx1OW4BGPmf8HcQup3+TUhe84UNLkxem2SicrxbbkRwKYV0VHmjOcCWj0gymPnsCl3X8h/09ALlw==",
"license": "MIT",
"dependencies": {
"vscode-languageserver-protocol": "^3.17.5",
@ -1138,9 +1138,9 @@
}
},
"node_modules/beercss": {
"version": "3.12.8",
"resolved": "https://registry.npmjs.org/beercss/-/beercss-3.12.8.tgz",
"integrity": "sha512-8vCPPTZo9IN1cFOF7PcI1Es4gxbmQNTdplNhvLOIBaHMb406RRqJjpH76WOGl1m7jtB+3qYmRlVmEvogtGdLWg==",
"version": "3.12.11",
"resolved": "https://registry.npmjs.org/beercss/-/beercss-3.12.11.tgz",
"integrity": "sha512-9NQWL3kxSOb5RPWAV5BPVs64CS72F5Z4HgxusqD07Ho4asaTJB33/SkJBMclQeUQs7hFH2CJOgGgDnIsRk2RyQ==",
"license": "MIT",
"dependencies": {
"material-dynamic-colors": "^1.1.2"
@ -1604,9 +1604,9 @@
}
},
"node_modules/rollup": {
"version": "4.52.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.52.0.tgz",
"integrity": "sha512-+IuescNkTJQgX7AkIDtITipZdIGcWF0pnVvZTWStiazUmcGA2ag8dfg0urest2XlXUi9kuhfQ+qmdc5Stc3z7g==",
"version": "4.52.4",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.52.4.tgz",
"integrity": "sha512-CLEVl+MnPAiKh5pl4dEWSyMTpuflgNQiLGhMv8ezD5W/qP8AKvmYpCOKRRNOh7oRKnauBZ4SyeYkMS+1VSyKwQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@ -1620,28 +1620,28 @@
"npm": ">=8.0.0"
},
"optionalDependencies": {
"@rollup/rollup-android-arm-eabi": "4.52.0",
"@rollup/rollup-android-arm64": "4.52.0",
"@rollup/rollup-darwin-arm64": "4.52.0",
"@rollup/rollup-darwin-x64": "4.52.0",
"@rollup/rollup-freebsd-arm64": "4.52.0",
"@rollup/rollup-freebsd-x64": "4.52.0",
"@rollup/rollup-linux-arm-gnueabihf": "4.52.0",
"@rollup/rollup-linux-arm-musleabihf": "4.52.0",
"@rollup/rollup-linux-arm64-gnu": "4.52.0",
"@rollup/rollup-linux-arm64-musl": "4.52.0",
"@rollup/rollup-linux-loong64-gnu": "4.52.0",
"@rollup/rollup-linux-ppc64-gnu": "4.52.0",
"@rollup/rollup-linux-riscv64-gnu": "4.52.0",
"@rollup/rollup-linux-riscv64-musl": "4.52.0",
"@rollup/rollup-linux-s390x-gnu": "4.52.0",
"@rollup/rollup-linux-x64-gnu": "4.52.0",
"@rollup/rollup-linux-x64-musl": "4.52.0",
"@rollup/rollup-openharmony-arm64": "4.52.0",
"@rollup/rollup-win32-arm64-msvc": "4.52.0",
"@rollup/rollup-win32-ia32-msvc": "4.52.0",
"@rollup/rollup-win32-x64-gnu": "4.52.0",
"@rollup/rollup-win32-x64-msvc": "4.52.0",
"@rollup/rollup-android-arm-eabi": "4.52.4",
"@rollup/rollup-android-arm64": "4.52.4",
"@rollup/rollup-darwin-arm64": "4.52.4",
"@rollup/rollup-darwin-x64": "4.52.4",
"@rollup/rollup-freebsd-arm64": "4.52.4",
"@rollup/rollup-freebsd-x64": "4.52.4",
"@rollup/rollup-linux-arm-gnueabihf": "4.52.4",
"@rollup/rollup-linux-arm-musleabihf": "4.52.4",
"@rollup/rollup-linux-arm64-gnu": "4.52.4",
"@rollup/rollup-linux-arm64-musl": "4.52.4",
"@rollup/rollup-linux-loong64-gnu": "4.52.4",
"@rollup/rollup-linux-ppc64-gnu": "4.52.4",
"@rollup/rollup-linux-riscv64-gnu": "4.52.4",
"@rollup/rollup-linux-riscv64-musl": "4.52.4",
"@rollup/rollup-linux-s390x-gnu": "4.52.4",
"@rollup/rollup-linux-x64-gnu": "4.52.4",
"@rollup/rollup-linux-x64-musl": "4.52.4",
"@rollup/rollup-openharmony-arm64": "4.52.4",
"@rollup/rollup-win32-arm64-msvc": "4.52.4",
"@rollup/rollup-win32-ia32-msvc": "4.52.4",
"@rollup/rollup-win32-x64-gnu": "4.52.4",
"@rollup/rollup-win32-x64-msvc": "4.52.4",
"fsevents": "~2.3.2"
}
},
@ -1768,9 +1768,9 @@
"license": "0BSD"
},
"node_modules/typescript": {
"version": "5.9.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz",
"integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
"version": "5.9.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true,
"license": "Apache-2.0",
"peer": true,

7
test/completion.xq Normal file
View file

@ -0,0 +1,7 @@
import module namespace comp = 'lsp-completions' at "../webapp/lsp/providers/completions.xqm";
declare variable $src:="sample.docs/parse-pdfbox.xml";
declare variable $parse:=doc($src)/*;
let $context:= {"triggerCharacter":":","triggerKind":2.0e0}
return comp:dummy($context )=>array:build()

4
test/context.xq Normal file
View file

@ -0,0 +1,4 @@
import module namespace ctx="lsp/context" at "../webapp/lsp/context.xqm";
ctx:functions("fn")!ctx:map(.)=>trace("AA")

View file

@ -3,4 +3,4 @@ declare variable $src:="sample.docs/parse-pdfbox.xml";
declare variable $parse:=doc($src)/*;
syms:list($parse )
syms:list($parse,string($parse ))

47
webapp/lsp/context.xqm Normal file
View file

@ -0,0 +1,47 @@
(: context information xpath functions etc
@author Andy Bunce
:)
module namespace ctx="lsp/context";
import module namespace lspt = 'lsp-typedefs' at 'lsp-typedefs.xqm';
declare namespace fos="http://www.w3.org/xpath-functions/spec/namespace";
declare variable $ctx:catalog:=doc("etc/function-catalog.xml");
declare variable $ctx:ns:=('fn', 'op','math','map','array');
declare variable $ctx:doclink:="https://qt4cg.org/specifications/xpath-functions-40/Overview.html#func-";
declare function ctx:functions($ns as xs:string)
as element(fos:function)*{
$ctx:catalog//fos:function[@prefix=$ns]
};
declare function ctx:map($fn as element(fos:function))
{
$fn!map{
"label":string(@name),
"kind": 3,
"detail":ctx:summary(.),
"documentation":`<a href="{ $ctx:doclink }{ string(@name) }" target="_blank">spec</a>`
!lspt:MarkupContent("markdown",.)
}
};
declare function ctx:summary($fn as element(fos:function))
{
$fn/fos:summary/*
=>ctx:strip-ns()
=>serialize({ 'method': 'html' })
};
declare function ctx:strip-ns($n as node()) as node() {
if($n instance of element()) then (
element { node-name($n) } {
$n/@*,
$n/node()/ctx:strip-ns(.)
}
) else if($n instance of document-node()) then (
document { ctx:strip-ns($n/node()) }
) else (
$n
)
};

View file

@ -12,13 +12,13 @@ declare record hnd:Result(
declare type hnd:actionFn as fn($parse as element(),$state as hnd:Result ) as hnd:Result;
declare type hnd:actionMap as map(xs:string,hnd:actionFn)
;
declare type hnd:actionMap as map(xs:string,hnd:actionFn);
declare function hnd:walk($parse as element(),
$actions as hnd:actionMap,
$state as hnd:Result )
as hnd:Result{
as hnd:Result
{
let $action:=$actions(name($parse))
let $result:= if(exists($action))
then $action($parse,$state)

View file

@ -39,7 +39,8 @@ as map(*)?
declare
function rpc:reply($json as map(*))
as empty-sequence() {
let $f :=(void(trace($json,"➡️")),$rpc:Methods?($json?method))
let $f :=(message($json,"➡️"),
$rpc:Methods?($json?method))
let $response := $f!.($json)
return $response!rpc:send(.)
};

View file

@ -9,6 +9,7 @@ import module namespace lspt = 'lsp-typedefs' at 'lsp-typedefs.xqm';
import module namespace pos="lsp/position" at "position.xqm";
import module namespace syms="lsp/symbols" at "providers/documentSymbols.xqm";
import module namespace comp = 'lsp-completions' at "providers/completions.xqm";
import module namespace hov = 'lsp-hover' at "providers/hover.xqm";
declare variable $lsp-text:methods:=map{
"textDocument/didOpen": lsp-text:didOpen#1,
@ -30,14 +31,8 @@ as map(*)
{
let $pos:=$json?params?position
let $uri:= $json?params?textDocument?uri
let $word:="TODO"
let $r:= [
`At { pos:ln-col($pos) }, uri: {$uri},
[path](https://quodatum.github.io/basex-xqparse/i-BaseX.xhtml#EQName)
WordAt: {$word}`
]
return rpc:result($json,{"contents":$r})
let $r:=hov:list($uri,$pos)
return rpc:result($json,{"contents":array:build($r)})
};
(:~ symbols :)
@ -46,15 +41,9 @@ function lsp-text:symbols($json as map(*))
as map(*)?
{
let $uri:=$json?params?textDocument?uri
let $text:=docs:get(ws:id(), $uri, "textDocument")?text
let $fr:=pos:full-range($text)
(: dummy data :)
let $nameRange:=$fr
let $result:=map:for-each($lspt:SymbolKindMap,
fn($k,$v){
lspt:DocumentSymbol($k,$v,$fr,$nameRange,"todo description")
})=>array:build()
return rpc:result($json,$result)=>trace("SSS")
let $xml:=docs:get(ws:id(), $uri, "parse")
let $syms:=syms:list($xml,string($xml))
return rpc:result($json,array:build($syms))
};
declare
@ -64,7 +53,7 @@ as map(*)?
let $doc:=$json?params?textDocument?uri
let $context:=$json?params?context (:{"triggerCharacter":":","triggerKind":2.0e0}:)
let $result:=comp:list($context)
return rpc:result($json,$result)
return rpc:result($json,array:build($result))
};
declare

View file

@ -339,5 +339,18 @@ export interface CompletionItem {
:)
declare record lspt:CompletionItem(
label as xs:string,
kind? as lspt:CompletionItemKind
kind? as lspt:CompletionItemKind,
tags? as xs:string* :=(),
detail? as xs:string,
documentation? as (xs:string|lspt:MarkupContent)
);
declare type lspt:MarkupKind as enum('plaintext' , 'markdown');
(: A `MarkupContent` literal represents a string value which content is
* interpreted base on its kind flag.
:)
declare record lspt:MarkupContent(
kind as lspt:MarkupKind,
value as xs:string
);

View file

@ -1,7 +1,29 @@
module namespace comp = 'lsp-completions';
import module namespace lspt = 'lsp-typedefs' at "../lsp-typedefs.xqm";
import module namespace ctx="lsp/context" at "../context.xqm";
(: (:{"triggerCharacter":":","triggerKind":2.0e0}:):)
declare function comp:list($context as map(*)){
declare function comp:list($context as map(*))
as lspt:CompletionItem*
{
message($context,"context: "),
()
ctx:functions("fn")!ctx:map(.)=>trace("aaa")
};
declare function comp:dummy($context as map(*))
as lspt:CompletionItem*
{
message($context,"context: "),
map:for-each(
$lspt:CompletionItemKindMap,
fn($k,$v){
let $d:=lspt:MarkupContent(
'markdown',
`More about
<a href="https://quodatum.github.io/basex-xqparse/i-BaseX.xhtml#EQName" target="_blank">{$k}</a>
`
)
return lspt:CompletionItem($k,$v,detail:="detail",documentation:=$d)
})
};

View file

@ -3,8 +3,9 @@ xquery version '4.0';
module namespace syms="lsp/symbols";
import module namespace hnd="lsp/handlers" at "../handlers.xqm";
import module namespace lspt = 'lsp-typedefs' at "../lsp-typedefs.xqm";
import module namespace pos="lsp/position" at "../position.xqm";
declare function syms:list($parse as element(),$syms as lspt:DocumentSymbol* :=() )
declare function syms:list($parse as element(),$text as xs:string)
as lspt:DocumentSymbol*{
let $actions as hnd:actionMap :={
"ContextValueDecl": syms:action#2,
@ -18,6 +19,18 @@ as lspt:DocumentSymbol*{
return $result?result
};
(: for testing only:)
declare function syms:dummy($parse as element(),$text as xs:string )
as lspt:DocumentSymbol*{
let $fr:=(pos:full-range($text),message("dummy"))
(: dummy data :)
let $nameRange:=$fr
return map:for-each($lspt:SymbolKindMap,
fn($k,$v){
lspt:DocumentSymbol($k,$v,$fr,$nameRange,`{$k} v:{$v}`)
})
};
(:~ just trace :)
declare function syms:action($parse as element(),$state as hnd:Result )
as hnd:Result{
@ -26,7 +39,7 @@ as hnd:Result{
declare function syms:VarDecl($parse as element(VarDecl),$state as hnd:Result )
as hnd:Result{
let $name:=$parse/VarNameAndType/EQName
let $name:=syms:localName($parse/VarNameAndType/EQName)
let $length:=string($parse)=>string-length()
let $range:=lspt:Range(lspt:Position(0,0),lspt:Position(0,3))
let $sym:=lspt:DocumentSymbol($name,$lspt:SymbolKindMap('Variable'),$range,$range,"TODO")
@ -35,11 +48,17 @@ as hnd:Result{
declare function syms:FunctionDecl($parse as element(FunctionDecl),$state as hnd:Result )
as hnd:Result{
let $name:=$parse/UnreservedFunctionEQName
let $name:=syms:localName($parse/UnreservedFunctionEQName)
let $range:=lspt:Range(lspt:Position(0,0),lspt:Position(0,3))
let $sym:=lspt:DocumentSymbol($name,$lspt:SymbolKindMap('Method'),$range,$range,"TODO")
return ($state?result,$sym)=>hnd:Result(true())
};
declare function syms:localName($name as xs:string )
as xs:string{
if(starts-with($name,"Q{"))
then substring-after($name,"}")
else if(contains($name,":"))
then substring-after($name,":")
else $name
};

View file

@ -0,0 +1,12 @@
module namespace hov = 'lsp-hover';
import module namespace lspt = 'lsp-typedefs' at "../lsp-typedefs.xqm";
import module namespace pos="lsp/position" at "../position.xqm";
declare function hov:list($uri, $pos as map(*))
as xs:string*{
let $word:="TODO"
return `Hover { pos:ln-col($pos) }, uri: {$uri},
<a href="https://quodatum.github.io/basex-xqparse/i-BaseX.xhtml#EQName" target="_blank">Path</a>
WordAt: {$word}`
};

View file

@ -33,7 +33,7 @@
</li>
</ul>
<select id="load">
<select id="load">
<option selected value="">load..</option>
<optgroup label="XQuery3">
<option
@ -98,9 +98,7 @@
<button id="syntax" type="button" class="btn btn-light" title="Unused"><i
class="codicon codicon-comment"></i></button>
<button id="cmd" type="button" class="btn btn-light" title="Cmd list to console">
<i class="codicon codicon-debug-console"></i>
</button>
<button id="wordAt" type="button" class="btn btn-light" title="word at">
<i>1</i></button>
@ -130,7 +128,7 @@
<details id="symPanel">
<summary>OutLine <b>0</b></summary>
<json-list id="symList"></json-list>
<qd-list id="symList"></qd-list>
</details>
<details id="msgPanel">
@ -147,6 +145,9 @@
<option value="xml">xml</option>
</select>
<button popovertarget="popHelp"><i class="codicon codicon-info"></i></button>
<button id="cmd" type="button" class="btn btn-light" title="Command and key mapping help">
<i class="codicon codicon-record-keys"></i>
</button>
</footer>
</div>
<!-- Popovers -->
@ -208,7 +209,7 @@
<!-- CodeMirror 6 -->
<script src="./lsp.bundle.js"></script>
<script src="./script.js"></script>
<script src="./list.js"></script>
<script src="./wc-qd-list.js"></script>
</body>

View file

@ -83,4 +83,4 @@ class ListComponent extends HTMLElement {
}
/* Define the new custom element */
customElements.define('json-list', ListComponent);
customElements.define('qd-list', ListComponent);