language server protocol
Find a file
2025-08-10 10:58:48 +01:00
bundles [mod] surface client 2025-08-07 16:21:29 +01:00
data [fix] size linewrap 2025-08-05 23:02:56 +01:00
docs [mod] diagnostics 2025-08-10 10:58:48 +01:00
test [mod] lsprpc->rpc 2025-08-07 23:06:42 +01:00
webapp [mod] diagnostics 2025-08-10 10:58:48 +01:00
.dockerignore [mod] merge lsp-web-poc 2025-07-11 15:16:28 +01:00
.gitignore [mod] additions 2025-07-31 15:02:27 +01:00
compose.yaml [fix] load 2025-08-08 12:26:11 +01:00
LICENSE [mod] samples 2025-08-01 23:14:52 +01:00
package-lock.json [mod] re-org 2025-08-06 14:57:52 +01:00
package.json [mod] surface client 2025-08-07 16:21:29 +01:00
README.md [mod] diagnostics 2025-08-10 10:58:48 +01:00
rollup.config.js [mod] additions 2025-07-31 15:02:27 +01:00

Work in progress.

An attempt to write a Language Server Protocol server using XQuery 4.0 and the BaseX websocket feature.

LSP Server

  • webapp/lsp The LSP implementation in XQuery using WebSockets for transport and the JSON-RPC 2.0 API for message format.

Dev notes

State is held in websocket attributes.

Name Use
initized set true after client sends intialized messag
files A map whose keys are open uris, values are maps (doctype-> attribute name where doctype is stored
file-{uuid} name of websocket attribute with textDocument
parse-{uuid} name of websocket attribute with parse tree XML

Sample html clients

Using CodeMirror6

  • webapp/static/codemirror A test html page using the CodeMirror6 editor that connects to the BaseX LSP instance

Using Ace Editor

  • webapp/static/ace A test html page using the Ace editor that connects to the BaseX LSP instance

Uses

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

c1b317e012/packages/demo/websockets-lsp/server/server.ts

https://www.jsonrpc.org/specification