Skip to content

joewiz/existdb-language-support

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

existdb-language-support

An eXist-db XAR package that wraps the lsp:* Java functions as a REST API, providing language support services for XQuery development tools such as existdb-langserver (VS Code) and eXide.

Endpoints

All endpoints accept POST with a JSON body and return JSON.

Endpoint Request body Description
/api/diagnostics {query, base} Multi-error diagnostics
/api/symbols {query, base} Document symbols (functions, variables)
/api/completions {query, base, prefix?} Function/variable completions
/api/hover {query, line, column, base} Hover info at position
/api/definition {query, line, column, base} Go-to-definition at position

Line and column values in request and response are 1-indexed (eXist-db convention).

Requirements

Build

npm run build

Produces build/language-support-1.0.0.xar.

Install

Using xst:

xst package install local build/language-support-1.0.0.xar --force

Requires a .env file or xst configuration with eXist-db connection details:

EXISTDB_USER=admin
EXISTDB_PASS=
EXISTDB_SERVER=http://localhost:8080

Test with curl

# Diagnostics (valid query returns empty array)
curl -s -X POST -H "Content-Type: application/json" -u admin: \
  -d '{"query":"1 + 1", "base":"/db"}' \
  http://localhost:8080/exist/apps/language-support/api/diagnostics

# Symbols
curl -s -X POST -H "Content-Type: application/json" -u admin: \
  -d '{"query":"declare function local:greet($name) { $name }; ()", "base":"/db"}' \
  http://localhost:8080/exist/apps/language-support/api/symbols

# Completions (with prefix filter)
curl -s -X POST -H "Content-Type: application/json" -u admin: \
  -d '{"query":"declare function local:greet($name) { $name }; ()", "base":"/db", "prefix":"local"}' \
  http://localhost:8080/exist/apps/language-support/api/completions

License

GPL-3.0-or-later

About

eXist-db Language Support XAR — wraps lsp:* functions for IDE clients

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors