[mod] samples
This commit is contained in:
parent
2f54b3370e
commit
6e88dd1509
22 changed files with 1048 additions and 142 deletions
2
LICENSE
2
LICENSE
|
|
@ -58,7 +58,7 @@ APPENDIX: How to apply the Apache License to your work.
|
|||
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
|
||||
Copyright 2025 quodatum
|
||||
Copyright 2025 Andy Bunce
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
|
|
|||
13
README.md
13
README.md
|
|
@ -1,10 +1,11 @@
|
|||
Work in progress.
|
||||
|
||||
An attempt to write a [Language Server Protocol](https://en.wikipedia.org/wiki/Language_Server_Protocol) server using the BaseX websocket feature.
|
||||
|
||||
* `webapp/lsp` The implementation using the BaseX WebSocket feature and the Jsonrpc API
|
||||
* `webapp/static/codemirror` A test html page using the Codemirror6 editor that connects to the BaseX LSP instance
|
||||
* `webapp/static/ace` A test html page using the Ace editor that connects to the BaseX LSP instance
|
||||
An attempt to write a [Language Server Protocol](https://en.wikipedia.org/wiki/Language_Server_Protocol) server using the [BaseX websocket](https://docs.basex.org/main/WebSockets) feature.
|
||||
## Server
|
||||
* `webapp/lsp` The LSP implementation in XQuery using WebSockets for transport and the [JSON-RPC](https://www.jsonrpc.org/specification) 2.0 API for format.
|
||||
## Sample clients
|
||||
* `webapp/static/codemirror` A test html page using the [CodeMirror6 editor](https://codemirror.net/) that connects to the BaseX LSP instance
|
||||
* `webapp/static/ace` A test html page using the [Ace editor](https://ace.c9.io/) that connects to the BaseX LSP instance
|
||||
|
||||
## Uses
|
||||
* https://github.com/mkslanc/ace-linters https://mkslanc.github.io/ace-linters/
|
||||
|
|
@ -13,7 +14,7 @@ An attempt to write a [Language Server Protocol](https://en.wikipedia.org/wiki/L
|
|||
* or `node --max-old-space-size=8192 node_modules/webpack-dev-serve
|
||||
r/bin/webpack-dev-server.js`
|
||||
## notes
|
||||
|
||||
java -cp org.eclipse.lemminx-uber.jar org.eclipse.lemminx.XMLServerSocketLauncher`
|
||||
Using https://github.com/mkslanc/ace-linters https://mkslanc.github.io/ace-linters/
|
||||
|
||||
Make a websocket server for lsp on port 3000
|
||||
|
|
|
|||
84
package-lock.json
generated
84
package-lock.json
generated
|
|
@ -8,10 +8,13 @@
|
|||
"@codemirror/commands": "^6.1.2",
|
||||
"@codemirror/lang-javascript": "^6.1.1",
|
||||
"@codemirror/lang-xml": "^6.1.0",
|
||||
"@codemirror/lint": "^6.8.5",
|
||||
"@codemirror/lsp-client": "^6.0.0",
|
||||
"@codemirror/search": "^6.2.3",
|
||||
"@codemirror/theme-one-dark": "^6.1.0",
|
||||
"@codemirror/view": "^6.6.0",
|
||||
"@codemirror/view": "^6.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||
"@rollup/plugin-typescript": "^12.1.4",
|
||||
"minify": "^9.1.0",
|
||||
|
|
@ -160,6 +163,7 @@
|
|||
"version": "0.3.12",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz",
|
||||
"integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/sourcemap-codec": "^1.5.0",
|
||||
|
|
@ -170,6 +174,7 @@
|
|||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
|
||||
"integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
|
|
@ -179,6 +184,7 @@
|
|||
"version": "0.3.10",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.10.tgz",
|
||||
"integrity": "sha512-0pPkgz9dY+bijgistcTTJ5mR+ocqRXLuhXHYdzoMmmoJ2C9S46RCm2GMUbatPEUK9Yjy26IrAy8D/M00lLkv+Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/gen-mapping": "^0.3.5",
|
||||
|
|
@ -189,12 +195,14 @@
|
|||
"version": "1.5.4",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.4.tgz",
|
||||
"integrity": "sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
"version": "0.3.29",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.29.tgz",
|
||||
"integrity": "sha512-uw6guiW/gcAGPDhLmd77/6lW8QLeiV5RUTsAX46Db6oLhGaVj4lhnPwb184s1bkc8kdVg/+h988dro8GRDpmYQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/resolve-uri": "^3.1.0",
|
||||
|
|
@ -257,6 +265,7 @@
|
|||
"version": "15.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.3.1.tgz",
|
||||
"integrity": "sha512-tgg6b91pAybXHJQMAAwW9VuWBO6Thi+q7BCNARLwSqlmsHz0XYURtGvh/AuwSADXSI4h/2uHbs7s4FzlZDGSGA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rollup/pluginutils": "^5.0.1",
|
||||
|
|
@ -281,6 +290,7 @@
|
|||
"version": "12.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-12.1.4.tgz",
|
||||
"integrity": "sha512-s5Hx+EtN60LMlDBvl5f04bEiFZmAepk27Q+mr85L/00zPDn1jtzlTV6FWn81MaIwqfWzKxmOJrBWHU6vtQyedQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rollup/pluginutils": "^5.1.0",
|
||||
|
|
@ -307,6 +317,7 @@
|
|||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.2.0.tgz",
|
||||
"integrity": "sha512-qWJ2ZTbmumwiLFomfzTyt5Kng4hwPi9rwCYN4SHb6eaRU1KNO4ccxINHr/VhH4GgPlt1XfSTLX2LBTme8ne4Zw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/estree": "^1.0.0",
|
||||
|
|
@ -332,6 +343,7 @@
|
|||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -345,6 +357,7 @@
|
|||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -358,6 +371,7 @@
|
|||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -371,6 +385,7 @@
|
|||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -384,6 +399,7 @@
|
|||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -397,6 +413,7 @@
|
|||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -410,6 +427,7 @@
|
|||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -423,6 +441,7 @@
|
|||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -436,6 +455,7 @@
|
|||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -449,6 +469,7 @@
|
|||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -462,6 +483,7 @@
|
|||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -475,6 +497,7 @@
|
|||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -488,6 +511,7 @@
|
|||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -501,6 +525,7 @@
|
|||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -514,6 +539,7 @@
|
|||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -527,6 +553,7 @@
|
|||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -540,6 +567,7 @@
|
|||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -553,6 +581,7 @@
|
|||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -566,6 +595,7 @@
|
|||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -579,6 +609,7 @@
|
|||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
|
@ -589,18 +620,21 @@
|
|||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
|
||||
"integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/resolve": {
|
||||
"version": "1.20.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz",
|
||||
"integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.15.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
|
||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
|
|
@ -613,6 +647,7 @@
|
|||
"version": "8.3.4",
|
||||
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
|
||||
"integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"acorn": "^8.11.0"
|
||||
|
|
@ -625,12 +660,14 @@
|
|||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
|
||||
"integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/camel-case": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz",
|
||||
"integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"pascal-case": "^3.1.2",
|
||||
|
|
@ -641,6 +678,7 @@
|
|||
"version": "5.3.3",
|
||||
"resolved": "https://registry.npmjs.org/clean-css/-/clean-css-5.3.3.tgz",
|
||||
"integrity": "sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"source-map": "~0.6.0"
|
||||
|
|
@ -653,6 +691,7 @@
|
|||
"version": "10.0.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz",
|
||||
"integrity": "sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
|
|
@ -668,6 +707,7 @@
|
|||
"version": "0.2.5",
|
||||
"resolved": "https://registry.npmjs.org/css-b64-images/-/css-b64-images-0.2.5.tgz",
|
||||
"integrity": "sha512-TgQBEdP07adhrDfXvI5o6bHGukKBNMzp2Ngckc/6d09zpjD2gc1Hl3Ca1CKgb8FXjHi88+Phv2Uegs2kTL4zjg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"css-b64-images": "bin/css-b64-images"
|
||||
},
|
||||
|
|
@ -679,6 +719,7 @@
|
|||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
|
||||
"integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
|
|
@ -696,6 +737,7 @@
|
|||
"version": "4.3.1",
|
||||
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
|
||||
"integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
|
|
@ -705,6 +747,7 @@
|
|||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz",
|
||||
"integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"no-case": "^3.0.4",
|
||||
|
|
@ -715,6 +758,7 @@
|
|||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
||||
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
|
|
@ -727,12 +771,14 @@
|
|||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
|
||||
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/find-up": {
|
||||
"version": "6.3.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-6.3.0.tgz",
|
||||
"integrity": "sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"locate-path": "^7.1.0",
|
||||
|
|
@ -749,6 +795,7 @@
|
|||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
|
|
@ -763,6 +810,7 @@
|
|||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
|
|
@ -772,6 +820,7 @@
|
|||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
|
|
@ -784,6 +833,7 @@
|
|||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/html-minifier-terser/-/html-minifier-terser-7.2.0.tgz",
|
||||
"integrity": "sha512-tXgn3QfqPIpGl9o+K5tpcj3/MN4SfLtsx2GWwBC3SSd0tXQGyF3gsSqad8loJgKZGM3ZxbYDd5yhiBIdWpmvLA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"camel-case": "^4.1.2",
|
||||
|
|
@ -805,6 +855,7 @@
|
|||
"version": "2.16.1",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz",
|
||||
"integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"hasown": "^2.0.2"
|
||||
|
|
@ -820,18 +871,21 @@
|
|||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz",
|
||||
"integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/jju": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz",
|
||||
"integrity": "sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/locate-path": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-7.2.0.tgz",
|
||||
"integrity": "sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"p-locate": "^6.0.0"
|
||||
|
|
@ -847,6 +901,7 @@
|
|||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz",
|
||||
"integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.3"
|
||||
|
|
@ -856,6 +911,7 @@
|
|||
"version": "0.30.17",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz",
|
||||
"integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/sourcemap-codec": "^1.5.0"
|
||||
|
|
@ -877,6 +933,7 @@
|
|||
"version": "9.2.0",
|
||||
"resolved": "https://registry.npmjs.org/minify/-/minify-9.2.0.tgz",
|
||||
"integrity": "sha512-dfVx8j27TIZy2EE/nVMAhTVmUo6tdO4gYbKXaCYPUmpqWN2QJBgQtPfofsoA658L3Ee7e5OcyFIncJRgFtZcqQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"clean-css": "^5.0.1",
|
||||
|
|
@ -901,12 +958,14 @@
|
|||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/no-case": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz",
|
||||
"integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lower-case": "^2.0.2",
|
||||
|
|
@ -917,6 +976,7 @@
|
|||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz",
|
||||
"integrity": "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"yocto-queue": "^1.0.0"
|
||||
|
|
@ -932,6 +992,7 @@
|
|||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-6.0.0.tgz",
|
||||
"integrity": "sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"p-limit": "^4.0.0"
|
||||
|
|
@ -947,6 +1008,7 @@
|
|||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz",
|
||||
"integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dot-case": "^3.0.4",
|
||||
|
|
@ -957,6 +1019,7 @@
|
|||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz",
|
||||
"integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"no-case": "^3.0.4",
|
||||
|
|
@ -967,6 +1030,7 @@
|
|||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-5.0.0.tgz",
|
||||
"integrity": "sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
|
|
@ -976,12 +1040,14 @@
|
|||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
|
||||
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/picomatch": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz",
|
||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
|
|
@ -994,6 +1060,7 @@
|
|||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/readjson/-/readjson-2.2.2.tgz",
|
||||
"integrity": "sha512-PdeC9tsmLWBiL8vMhJvocq+OezQ3HhsH2HrN7YkhfYcTjQSa/iraB15A7Qvt7Xpr0Yd2rDNt6GbFwVQDg3HcAw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"jju": "^1.4.0",
|
||||
|
|
@ -1007,6 +1074,7 @@
|
|||
"version": "0.2.7",
|
||||
"resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz",
|
||||
"integrity": "sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
|
|
@ -1016,6 +1084,7 @@
|
|||
"version": "1.22.10",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz",
|
||||
"integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"is-core-module": "^2.16.0",
|
||||
|
|
@ -1036,6 +1105,7 @@
|
|||
"version": "4.46.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.46.2.tgz",
|
||||
"integrity": "sha512-WMmLFI+Boh6xbop+OAGo9cQ3OgX9MIg7xOQjn+pTCwOkk+FNDAeAemXkJ3HzDJrVXleLOFVa1ipuc1AmEx1Dwg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/estree": "1.0.8"
|
||||
|
|
@ -1075,6 +1145,7 @@
|
|||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/rollup-plugin-tla/-/rollup-plugin-tla-0.0.2.tgz",
|
||||
"integrity": "sha512-Z0P100crQTAjmQIXEC5J6ECupL4G8M3CTwTRK0D4J+5rMakimVa58n06kE3vnLSy/xZHnuerEpXdUW6s5G4HYg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"acorn-walk": "^8.2.0",
|
||||
|
|
@ -1089,6 +1160,7 @@
|
|||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/simport/-/simport-1.2.0.tgz",
|
||||
"integrity": "sha512-85Bm7pKsqiiQ8rmYCaPDdlXZjJvuW6/k/FY8MTtLFMgU7f8S00CgTHfRtWB6KwSb6ek4p9YyG2enG1+yJbl+CA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"readjson": "^2.2.0",
|
||||
|
|
@ -1102,6 +1174,7 @@
|
|||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
|
|
@ -1111,6 +1184,7 @@
|
|||
"version": "0.5.21",
|
||||
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
|
||||
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"buffer-from": "^1.0.0",
|
||||
|
|
@ -1127,6 +1201,7 @@
|
|||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
|
||||
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
|
|
@ -1139,6 +1214,7 @@
|
|||
"version": "5.43.1",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.43.1.tgz",
|
||||
"integrity": "sha512-+6erLbBm0+LROX2sPXlUYx/ux5PyE9K/a92Wrt6oA+WDAoFTdpHE5tCYCI5PNzq2y8df4rA+QgHLJuR4jNymsg==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"@jridgewell/source-map": "^0.3.3",
|
||||
|
|
@ -1157,12 +1233,14 @@
|
|||
"version": "2.20.3",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/try-catch": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/try-catch/-/try-catch-3.0.1.tgz",
|
||||
"integrity": "sha512-91yfXw1rr/P6oLpHSyHDOHm0vloVvUoo9FVdw8YwY05QjJQG9OT0LUxe2VRAzmHG+0CUOmI3nhxDUMLxDN/NEQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
|
|
@ -1172,6 +1250,7 @@
|
|||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/try-to-catch/-/try-to-catch-3.0.1.tgz",
|
||||
"integrity": "sha512-hOY83V84Hx/1sCzDSaJA+Xz2IIQOHRvjxzt+F0OjbQGPZ6yLPLArMA0gw/484MlfUkQbCpKYMLX3VDCAjWKfzQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
|
|
@ -1181,12 +1260,14 @@
|
|||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"dev": true,
|
||||
"license": "0BSD"
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.8.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
|
||||
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
|
|
@ -1232,6 +1313,7 @@
|
|||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.1.tgz",
|
||||
"integrity": "sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12.20"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@
|
|||
"@codemirror/search": "^6.2.3",
|
||||
"@codemirror/theme-one-dark": "^6.1.0",
|
||||
"@codemirror/view": "^6.6.0",
|
||||
"@codemirror/lint": "^6.8.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"minify": "^9.1.0",
|
||||
"rollup": "4",
|
||||
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||
|
|
|
|||
14
samples/hover/client.json
Normal file
14
samples/hover/client.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 2,
|
||||
"method": "textDocument/hover",
|
||||
"params": {
|
||||
"textDocument": {
|
||||
"uri": "file:///session1.json"
|
||||
},
|
||||
"position": {
|
||||
"line": 2,
|
||||
"character": 22
|
||||
}
|
||||
}
|
||||
}
|
||||
68
samples/initialize/client.json
Normal file
68
samples/initialize/client.json
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"method": "initialize",
|
||||
"params": {
|
||||
"processId": null,
|
||||
"clientInfo": {
|
||||
"name": "@codemirror/lsp-client"
|
||||
},
|
||||
"rootUri": null,
|
||||
"capabilities": {
|
||||
"general": {
|
||||
"markdown": {
|
||||
"parser": "marked"
|
||||
}
|
||||
},
|
||||
"textDocument": {
|
||||
"completion": {
|
||||
"completionItem": {
|
||||
"snippetSupport": true,
|
||||
"documentationFormat": [
|
||||
"plaintext",
|
||||
"markdown"
|
||||
],
|
||||
"insertReplaceSupport": false
|
||||
},
|
||||
"completionList": {
|
||||
"itemDefaults": [
|
||||
"commitCharacters",
|
||||
"editRange",
|
||||
"insertTextFormat"
|
||||
]
|
||||
},
|
||||
"completionItemKind": {
|
||||
"valueSet": []
|
||||
},
|
||||
"contextSupport": true
|
||||
},
|
||||
"hover": {
|
||||
"contentFormat": [
|
||||
"markdown",
|
||||
"plaintext"
|
||||
]
|
||||
},
|
||||
"formatting": {},
|
||||
"rename": {},
|
||||
"signatureHelp": {
|
||||
"contextSupport": true,
|
||||
"signatureInformation": {
|
||||
"documentationFormat": [
|
||||
"markdown",
|
||||
"plaintext"
|
||||
],
|
||||
"parameterInformation": {
|
||||
"labelOffsetSupport": true
|
||||
},
|
||||
"activeParameterSupport": true
|
||||
}
|
||||
},
|
||||
"definition": {},
|
||||
"declaration": {},
|
||||
"implementation": {},
|
||||
"typeDefinition": {},
|
||||
"references": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
32
samples/initialize/server.json
Normal file
32
samples/initialize/server.json
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"result": {
|
||||
"capabilities": {
|
||||
"textDocumentSync": 2,
|
||||
"completionProvider": {
|
||||
"resolveProvider": false,
|
||||
"triggerCharacters": [
|
||||
"\"",
|
||||
":"
|
||||
],
|
||||
"documentSelector": [
|
||||
{
|
||||
"language": "xquery"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hoverProvider": true,
|
||||
"documentSymbolProvider": true,
|
||||
"documentRangeFormattingProvider": false,
|
||||
"colorProvider": {},
|
||||
"foldingRangeProvider": true,
|
||||
"selectionRangeProvider": true,
|
||||
"documentLinkProvider": {},
|
||||
"serverInfo": {
|
||||
"name": "My Custom Language Server",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
samples/test.xq
Normal file
2
samples/test.xq
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"hover/client.json"
|
||||
=>json:doc({"format":"w3"})
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import { EditorState } from '@codemirror/state';
|
||||
import { openSearchPanel, highlightSelectionMatches,searchKeymap } from '@codemirror/search';
|
||||
import {openLintPanel, lintGutter, lintKeymap} from "@codemirror/lint"
|
||||
import { indentWithTab, history, defaultKeymap, historyKeymap } from '@codemirror/commands';
|
||||
import { foldGutter, indentOnInput, indentUnit, bracketMatching, foldKeymap, syntaxHighlighting, defaultHighlightStyle } from '@codemirror/language';
|
||||
import { closeBrackets, autocompletion, closeBracketsKeymap, completionKeymap } from '@codemirror/autocomplete';
|
||||
|
|
@ -37,6 +38,7 @@ const baseExts = [
|
|||
highlightSpecialChars(),
|
||||
history(),
|
||||
foldGutter(),
|
||||
lintGutter(),
|
||||
drawSelection(),
|
||||
indentUnit.of(" "),
|
||||
EditorState.allowMultipleSelections.of(true),
|
||||
|
|
@ -56,6 +58,7 @@ const baseExts = [
|
|||
...foldKeymap,
|
||||
...completionKeymap,
|
||||
...searchKeymap,
|
||||
...lintKeymap
|
||||
]),
|
||||
xml(),
|
||||
syntaxHighlighting(defaultHighlightStyle, { fallback: true })
|
||||
|
|
@ -76,4 +79,4 @@ function createEditorView(state, parent) {
|
|||
return new EditorView({ state, parent });
|
||||
}
|
||||
|
||||
export { createEditorState, createEditorView, openSearchPanel, languageServerSupport, baseExts ,lsp, simpleWebSocketTransport};
|
||||
export { createEditorState, createEditorView, openSearchPanel,openLintPanel, languageServerSupport, baseExts ,lsp, simpleWebSocketTransport};
|
||||
BIN
src/server/lemminx-win32.exe
Normal file
BIN
src/server/lemminx-win32.exe
Normal file
Binary file not shown.
3
src/server/lemminx.bat
Normal file
3
src/server/lemminx.bat
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
REM default port 5008
|
||||
REM https://download.eclipse.org/lemminx/releases/0.31.0/
|
||||
java -cp org.eclipse.lemminx-uber.jar org.eclipse.lemminx.XMLServerSocketLauncher
|
||||
BIN
src/server/org.eclipse.lemminx-uber.jar
Normal file
BIN
src/server/org.eclipse.lemminx-uber.jar
Normal file
Binary file not shown.
4
src/server/test.html
Normal file
4
src/server/test.html
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<script>
|
||||
const webSocket = new WebSocket("ws://localhost:5008");
|
||||
alert("hi");
|
||||
</script>
|
||||
21
webapp/lsp/capabilities.json
Normal file
21
webapp/lsp/capabilities.json
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"capabilities": {
|
||||
"textDocumentSync": 2,
|
||||
"completionProvider": {
|
||||
"resolveProvider": false,
|
||||
"triggerCharacters": [ "\"", ":" ],
|
||||
"documentSelector": [{ "language": "xquery" }]
|
||||
},
|
||||
"hoverProvider": true,
|
||||
"documentSymbolProvider": true,
|
||||
"documentRangeFormattingProvider": false,
|
||||
"colorProvider": {},
|
||||
"foldingRangeProvider": true,
|
||||
"selectionRangeProvider": true,
|
||||
"documentLinkProvider": {},
|
||||
"serverInfo": {
|
||||
"name": "My Custom Language Server",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ import module namespace lsp-text = 'lsp-text' at "lsp-text.xqm";
|
|||
declare variable $lsprpc:methods:=map:merge((
|
||||
map{
|
||||
"initialize" : lsprpc:method-initialize#1,
|
||||
"initialized" : lsprpc:method-unknown#1,
|
||||
"initialized" : lsprpc:method-initialized#1,
|
||||
"workspace/didChangeConfiguration" :lsprpc:method-unknown#1
|
||||
},
|
||||
$lsp-text:methods
|
||||
|
|
@ -49,25 +49,18 @@ as map(*)
|
|||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": $json?id,
|
||||
"result": {
|
||||
"capabilities": {
|
||||
"textDocumentSync": 2,
|
||||
"completionProvider": {
|
||||
"resolveProvider": false(),
|
||||
"triggerCharacters": [ """", ":" ]
|
||||
},
|
||||
"hoverProvider": true(),
|
||||
"documentSymbolProvider": true(),
|
||||
"documentRangeFormattingProvider": false(),
|
||||
"colorProvider": {},
|
||||
"foldingRangeProvider": true(),
|
||||
"selectionRangeProvider": true(),
|
||||
"documentLinkProvider": {}
|
||||
}
|
||||
}
|
||||
"result": json:doc("capabilities.json",{"format":"w3"})
|
||||
}
|
||||
};
|
||||
|
||||
(:~ initialized response :)
|
||||
declare
|
||||
function lsprpc:method-initialized($json as map(*))
|
||||
as empty-sequence()
|
||||
{
|
||||
ws:set(ws:id(),"initialized", true())
|
||||
};
|
||||
|
||||
(:~ unknown method response :)
|
||||
declare
|
||||
function lsprpc:method-unknown($json as map(*))
|
||||
|
|
|
|||
|
|
@ -12,20 +12,7 @@ declare variable $lsp-text:methods:=map{
|
|||
"textDocument/completion": lsp-text:completion#1
|
||||
};
|
||||
(:~ hover
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 2,
|
||||
"method": "textDocument/hover",
|
||||
"params": {
|
||||
"textDocument": {
|
||||
"uri": "file:///session1.json"
|
||||
},
|
||||
"position": {
|
||||
"line": 2,
|
||||
"character": 22
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:)
|
||||
declare
|
||||
function lsp-text:hover($json as map(*))
|
||||
|
|
@ -35,7 +22,16 @@ as map(*)?
|
|||
return map{
|
||||
"jsonrpc": "2.0",
|
||||
"id": $json?id,
|
||||
"value":"uri: " || $doc
|
||||
"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```"
|
||||
}]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
(:~
|
||||
: Simple WebSocket chat. Utility functions.
|
||||
: @author BaseX Team, BSD License
|
||||
:)
|
||||
module namespace lsp-util = 'chat/util';
|
||||
|
||||
|
||||
import module namespace ws = 'http://basex.org/modules/ws';
|
||||
|
||||
(:~ User id (bound to sessions and WebSockets). :)
|
||||
declare variable $lsp-util:id := 'id';
|
||||
|
||||
(:~
|
||||
: Sends a users list (all, active) to all registered clients.
|
||||
:)
|
||||
declare function lsp-util:users() as empty-sequence() {
|
||||
ws:emit(map{
|
||||
'type': 'users',
|
||||
'users': array { sort(user:list()) },
|
||||
'active': array { distinct-values(
|
||||
for $id in ws:ids()
|
||||
return ws:get($id, $lsp-util:id)
|
||||
)}
|
||||
})
|
||||
};
|
||||
|
||||
(:~
|
||||
: Sends a message to all clients, or to the clients of a specific user.
|
||||
: @param $text text to be sent
|
||||
: @param $to receiver of a private message (optional)
|
||||
:)
|
||||
declare function lsp-util:message(
|
||||
$text as xs:string,
|
||||
$to as xs:string?
|
||||
) as empty-sequence() {
|
||||
let $ws-ids := ws:ids()[not($to) or ws:get(., $lsp-util:id) = $to]
|
||||
return ws:send(map{
|
||||
'type': 'message',
|
||||
'text': serialize($text),
|
||||
'from': ws:get(ws:id(), $lsp-util:id),
|
||||
'date': format-time(current-time(), '[H02]:[m02]:[s02]'),
|
||||
'private': boolean($to)
|
||||
}, $ws-ids)
|
||||
};
|
||||
|
||||
(:~
|
||||
: Closes all WebSocket connections from the specified user.
|
||||
: @param $name username
|
||||
:)
|
||||
declare function lsp-util:close(
|
||||
$name as xs:string
|
||||
) as empty-sequence() {
|
||||
for $id in ws:ids()
|
||||
where ws:get($id, $lsp-util:id) = $name
|
||||
return ws:close($id)
|
||||
};
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
module namespace lsp-ws = 'lsp-ws';
|
||||
|
||||
import module namespace lsprpc = 'lsprpc' at 'jsonrpc.xqm';
|
||||
import module namespace chat-util = 'chat/util' at 'lsp-util.xqm';
|
||||
|
||||
|
||||
declare
|
||||
%ws:error('/lsp', '{$error}')
|
||||
|
|
@ -22,9 +22,7 @@ function lsp-ws:connect() as empty-sequence() {
|
|||
let $id:=ws:id()=>trace("CONNECT: ")
|
||||
return (
|
||||
ws:set($id, "id", $id),
|
||||
store:clear(),
|
||||
store:put("id",$id),
|
||||
store:write("lsp-store")
|
||||
ws:set($id, "initialized", false())
|
||||
)
|
||||
};
|
||||
|
||||
|
|
@ -46,11 +44,10 @@ function lsp-ws:message(
|
|||
|
||||
|
||||
(:~
|
||||
: Closes a WebSocket connection. Unregisters the user and notifies all clients.
|
||||
: Closes a WebSocket connection.
|
||||
:)
|
||||
declare
|
||||
%ws:close('/lsp')
|
||||
function lsp-ws:close() as empty-sequence() {
|
||||
ws:delete(ws:id(), $chat-util:id),
|
||||
chat-util:users()
|
||||
message("SOCKET CLOSE: " || ws:id())
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,15 +12,23 @@
|
|||
|
||||
<body>
|
||||
<header>BaseX LSP client <button id="search">🔍</button>
|
||||
<label for="symbols">Symbols:</label><select id="symbols" disabled="disabled"></select>
|
||||
<button id="lint">⚠️</button>
|
||||
<div style="float:right">
|
||||
<input id="iServer" type="text" value="ws://localhost:3000/ws/lsp" /><button id="connect">connect</button>
|
||||
<span id="state">🔴</span>
|
||||
<input id="iServer" type="text" value="ws://localhost:3000/ws/lsp" style="width:25em" /><button id="connect">connect</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="container">
|
||||
<div class="item">stuff</div>
|
||||
<!-- Editor goes in here -->
|
||||
<div class="item">
|
||||
<div>
|
||||
<label for="file">File:</label><input id="iFile" type="url" value="file:///some/file.xml" />
|
||||
</div>
|
||||
<div>
|
||||
<label for="symbols">Symbols:</label><select id="symbols" disabled="disabled"></select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Editor goes in here -->
|
||||
<div id="editor" class="item"></div>
|
||||
</div>
|
||||
|
||||
|
|
@ -28,19 +36,7 @@
|
|||
<script src="./lsp.bundle.js"></script>
|
||||
<script>
|
||||
|
||||
const server = "ws://localhost:3000/ws/lsp";
|
||||
let doc = `/**
|
||||
*
|
||||
* @param {string[]} items
|
||||
* @param nada
|
||||
*/
|
||||
function foo(items, nada) {
|
||||
for (var i=0; i<items.length; i++) {
|
||||
alert(items[i] + 'juhu');
|
||||
} // Real Tab.
|
||||
//
|
||||
//
|
||||
}`;
|
||||
let doc = `<foo at=42><bar>test</bar></foo>`;
|
||||
// Load saved content from localStorage when the page loads
|
||||
window.addEventListener('load', () => {
|
||||
const savedText = localStorage.getItem('code');
|
||||
|
|
@ -59,21 +55,27 @@ function foo(items, nada) {
|
|||
localStorage.setItem('code', doc);
|
||||
});
|
||||
document.getElementById("connect").onclick = e => {
|
||||
const v = document.getElementById("iServer").value;
|
||||
alert(v)
|
||||
|
||||
connect()
|
||||
};
|
||||
document.getElementById("search").onclick = e => {
|
||||
lsp.openSearchPanel(view);
|
||||
};
|
||||
|
||||
lsp.simpleWebSocketTransport(server)
|
||||
.then(transport => {
|
||||
let link = lsp.lsp(transport, "file:///some/file.xml");
|
||||
const state = lsp.createEditorState(doc, [...lsp.baseExts, link]);
|
||||
view.setState(state);
|
||||
})
|
||||
.catch(r => alert("fail"));
|
||||
|
||||
document.getElementById("lint").onclick = e => {
|
||||
lsp.openLintPanel(view);
|
||||
};
|
||||
function connect() {
|
||||
const server = document.getElementById("iServer").value;
|
||||
const file = document.getElementById("iFile").value;
|
||||
lsp.simpleWebSocketTransport(server)
|
||||
.then(transport => {
|
||||
let link = lsp.lsp(transport, file);
|
||||
const state = lsp.createEditorState(doc, [...lsp.baseExts, link]);
|
||||
view.setState(state);
|
||||
})
|
||||
.catch(r => alert("fail"));
|
||||
};
|
||||
connect();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
|
|||
|
|
@ -14231,7 +14231,7 @@ var lsp = (function (exports) {
|
|||
if (isNaN(current) || Math.abs(value - current) > 1)
|
||||
elt.style.left = value + "px";
|
||||
}
|
||||
const baseTheme$4 = /*@__PURE__*/EditorView.baseTheme({
|
||||
const baseTheme$5 = /*@__PURE__*/EditorView.baseTheme({
|
||||
".cm-tooltip": {
|
||||
zIndex: 500,
|
||||
boxSizing: "border-box"
|
||||
|
|
@ -14298,7 +14298,7 @@ var lsp = (function (exports) {
|
|||
Facet to which an extension can add a value to show a tooltip.
|
||||
*/
|
||||
const showTooltip = /*@__PURE__*/Facet.define({
|
||||
enables: [tooltipPlugin, baseTheme$4]
|
||||
enables: [tooltipPlugin, baseTheme$5]
|
||||
});
|
||||
const showHoverTooltip = /*@__PURE__*/Facet.define({
|
||||
combine: inputs => inputs.reduce((a, i) => a.concat(i), [])
|
||||
|
|
@ -16186,7 +16186,7 @@ var lsp = (function (exports) {
|
|||
once).
|
||||
*/
|
||||
const setSearchQuery = /*@__PURE__*/StateEffect.define();
|
||||
const togglePanel = /*@__PURE__*/StateEffect.define();
|
||||
const togglePanel$1 = /*@__PURE__*/StateEffect.define();
|
||||
const searchState = /*@__PURE__*/StateField.define({
|
||||
create(state) {
|
||||
return new SearchState(defaultQuery(state).create(), null);
|
||||
|
|
@ -16195,7 +16195,7 @@ var lsp = (function (exports) {
|
|||
for (let effect of tr.effects) {
|
||||
if (effect.is(setSearchQuery))
|
||||
value = new SearchState(effect.value.create(), value.panel);
|
||||
else if (effect.is(togglePanel))
|
||||
else if (effect.is(togglePanel$1))
|
||||
value = new SearchState(value.query, effect.value ? createSearchPanel : null);
|
||||
}
|
||||
return value;
|
||||
|
|
@ -16418,7 +16418,7 @@ var lsp = (function (exports) {
|
|||
}
|
||||
else {
|
||||
view.dispatch({ effects: [
|
||||
togglePanel.of(true),
|
||||
togglePanel$1.of(true),
|
||||
state ? setSearchQuery.of(defaultQuery(view.state, state.query.spec)) : StateEffect.appendConfig.of(searchExtensions)
|
||||
] });
|
||||
}
|
||||
|
|
@ -16434,7 +16434,7 @@ var lsp = (function (exports) {
|
|||
let panel = getPanel(view, createSearchPanel);
|
||||
if (panel && panel.dom.contains(view.root.activeElement))
|
||||
view.focus();
|
||||
view.dispatch({ effects: togglePanel.of(false) });
|
||||
view.dispatch({ effects: togglePanel$1.of(false) });
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
|
|
@ -16597,7 +16597,7 @@ var lsp = (function (exports) {
|
|||
}
|
||||
return EditorView.announce.of(`${view.state.phrase("current match")}. ${text} ${view.state.phrase("on line")} ${line.number}.`);
|
||||
}
|
||||
const baseTheme$3 = /*@__PURE__*/EditorView.baseTheme({
|
||||
const baseTheme$4 = /*@__PURE__*/EditorView.baseTheme({
|
||||
".cm-panel.cm-search": {
|
||||
padding: "2px 6px 4px",
|
||||
position: "relative",
|
||||
|
|
@ -16630,8 +16630,746 @@ var lsp = (function (exports) {
|
|||
const searchExtensions = [
|
||||
searchState,
|
||||
/*@__PURE__*/Prec.low(searchHighlighter),
|
||||
baseTheme$4
|
||||
];
|
||||
|
||||
class SelectedDiagnostic {
|
||||
constructor(from, to, diagnostic) {
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.diagnostic = diagnostic;
|
||||
}
|
||||
}
|
||||
class LintState {
|
||||
constructor(diagnostics, panel, selected) {
|
||||
this.diagnostics = diagnostics;
|
||||
this.panel = panel;
|
||||
this.selected = selected;
|
||||
}
|
||||
static init(diagnostics, panel, state) {
|
||||
// Filter the list of diagnostics for which to create markers
|
||||
let diagnosticFilter = state.facet(lintConfig).markerFilter;
|
||||
if (diagnosticFilter)
|
||||
diagnostics = diagnosticFilter(diagnostics, state);
|
||||
let sorted = diagnostics.slice().sort((a, b) => a.from - b.from || a.to - b.to);
|
||||
let deco = new RangeSetBuilder(), active = [], pos = 0;
|
||||
for (let i = 0;;) {
|
||||
let next = i == sorted.length ? null : sorted[i];
|
||||
if (!next && !active.length)
|
||||
break;
|
||||
let from, to;
|
||||
if (active.length) {
|
||||
from = pos;
|
||||
to = active.reduce((p, d) => Math.min(p, d.to), next && next.from > from ? next.from : 1e8);
|
||||
}
|
||||
else {
|
||||
from = next.from;
|
||||
to = next.to;
|
||||
active.push(next);
|
||||
i++;
|
||||
}
|
||||
while (i < sorted.length) {
|
||||
let next = sorted[i];
|
||||
if (next.from == from && (next.to > next.from || next.to == from)) {
|
||||
active.push(next);
|
||||
i++;
|
||||
to = Math.min(next.to, to);
|
||||
}
|
||||
else {
|
||||
to = Math.min(next.from, to);
|
||||
break;
|
||||
}
|
||||
}
|
||||
let sev = maxSeverity(active);
|
||||
if (active.some(d => d.from == d.to || (d.from == d.to - 1 && state.doc.lineAt(d.from).to == d.from))) {
|
||||
deco.add(from, from, Decoration.widget({
|
||||
widget: new DiagnosticWidget(sev),
|
||||
diagnostics: active.slice()
|
||||
}));
|
||||
}
|
||||
else {
|
||||
let markClass = active.reduce((c, d) => d.markClass ? c + " " + d.markClass : c, "");
|
||||
deco.add(from, to, Decoration.mark({
|
||||
class: "cm-lintRange cm-lintRange-" + sev + markClass,
|
||||
diagnostics: active.slice(),
|
||||
inclusiveEnd: active.some(a => a.to > to)
|
||||
}));
|
||||
}
|
||||
pos = to;
|
||||
for (let i = 0; i < active.length; i++)
|
||||
if (active[i].to <= pos)
|
||||
active.splice(i--, 1);
|
||||
}
|
||||
let set = deco.finish();
|
||||
return new LintState(set, panel, findDiagnostic(set));
|
||||
}
|
||||
}
|
||||
function findDiagnostic(diagnostics, diagnostic = null, after = 0) {
|
||||
let found = null;
|
||||
diagnostics.between(after, 1e9, (from, to, { spec }) => {
|
||||
if (diagnostic && spec.diagnostics.indexOf(diagnostic) < 0)
|
||||
return;
|
||||
if (!found)
|
||||
found = new SelectedDiagnostic(from, to, diagnostic || spec.diagnostics[0]);
|
||||
else if (spec.diagnostics.indexOf(found.diagnostic) < 0)
|
||||
return false;
|
||||
else
|
||||
found = new SelectedDiagnostic(found.from, to, found.diagnostic);
|
||||
});
|
||||
return found;
|
||||
}
|
||||
function hideTooltip(tr, tooltip) {
|
||||
let from = tooltip.pos, to = tooltip.end || from;
|
||||
let result = tr.state.facet(lintConfig).hideOn(tr, from, to);
|
||||
if (result != null)
|
||||
return result;
|
||||
let line = tr.startState.doc.lineAt(tooltip.pos);
|
||||
return !!(tr.effects.some(e => e.is(setDiagnosticsEffect)) || tr.changes.touchesRange(line.from, Math.max(line.to, to)));
|
||||
}
|
||||
function maybeEnableLint(state, effects) {
|
||||
return state.field(lintState, false) ? effects : effects.concat(StateEffect.appendConfig.of(lintExtensions));
|
||||
}
|
||||
/**
|
||||
The state effect that updates the set of active diagnostics. Can
|
||||
be useful when writing an extension that needs to track these.
|
||||
*/
|
||||
const setDiagnosticsEffect = /*@__PURE__*/StateEffect.define();
|
||||
const togglePanel = /*@__PURE__*/StateEffect.define();
|
||||
const movePanelSelection = /*@__PURE__*/StateEffect.define();
|
||||
const lintState = /*@__PURE__*/StateField.define({
|
||||
create() {
|
||||
return new LintState(Decoration.none, null, null);
|
||||
},
|
||||
update(value, tr) {
|
||||
if (tr.docChanged && value.diagnostics.size) {
|
||||
let mapped = value.diagnostics.map(tr.changes), selected = null, panel = value.panel;
|
||||
if (value.selected) {
|
||||
let selPos = tr.changes.mapPos(value.selected.from, 1);
|
||||
selected = findDiagnostic(mapped, value.selected.diagnostic, selPos) || findDiagnostic(mapped, null, selPos);
|
||||
}
|
||||
if (!mapped.size && panel && tr.state.facet(lintConfig).autoPanel)
|
||||
panel = null;
|
||||
value = new LintState(mapped, panel, selected);
|
||||
}
|
||||
for (let effect of tr.effects) {
|
||||
if (effect.is(setDiagnosticsEffect)) {
|
||||
let panel = !tr.state.facet(lintConfig).autoPanel ? value.panel : effect.value.length ? LintPanel.open : null;
|
||||
value = LintState.init(effect.value, panel, tr.state);
|
||||
}
|
||||
else if (effect.is(togglePanel)) {
|
||||
value = new LintState(value.diagnostics, effect.value ? LintPanel.open : null, value.selected);
|
||||
}
|
||||
else if (effect.is(movePanelSelection)) {
|
||||
value = new LintState(value.diagnostics, value.panel, effect.value);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
},
|
||||
provide: f => [showPanel.from(f, val => val.panel),
|
||||
EditorView.decorations.from(f, s => s.diagnostics)]
|
||||
});
|
||||
const activeMark = /*@__PURE__*/Decoration.mark({ class: "cm-lintRange cm-lintRange-active" });
|
||||
function lintTooltip(view, pos, side) {
|
||||
let { diagnostics } = view.state.field(lintState);
|
||||
let found, start = -1, end = -1;
|
||||
diagnostics.between(pos - (side < 0 ? 1 : 0), pos + (side > 0 ? 1 : 0), (from, to, { spec }) => {
|
||||
if (pos >= from && pos <= to &&
|
||||
(from == to || ((pos > from || side > 0) && (pos < to || side < 0)))) {
|
||||
found = spec.diagnostics;
|
||||
start = from;
|
||||
end = to;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
let diagnosticFilter = view.state.facet(lintConfig).tooltipFilter;
|
||||
if (found && diagnosticFilter)
|
||||
found = diagnosticFilter(found, view.state);
|
||||
if (!found)
|
||||
return null;
|
||||
return {
|
||||
pos: start,
|
||||
end: end,
|
||||
above: view.state.doc.lineAt(start).to < end,
|
||||
create() {
|
||||
return { dom: diagnosticsTooltip(view, found) };
|
||||
}
|
||||
};
|
||||
}
|
||||
function diagnosticsTooltip(view, diagnostics) {
|
||||
return crelt("ul", { class: "cm-tooltip-lint" }, diagnostics.map(d => renderDiagnostic(view, d, false)));
|
||||
}
|
||||
/**
|
||||
Command to open and focus the lint panel.
|
||||
*/
|
||||
const openLintPanel = (view) => {
|
||||
let field = view.state.field(lintState, false);
|
||||
if (!field || !field.panel)
|
||||
view.dispatch({ effects: maybeEnableLint(view.state, [togglePanel.of(true)]) });
|
||||
let panel = getPanel(view, LintPanel.open);
|
||||
if (panel)
|
||||
panel.dom.querySelector(".cm-panel-lint ul").focus();
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
Command to close the lint panel, when open.
|
||||
*/
|
||||
const closeLintPanel = (view) => {
|
||||
let field = view.state.field(lintState, false);
|
||||
if (!field || !field.panel)
|
||||
return false;
|
||||
view.dispatch({ effects: togglePanel.of(false) });
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
Move the selection to the next diagnostic.
|
||||
*/
|
||||
const nextDiagnostic = (view) => {
|
||||
let field = view.state.field(lintState, false);
|
||||
if (!field)
|
||||
return false;
|
||||
let sel = view.state.selection.main, next = field.diagnostics.iter(sel.to + 1);
|
||||
if (!next.value) {
|
||||
next = field.diagnostics.iter(0);
|
||||
if (!next.value || next.from == sel.from && next.to == sel.to)
|
||||
return false;
|
||||
}
|
||||
view.dispatch({ selection: { anchor: next.from, head: next.to }, scrollIntoView: true });
|
||||
return true;
|
||||
};
|
||||
/**
|
||||
A set of default key bindings for the lint functionality.
|
||||
|
||||
- Ctrl-Shift-m (Cmd-Shift-m on macOS): [`openLintPanel`](https://codemirror.net/6/docs/ref/#lint.openLintPanel)
|
||||
- F8: [`nextDiagnostic`](https://codemirror.net/6/docs/ref/#lint.nextDiagnostic)
|
||||
*/
|
||||
const lintKeymap = [
|
||||
{ key: "Mod-Shift-m", run: openLintPanel, preventDefault: true },
|
||||
{ key: "F8", run: nextDiagnostic }
|
||||
];
|
||||
const lintConfig = /*@__PURE__*/Facet.define({
|
||||
combine(input) {
|
||||
return Object.assign({ sources: input.map(i => i.source).filter(x => x != null) }, combineConfig(input.map(i => i.config), {
|
||||
delay: 750,
|
||||
markerFilter: null,
|
||||
tooltipFilter: null,
|
||||
needsRefresh: null,
|
||||
hideOn: () => null,
|
||||
}, {
|
||||
needsRefresh: (a, b) => !a ? b : !b ? a : u => a(u) || b(u)
|
||||
}));
|
||||
}
|
||||
});
|
||||
function assignKeys(actions) {
|
||||
let assigned = [];
|
||||
if (actions)
|
||||
actions: for (let { name } of actions) {
|
||||
for (let i = 0; i < name.length; i++) {
|
||||
let ch = name[i];
|
||||
if (/[a-zA-Z]/.test(ch) && !assigned.some(c => c.toLowerCase() == ch.toLowerCase())) {
|
||||
assigned.push(ch);
|
||||
continue actions;
|
||||
}
|
||||
}
|
||||
assigned.push("");
|
||||
}
|
||||
return assigned;
|
||||
}
|
||||
function renderDiagnostic(view, diagnostic, inPanel) {
|
||||
var _a;
|
||||
let keys = inPanel ? assignKeys(diagnostic.actions) : [];
|
||||
return crelt("li", { class: "cm-diagnostic cm-diagnostic-" + diagnostic.severity }, crelt("span", { class: "cm-diagnosticText" }, diagnostic.renderMessage ? diagnostic.renderMessage(view) : diagnostic.message), (_a = diagnostic.actions) === null || _a === void 0 ? void 0 : _a.map((action, i) => {
|
||||
let fired = false, click = (e) => {
|
||||
e.preventDefault();
|
||||
if (fired)
|
||||
return;
|
||||
fired = true;
|
||||
let found = findDiagnostic(view.state.field(lintState).diagnostics, diagnostic);
|
||||
if (found)
|
||||
action.apply(view, found.from, found.to);
|
||||
};
|
||||
let { name } = action, keyIndex = keys[i] ? name.indexOf(keys[i]) : -1;
|
||||
let nameElt = keyIndex < 0 ? name : [name.slice(0, keyIndex),
|
||||
crelt("u", name.slice(keyIndex, keyIndex + 1)),
|
||||
name.slice(keyIndex + 1)];
|
||||
return crelt("button", {
|
||||
type: "button",
|
||||
class: "cm-diagnosticAction",
|
||||
onclick: click,
|
||||
onmousedown: click,
|
||||
"aria-label": ` Action: ${name}${keyIndex < 0 ? "" : ` (access key "${keys[i]})"`}.`
|
||||
}, nameElt);
|
||||
}), diagnostic.source && crelt("div", { class: "cm-diagnosticSource" }, diagnostic.source));
|
||||
}
|
||||
class DiagnosticWidget extends WidgetType {
|
||||
constructor(sev) {
|
||||
super();
|
||||
this.sev = sev;
|
||||
}
|
||||
eq(other) { return other.sev == this.sev; }
|
||||
toDOM() {
|
||||
return crelt("span", { class: "cm-lintPoint cm-lintPoint-" + this.sev });
|
||||
}
|
||||
}
|
||||
class PanelItem {
|
||||
constructor(view, diagnostic) {
|
||||
this.diagnostic = diagnostic;
|
||||
this.id = "item_" + Math.floor(Math.random() * 0xffffffff).toString(16);
|
||||
this.dom = renderDiagnostic(view, diagnostic, true);
|
||||
this.dom.id = this.id;
|
||||
this.dom.setAttribute("role", "option");
|
||||
}
|
||||
}
|
||||
class LintPanel {
|
||||
constructor(view) {
|
||||
this.view = view;
|
||||
this.items = [];
|
||||
let onkeydown = (event) => {
|
||||
if (event.keyCode == 27) { // Escape
|
||||
closeLintPanel(this.view);
|
||||
this.view.focus();
|
||||
}
|
||||
else if (event.keyCode == 38 || event.keyCode == 33) { // ArrowUp, PageUp
|
||||
this.moveSelection((this.selectedIndex - 1 + this.items.length) % this.items.length);
|
||||
}
|
||||
else if (event.keyCode == 40 || event.keyCode == 34) { // ArrowDown, PageDown
|
||||
this.moveSelection((this.selectedIndex + 1) % this.items.length);
|
||||
}
|
||||
else if (event.keyCode == 36) { // Home
|
||||
this.moveSelection(0);
|
||||
}
|
||||
else if (event.keyCode == 35) { // End
|
||||
this.moveSelection(this.items.length - 1);
|
||||
}
|
||||
else if (event.keyCode == 13) { // Enter
|
||||
this.view.focus();
|
||||
}
|
||||
else if (event.keyCode >= 65 && event.keyCode <= 90 && this.selectedIndex >= 0) { // A-Z
|
||||
let { diagnostic } = this.items[this.selectedIndex], keys = assignKeys(diagnostic.actions);
|
||||
for (let i = 0; i < keys.length; i++)
|
||||
if (keys[i].toUpperCase().charCodeAt(0) == event.keyCode) {
|
||||
let found = findDiagnostic(this.view.state.field(lintState).diagnostics, diagnostic);
|
||||
if (found)
|
||||
diagnostic.actions[i].apply(view, found.from, found.to);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
};
|
||||
let onclick = (event) => {
|
||||
for (let i = 0; i < this.items.length; i++) {
|
||||
if (this.items[i].dom.contains(event.target))
|
||||
this.moveSelection(i);
|
||||
}
|
||||
};
|
||||
this.list = crelt("ul", {
|
||||
tabIndex: 0,
|
||||
role: "listbox",
|
||||
"aria-label": this.view.state.phrase("Diagnostics"),
|
||||
onkeydown,
|
||||
onclick
|
||||
});
|
||||
this.dom = crelt("div", { class: "cm-panel-lint" }, this.list, crelt("button", {
|
||||
type: "button",
|
||||
name: "close",
|
||||
"aria-label": this.view.state.phrase("close"),
|
||||
onclick: () => closeLintPanel(this.view)
|
||||
}, "×"));
|
||||
this.update();
|
||||
}
|
||||
get selectedIndex() {
|
||||
let selected = this.view.state.field(lintState).selected;
|
||||
if (!selected)
|
||||
return -1;
|
||||
for (let i = 0; i < this.items.length; i++)
|
||||
if (this.items[i].diagnostic == selected.diagnostic)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
update() {
|
||||
let { diagnostics, selected } = this.view.state.field(lintState);
|
||||
let i = 0, needsSync = false, newSelectedItem = null;
|
||||
let seen = new Set();
|
||||
diagnostics.between(0, this.view.state.doc.length, (_start, _end, { spec }) => {
|
||||
for (let diagnostic of spec.diagnostics) {
|
||||
if (seen.has(diagnostic))
|
||||
continue;
|
||||
seen.add(diagnostic);
|
||||
let found = -1, item;
|
||||
for (let j = i; j < this.items.length; j++)
|
||||
if (this.items[j].diagnostic == diagnostic) {
|
||||
found = j;
|
||||
break;
|
||||
}
|
||||
if (found < 0) {
|
||||
item = new PanelItem(this.view, diagnostic);
|
||||
this.items.splice(i, 0, item);
|
||||
needsSync = true;
|
||||
}
|
||||
else {
|
||||
item = this.items[found];
|
||||
if (found > i) {
|
||||
this.items.splice(i, found - i);
|
||||
needsSync = true;
|
||||
}
|
||||
}
|
||||
if (selected && item.diagnostic == selected.diagnostic) {
|
||||
if (!item.dom.hasAttribute("aria-selected")) {
|
||||
item.dom.setAttribute("aria-selected", "true");
|
||||
newSelectedItem = item;
|
||||
}
|
||||
}
|
||||
else if (item.dom.hasAttribute("aria-selected")) {
|
||||
item.dom.removeAttribute("aria-selected");
|
||||
}
|
||||
i++;
|
||||
}
|
||||
});
|
||||
while (i < this.items.length && !(this.items.length == 1 && this.items[0].diagnostic.from < 0)) {
|
||||
needsSync = true;
|
||||
this.items.pop();
|
||||
}
|
||||
if (this.items.length == 0) {
|
||||
this.items.push(new PanelItem(this.view, {
|
||||
from: -1, to: -1,
|
||||
severity: "info",
|
||||
message: this.view.state.phrase("No diagnostics")
|
||||
}));
|
||||
needsSync = true;
|
||||
}
|
||||
if (newSelectedItem) {
|
||||
this.list.setAttribute("aria-activedescendant", newSelectedItem.id);
|
||||
this.view.requestMeasure({
|
||||
key: this,
|
||||
read: () => ({ sel: newSelectedItem.dom.getBoundingClientRect(), panel: this.list.getBoundingClientRect() }),
|
||||
write: ({ sel, panel }) => {
|
||||
let scaleY = panel.height / this.list.offsetHeight;
|
||||
if (sel.top < panel.top)
|
||||
this.list.scrollTop -= (panel.top - sel.top) / scaleY;
|
||||
else if (sel.bottom > panel.bottom)
|
||||
this.list.scrollTop += (sel.bottom - panel.bottom) / scaleY;
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (this.selectedIndex < 0) {
|
||||
this.list.removeAttribute("aria-activedescendant");
|
||||
}
|
||||
if (needsSync)
|
||||
this.sync();
|
||||
}
|
||||
sync() {
|
||||
let domPos = this.list.firstChild;
|
||||
function rm() {
|
||||
let prev = domPos;
|
||||
domPos = prev.nextSibling;
|
||||
prev.remove();
|
||||
}
|
||||
for (let item of this.items) {
|
||||
if (item.dom.parentNode == this.list) {
|
||||
while (domPos != item.dom)
|
||||
rm();
|
||||
domPos = item.dom.nextSibling;
|
||||
}
|
||||
else {
|
||||
this.list.insertBefore(item.dom, domPos);
|
||||
}
|
||||
}
|
||||
while (domPos)
|
||||
rm();
|
||||
}
|
||||
moveSelection(selectedIndex) {
|
||||
if (this.selectedIndex < 0)
|
||||
return;
|
||||
let field = this.view.state.field(lintState);
|
||||
let selection = findDiagnostic(field.diagnostics, this.items[selectedIndex].diagnostic);
|
||||
if (!selection)
|
||||
return;
|
||||
this.view.dispatch({
|
||||
selection: { anchor: selection.from, head: selection.to },
|
||||
scrollIntoView: true,
|
||||
effects: movePanelSelection.of(selection)
|
||||
});
|
||||
}
|
||||
static open(view) { return new LintPanel(view); }
|
||||
}
|
||||
function svg(content, attrs = `viewBox="0 0 40 40"`) {
|
||||
return `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${attrs}>${encodeURIComponent(content)}</svg>')`;
|
||||
}
|
||||
function underline(color) {
|
||||
return svg(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${color}" fill="none" stroke-width=".7"/>`, `width="6" height="3"`);
|
||||
}
|
||||
const baseTheme$3 = /*@__PURE__*/EditorView.baseTheme({
|
||||
".cm-diagnostic": {
|
||||
padding: "3px 6px 3px 8px",
|
||||
marginLeft: "-1px",
|
||||
display: "block",
|
||||
whiteSpace: "pre-wrap"
|
||||
},
|
||||
".cm-diagnostic-error": { borderLeft: "5px solid #d11" },
|
||||
".cm-diagnostic-warning": { borderLeft: "5px solid orange" },
|
||||
".cm-diagnostic-info": { borderLeft: "5px solid #999" },
|
||||
".cm-diagnostic-hint": { borderLeft: "5px solid #66d" },
|
||||
".cm-diagnosticAction": {
|
||||
font: "inherit",
|
||||
border: "none",
|
||||
padding: "2px 4px",
|
||||
backgroundColor: "#444",
|
||||
color: "white",
|
||||
borderRadius: "3px",
|
||||
marginLeft: "8px",
|
||||
cursor: "pointer"
|
||||
},
|
||||
".cm-diagnosticSource": {
|
||||
fontSize: "70%",
|
||||
opacity: .7
|
||||
},
|
||||
".cm-lintRange": {
|
||||
backgroundPosition: "left bottom",
|
||||
backgroundRepeat: "repeat-x",
|
||||
paddingBottom: "0.7px",
|
||||
},
|
||||
".cm-lintRange-error": { backgroundImage: /*@__PURE__*/underline("#d11") },
|
||||
".cm-lintRange-warning": { backgroundImage: /*@__PURE__*/underline("orange") },
|
||||
".cm-lintRange-info": { backgroundImage: /*@__PURE__*/underline("#999") },
|
||||
".cm-lintRange-hint": { backgroundImage: /*@__PURE__*/underline("#66d") },
|
||||
".cm-lintRange-active": { backgroundColor: "#ffdd9980" },
|
||||
".cm-tooltip-lint": {
|
||||
padding: 0,
|
||||
margin: 0
|
||||
},
|
||||
".cm-lintPoint": {
|
||||
position: "relative",
|
||||
"&:after": {
|
||||
content: '""',
|
||||
position: "absolute",
|
||||
bottom: 0,
|
||||
left: "-2px",
|
||||
borderLeft: "3px solid transparent",
|
||||
borderRight: "3px solid transparent",
|
||||
borderBottom: "4px solid #d11"
|
||||
}
|
||||
},
|
||||
".cm-lintPoint-warning": {
|
||||
"&:after": { borderBottomColor: "orange" }
|
||||
},
|
||||
".cm-lintPoint-info": {
|
||||
"&:after": { borderBottomColor: "#999" }
|
||||
},
|
||||
".cm-lintPoint-hint": {
|
||||
"&:after": { borderBottomColor: "#66d" }
|
||||
},
|
||||
".cm-panel.cm-panel-lint": {
|
||||
position: "relative",
|
||||
"& ul": {
|
||||
maxHeight: "100px",
|
||||
overflowY: "auto",
|
||||
"& [aria-selected]": {
|
||||
backgroundColor: "#ddd",
|
||||
"& u": { textDecoration: "underline" }
|
||||
},
|
||||
"&:focus [aria-selected]": {
|
||||
background_fallback: "#bdf",
|
||||
backgroundColor: "Highlight",
|
||||
color_fallback: "white",
|
||||
color: "HighlightText"
|
||||
},
|
||||
"& u": { textDecoration: "none" },
|
||||
padding: 0,
|
||||
margin: 0
|
||||
},
|
||||
"& [name=close]": {
|
||||
position: "absolute",
|
||||
top: "0",
|
||||
right: "2px",
|
||||
background: "inherit",
|
||||
border: "none",
|
||||
font: "inherit",
|
||||
padding: 0,
|
||||
margin: 0
|
||||
}
|
||||
}
|
||||
});
|
||||
function severityWeight(sev) {
|
||||
return sev == "error" ? 4 : sev == "warning" ? 3 : sev == "info" ? 2 : 1;
|
||||
}
|
||||
function maxSeverity(diagnostics) {
|
||||
let sev = "hint", weight = 1;
|
||||
for (let d of diagnostics) {
|
||||
let w = severityWeight(d.severity);
|
||||
if (w > weight) {
|
||||
weight = w;
|
||||
sev = d.severity;
|
||||
}
|
||||
}
|
||||
return sev;
|
||||
}
|
||||
class LintGutterMarker extends GutterMarker {
|
||||
constructor(diagnostics) {
|
||||
super();
|
||||
this.diagnostics = diagnostics;
|
||||
this.severity = maxSeverity(diagnostics);
|
||||
}
|
||||
toDOM(view) {
|
||||
let elt = document.createElement("div");
|
||||
elt.className = "cm-lint-marker cm-lint-marker-" + this.severity;
|
||||
let diagnostics = this.diagnostics;
|
||||
let diagnosticsFilter = view.state.facet(lintGutterConfig).tooltipFilter;
|
||||
if (diagnosticsFilter)
|
||||
diagnostics = diagnosticsFilter(diagnostics, view.state);
|
||||
if (diagnostics.length)
|
||||
elt.onmouseover = () => gutterMarkerMouseOver(view, elt, diagnostics);
|
||||
return elt;
|
||||
}
|
||||
}
|
||||
function trackHoverOn(view, marker) {
|
||||
let mousemove = (event) => {
|
||||
let rect = marker.getBoundingClientRect();
|
||||
if (event.clientX > rect.left - 10 /* Hover.Margin */ && event.clientX < rect.right + 10 /* Hover.Margin */ &&
|
||||
event.clientY > rect.top - 10 /* Hover.Margin */ && event.clientY < rect.bottom + 10 /* Hover.Margin */)
|
||||
return;
|
||||
for (let target = event.target; target; target = target.parentNode) {
|
||||
if (target.nodeType == 1 && target.classList.contains("cm-tooltip-lint"))
|
||||
return;
|
||||
}
|
||||
window.removeEventListener("mousemove", mousemove);
|
||||
if (view.state.field(lintGutterTooltip))
|
||||
view.dispatch({ effects: setLintGutterTooltip.of(null) });
|
||||
};
|
||||
window.addEventListener("mousemove", mousemove);
|
||||
}
|
||||
function gutterMarkerMouseOver(view, marker, diagnostics) {
|
||||
function hovered() {
|
||||
let line = view.elementAtHeight(marker.getBoundingClientRect().top + 5 - view.documentTop);
|
||||
const linePos = view.coordsAtPos(line.from);
|
||||
if (linePos) {
|
||||
view.dispatch({ effects: setLintGutterTooltip.of({
|
||||
pos: line.from,
|
||||
above: false,
|
||||
clip: false,
|
||||
create() {
|
||||
return {
|
||||
dom: diagnosticsTooltip(view, diagnostics),
|
||||
getCoords: () => marker.getBoundingClientRect()
|
||||
};
|
||||
}
|
||||
}) });
|
||||
}
|
||||
marker.onmouseout = marker.onmousemove = null;
|
||||
trackHoverOn(view, marker);
|
||||
}
|
||||
let { hoverTime } = view.state.facet(lintGutterConfig);
|
||||
let hoverTimeout = setTimeout(hovered, hoverTime);
|
||||
marker.onmouseout = () => {
|
||||
clearTimeout(hoverTimeout);
|
||||
marker.onmouseout = marker.onmousemove = null;
|
||||
};
|
||||
marker.onmousemove = () => {
|
||||
clearTimeout(hoverTimeout);
|
||||
hoverTimeout = setTimeout(hovered, hoverTime);
|
||||
};
|
||||
}
|
||||
function markersForDiagnostics(doc, diagnostics) {
|
||||
let byLine = Object.create(null);
|
||||
for (let diagnostic of diagnostics) {
|
||||
let line = doc.lineAt(diagnostic.from);
|
||||
(byLine[line.from] || (byLine[line.from] = [])).push(diagnostic);
|
||||
}
|
||||
let markers = [];
|
||||
for (let line in byLine) {
|
||||
markers.push(new LintGutterMarker(byLine[line]).range(+line));
|
||||
}
|
||||
return RangeSet.of(markers, true);
|
||||
}
|
||||
const lintGutterExtension = /*@__PURE__*/gutter({
|
||||
class: "cm-gutter-lint",
|
||||
markers: view => view.state.field(lintGutterMarkers),
|
||||
widgetMarker: (view, widget, block) => {
|
||||
let diagnostics = [];
|
||||
view.state.field(lintGutterMarkers).between(block.from, block.to, (from, to, value) => {
|
||||
if (from > block.from && from < block.to)
|
||||
diagnostics.push(...value.diagnostics);
|
||||
});
|
||||
return diagnostics.length ? new LintGutterMarker(diagnostics) : null;
|
||||
}
|
||||
});
|
||||
const lintGutterMarkers = /*@__PURE__*/StateField.define({
|
||||
create() {
|
||||
return RangeSet.empty;
|
||||
},
|
||||
update(markers, tr) {
|
||||
markers = markers.map(tr.changes);
|
||||
let diagnosticFilter = tr.state.facet(lintGutterConfig).markerFilter;
|
||||
for (let effect of tr.effects) {
|
||||
if (effect.is(setDiagnosticsEffect)) {
|
||||
let diagnostics = effect.value;
|
||||
if (diagnosticFilter)
|
||||
diagnostics = diagnosticFilter(diagnostics || [], tr.state);
|
||||
markers = markersForDiagnostics(tr.state.doc, diagnostics.slice(0));
|
||||
}
|
||||
}
|
||||
return markers;
|
||||
}
|
||||
});
|
||||
const setLintGutterTooltip = /*@__PURE__*/StateEffect.define();
|
||||
const lintGutterTooltip = /*@__PURE__*/StateField.define({
|
||||
create() { return null; },
|
||||
update(tooltip, tr) {
|
||||
if (tooltip && tr.docChanged)
|
||||
tooltip = hideTooltip(tr, tooltip) ? null : Object.assign(Object.assign({}, tooltip), { pos: tr.changes.mapPos(tooltip.pos) });
|
||||
return tr.effects.reduce((t, e) => e.is(setLintGutterTooltip) ? e.value : t, tooltip);
|
||||
},
|
||||
provide: field => showTooltip.from(field)
|
||||
});
|
||||
const lintGutterTheme = /*@__PURE__*/EditorView.baseTheme({
|
||||
".cm-gutter-lint": {
|
||||
width: "1.4em",
|
||||
"& .cm-gutterElement": {
|
||||
padding: ".2em"
|
||||
}
|
||||
},
|
||||
".cm-lint-marker": {
|
||||
width: "1em",
|
||||
height: "1em"
|
||||
},
|
||||
".cm-lint-marker-info": {
|
||||
content: /*@__PURE__*/svg(`<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>`)
|
||||
},
|
||||
".cm-lint-marker-warning": {
|
||||
content: /*@__PURE__*/svg(`<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>`),
|
||||
},
|
||||
".cm-lint-marker-error": {
|
||||
content: /*@__PURE__*/svg(`<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>`)
|
||||
},
|
||||
});
|
||||
const lintExtensions = [
|
||||
lintState,
|
||||
/*@__PURE__*/EditorView.decorations.compute([lintState], state => {
|
||||
let { selected, panel } = state.field(lintState);
|
||||
return !selected || !panel || selected.from == selected.to ? Decoration.none : Decoration.set([
|
||||
activeMark.range(selected.from, selected.to)
|
||||
]);
|
||||
}),
|
||||
/*@__PURE__*/hoverTooltip(lintTooltip, { hideOn: hideTooltip }),
|
||||
baseTheme$3
|
||||
];
|
||||
const lintGutterConfig = /*@__PURE__*/Facet.define({
|
||||
combine(configs) {
|
||||
return combineConfig(configs, {
|
||||
hoverTime: 300 /* Hover.Time */,
|
||||
markerFilter: null,
|
||||
tooltipFilter: null
|
||||
});
|
||||
}
|
||||
});
|
||||
/**
|
||||
Returns an extension that installs a gutter showing markers for
|
||||
each line that has diagnostics, which can be hovered over to see
|
||||
the diagnostics.
|
||||
*/
|
||||
function lintGutter(config = {}) {
|
||||
return [lintGutterConfig.of(config), lintGutterMarkers, lintGutterExtension, lintGutterTheme, lintGutterTooltip];
|
||||
}
|
||||
|
||||
/**
|
||||
The default maximum length of a `TreeBuffer` node.
|
||||
|
|
@ -30574,6 +31312,7 @@ ${text}</tr>
|
|||
highlightSpecialChars(),
|
||||
history(),
|
||||
foldGutter(),
|
||||
lintGutter(),
|
||||
drawSelection(),
|
||||
indentUnit.of(" "),
|
||||
EditorState.allowMultipleSelections.of(true),
|
||||
|
|
@ -30593,6 +31332,7 @@ ${text}</tr>
|
|||
...foldKeymap,
|
||||
...completionKeymap,
|
||||
...searchKeymap,
|
||||
...lintKeymap
|
||||
]),
|
||||
xml(),
|
||||
syntaxHighlighting(defaultHighlightStyle, { fallback: true })
|
||||
|
|
@ -30618,6 +31358,7 @@ ${text}</tr>
|
|||
exports.createEditorView = createEditorView;
|
||||
exports.languageServerSupport = languageServerSupport;
|
||||
exports.lsp = lsp;
|
||||
exports.openLintPanel = openLintPanel;
|
||||
exports.openSearchPanel = openSearchPanel;
|
||||
exports.simpleWebSocketTransport = simpleWebSocketTransport;
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
2
webapp/static/codemirror/lsp.bundle.min.js
vendored
2
webapp/static/codemirror/lsp.bundle.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue