basex-lsp/README.md
2025-08-04 12:34:23 +01:00

28 lines
1.4 KiB
Markdown

Work in progress.
An attempt to write a [Language Server Protocol](https://en.wikipedia.org/wiki/Language_Server_Protocol) server using XQuery 4.0 and 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/
* I needed `set NODE_OPTIONS=--max_old_space_size=8192` for build to complete
* 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
https://mkslanc.github.io/ace-linters/websocket.html
http://localhost:3000/exampleServer
https://github.com/mkslanc/ace-linters/blob/c1b317e01299016ac7da6588361228637f4eac25/packages/demo/websockets-lsp/server/server.ts
https://www.jsonrpc.org/specification