Skip to content

Rename: lsp → langservice + cursor split, and project → existdb-openapi#18

Open
joewiz wants to merge 6 commits into
eXist-db:developfrom
joewiz:feat/rename-lsp-to-langservice
Open

Rename: lsp → langservice + cursor split, and project → existdb-openapi#18
joewiz wants to merge 6 commits into
eXist-db:developfrom
joewiz:feat/rename-lsp-to-langservice

Conversation

@joewiz
Copy link
Copy Markdown
Member

@joewiz joewiz commented May 13, 2026

Summary

Renames the lsp: XQuery namespace and /api/lsp/* URL prefix to langservice / lang, splits the server-side cursor functions (eval / fetch / close) into a new cursor: namespace, adds a capability discovery endpoint, and renames the project from exist-api to existdb-openapi (Maven artifactId, XAR target, EXPath package URI, etc., to match the GitHub repo rename in #13).

Implements the naming decisions locked in #7 (LSP/langservice/cursor namespaces) and #13 (repo rename).

Per #7: this project is an HTTP/JSON backend with LSP-inspired data shapes — not an LSP server. The previous lsp: names (inherited from the migrated exist-lsp package) implied a protocol claim that wasn't true. Per #13: "exist-api" was too generic given how many APIs eXist already has (RESTXQ, REST Server, XML:DB, etc.); "existdb-openapi" names what this project actually is.

No backward-compatibility aliases — all four known consumers (eXide, existdb-langserver, monex, notebook) are pre-release and updated in lockstep.

REST request/response shapes are unchanged in this PR; LSP-isomorphic shape tightening is tracked separately in #16.

Closes

Naming changes

XQuery namespaces / Java packages

Thing Before After
URL prefix /api/lsp/* /api/langservice/*
XQuery URI (lang) http://exist-db.org/xquery/lsp http://exist-db.org/xquery/langservice
XQuery prefix (lang) lsp lang
XQuery URI (cursor) http://exist-db.org/xquery/cursor (new)
XQuery prefix (cursor) cursor (new)
Java package (lang) org.exist.xquery.modules.api.lsp.* org.exist.xquery.modules.openapi.langservice.*
Java package (cursor) (same as above) org.exist.xquery.modules.openapi.cursor.*
Module class (lang) LspModule LangServiceModule
Module class (cursor) (same as above) CursorModule (new)

The empty placeholder ApiModule is deleted; its cursor-store configuration role moves into CursorModule.

Project / repo coordinates

Coordinate Before After
GitHub repo eXist-db/exist-api eXist-db/existdb-openapi
Maven artifactId exist-api existdb-openapi
Project name "Platform API Module" "eXist-db OpenAPI"
XAR target / package-abbrev exist-api existdb-openapi
EXPath package-name URI http://exist-db.org/pkg/api http://exist-db.org/pkg/openapi
scm URLs github.com/eXist-db/exist-api github.com/eXist-db/existdb-openapi

GitHub auto-redirects the old repo URL.

New endpoint

GET /api/langservice/capabilities — returns the set of language-service features the running instance supports. Replaces the probe-hack existdb-langserver currently uses for feature detection.

Files touched

  • 11 Java files renamed/repackaged + 1 new (CursorModule)
  • modules/lsp.xqmmodules/langservice.xqm
  • modules/query.xqm, modules/api.xq, modules/api.json — updates
  • pom.xml, xar-assembly.xml, repo.xml — coordinate changes
  • src/test/resources/conf.xml — builtin-modules entries updated
  • MIGRATION.md — new; to be removed once consumer rollout completes

Test plan

  • mvn compile passes (verified locally with Java 21)
  • mvn package produces the XAR (the test/xqs reference in xar-assembly.xml was removed in this PR — see commit 2ccba84)
  • Install XAR into a running eXist; verify /api/langservice/* endpoints respond — all 7 endpoints (capabilities, diagnostics, completions, hover, definition, references, symbols) return 200 against eXist 7.0-SNAPSHOT
  • Verify /api/langservice/capabilities returns the expected shape (cursor/diagnostics/hover/symbols/etc. capability map per the OpenAPI spec)
  • Verify /api/eval, /api/query/{id}/results, DELETE /api/query/{id} still work (delegate to cursor:* functions) — full cursor lifecycle round-tripped (POST → GET → DELETE all 200, items returned correctly)
  • Consumer rollout PRs prepared and pushed: eXide#794, monex#367, existdb-langserver#68, notebook (direct push to joewiz/notebook main). Each will merge after this PR lands.

@joewiz joewiz changed the title Rename lsp → langservice + split cursor namespace Rename: lsp → langservice + cursor split, and project → existdb-openapi May 16, 2026
joewiz added a commit to joewiz/eXide that referenced this pull request May 16, 2026
Coordinated update for the breaking rename in
eXist-db/existdb-openapi#18 (formerly eXist-db/exist-api). All four
known consumers (eXide, monex, existdb-langserver, notebook) move
together — no backward-compat aliases.

XQuery namespace switches in modules/api/query.xqm:
- import lsp: -> import lang: (language services) and cursor: (server-side cursor)
- lsp:diagnostics/completions/hover/definition/references/symbols -> lang:*
- lsp:eval/fetch/close -> cursor:*
- function-lookup QName URI updated to .../xquery/cursor

URL/XAR coordinate updates:
- ../exist-api/api/* -> ../existdb-openapi/api/* in src/eXide.js
- CI: download from joewiz/existdb-openapi, pattern existdb-openapi-*.xar
- Note: CI is pinned to v0.9.0-pre.2 — a new pre-release tag will be
  cut from existdb-openapi after PR #18 lands. CI stays red until then.

File renames for naming hygiene:
- src/lsp-hover.js -> src/lang-hover.js
- resources/css/lsp-hover.css -> resources/css/lang-hover.css
- CSS classes cm-lsp-hover* -> cm-lang-hover*
- Updated import in scripts/bundle.js and link in index.html

Comments/docs updated. References to "LSP" as a protocol (e.g.,
"LSP-aware completions", "LSP protocol messages") are preserved since
they describe interop-with-LSP semantics, not the renamed namespace.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
joewiz added a commit to joewiz/monex that referenced this pull request May 16, 2026
Coordinated update for eXist-db/existdb-openapi#18 (formerly
eXist-db/exist-api). The lsp:eval/fetch/close functions are renamed
to cursor:eval/fetch/close (their own namespace), since they are
query-execution primitives, not language services.

Only modules/query.xql is affected; monex doesn't consume any of the
language-service endpoints (lsp:diagnostics/symbols/etc.).

BREAKING CHANGE: requires existdb-openapi (formerly exist-api) 1.0.0+
with the cursor namespace. Will not work against older exist-api
releases that exposed these functions under the lsp namespace.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
joewiz added a commit to joewiz/existdb-langserver that referenced this pull request May 16, 2026
Coordinated update for eXist-db/existdb-openapi#18 (formerly
eXist-db/exist-api). All four known consumers (eXide, monex,
existdb-langserver, notebook) move together — no backward-compat
aliases.

URL paths:
- /apps/exist-api/api/lsp/* -> /apps/existdb-openapi/api/langservice/*
- /apps/exist-api/api/* -> /apps/existdb-openapi/api/* (eval/query)

XQuery function references in comments and capability probes:
- lsp:diagnostics/symbols -> lang:*
- lsp:eval/fetch/close -> cursor:*

The probe-hack capability detection (sending dummy query=1 to lsp:eval)
is kept in place for now and just renamed to cursor:eval. A follow-up
should switch to the new GET /api/langservice/capabilities endpoint
introduced in existdb-openapi#17.

Test file renames:
- test/capability-check.spec.ts: "lsp:eval capability detection" ->
  "cursor:eval capability detection" (and matching it() titles)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
joewiz added a commit to joewiz/notebook that referenced this pull request May 16, 2026
Coordinated update for eXist-db/existdb-openapi#18 (formerly
eXist-db/exist-api). The XAR was renamed from exist-api to
existdb-openapi, and the /api/lsp/* endpoints were renamed to
/api/langservice/*.

Changes in resources/js/notebook.js:
- /apps/exist-api/api -> /apps/existdb-openapi/api
- /lsp/completions, /lsp/hover -> /langservice/completions, /langservice/hover
- lspBase variable renamed to langBase
- Comments updated to refer to "langservice" rather than "LSP"

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
joewiz added a commit to joewiz/eXide that referenced this pull request May 16, 2026
eXist 7.0 parser has a regression where calling pkg:close() fails for
any module — even though inspect:inspect-module-uri shows the signature
correctly registered. Renamed in existdb-openapi as cursor:release; this
commit catches up the eXide-side call site.

See eXist-db/existdb-openapi#18 commit f47bbac for the discovery details.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
joewiz added a commit to joewiz/eXide that referenced this pull request May 16, 2026
Coordinated update for the breaking rename in
eXist-db/existdb-openapi#18 (formerly eXist-db/exist-api). All four
known consumers (eXide, monex, existdb-langserver, notebook) move
together — no backward-compat aliases.

XQuery namespace switches in modules/api/query.xqm:
- import lsp: -> import lang: (language services) and cursor: (server-side cursor)
- lsp:diagnostics/completions/hover/definition/references/symbols -> lang:*
- lsp:eval/fetch/close -> cursor:*
- function-lookup QName URI updated to .../xquery/cursor

URL/XAR coordinate updates:
- ../exist-api/api/* -> ../existdb-openapi/api/* in src/eXide.js
- CI: download from joewiz/existdb-openapi, pattern existdb-openapi-*.xar
- Note: CI is pinned to v0.9.0-pre.2 — a new pre-release tag will be
  cut from existdb-openapi after PR #18 lands. CI stays red until then.

File renames for naming hygiene:
- src/lsp-hover.js -> src/lang-hover.js
- resources/css/lsp-hover.css -> resources/css/lang-hover.css
- CSS classes cm-lsp-hover* -> cm-lang-hover*
- Updated import in scripts/bundle.js and link in index.html

Comments/docs updated. References to "LSP" as a protocol (e.g.,
"LSP-aware completions", "LSP protocol messages") are preserved since
they describe interop-with-LSP semantics, not the renamed namespace.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
joewiz added a commit to joewiz/eXide that referenced this pull request May 16, 2026
eXist 7.0 parser has a regression where calling pkg:close() fails for
any module — even though inspect:inspect-module-uri shows the signature
correctly registered. Renamed in existdb-openapi as cursor:release; this
commit catches up the eXide-side call site.

See eXist-db/existdb-openapi#18 commit f47bbac for the discovery details.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@joewiz joewiz force-pushed the feat/rename-lsp-to-langservice branch 3 times, most recently from 7e09c4b to c1f492b Compare May 17, 2026 02:31
joewiz added a commit to joewiz/eXide that referenced this pull request May 17, 2026
Coordinated update for the breaking rename in
eXist-db/existdb-openapi#18 (formerly eXist-db/exist-api). All four
known consumers (eXide, monex, existdb-langserver, notebook) move
together — no backward-compat aliases.

XQuery namespace switches in modules/api/query.xqm:
- import lsp: -> import lang: (language services) and cursor: (server-side cursor)
- lsp:diagnostics/completions/hover/definition/references/symbols -> lang:*
- lsp:eval/fetch/close -> cursor:*
- function-lookup QName URI updated to .../xquery/cursor

URL/XAR coordinate updates:
- ../exist-api/api/* -> ../existdb-openapi/api/* in src/eXide.js
- CI: download from joewiz/existdb-openapi, pattern existdb-openapi-*.xar
- Note: CI is pinned to v0.9.0-pre.2 — a new pre-release tag will be
  cut from existdb-openapi after PR #18 lands. CI stays red until then.

File renames for naming hygiene:
- src/lsp-hover.js -> src/lang-hover.js
- resources/css/lsp-hover.css -> resources/css/lang-hover.css
- CSS classes cm-lsp-hover* -> cm-lang-hover*
- Updated import in scripts/bundle.js and link in index.html

Comments/docs updated. References to "LSP" as a protocol (e.g.,
"LSP-aware completions", "LSP protocol messages") are preserved since
they describe interop-with-LSP semantics, not the renamed namespace.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…r own namespace

The 'lsp:' XQuery namespace and '/api/lsp/*' URL prefix were inherited
from the migrated exist-lsp package and implied a protocol claim that
isn't true — exist-api is an HTTP/JSON backend with LSP-inspired data
shapes, not an LSP server. See eXist-db#7 for the architecture discussion that
drove this rename.

This commit also splits the server-side cursor functions (eval / fetch
/ close) out of the language-services namespace, since they are
query-execution primitives, not language services.

Naming changes:
- URL prefix: /api/lsp/* -> /api/langservice/*
- XQuery: 'lsp:' -> 'lang:' (language services) and new 'cursor:'
- XQuery URIs: http://exist-db.org/xquery/{langservice,cursor}
- Java packages: org.exist.xquery.modules.api.lsp.* ->
  org.exist.xquery.modules.openapi.{langservice,cursor}.*
- New module classes: LangServiceModule, CursorModule (replacing the
  combined LspModule)

Other changes:
- ApiModule deleted; its cursor-store configuration role moves to
  CursorModule (which is what actually uses the store)
- New endpoint: GET /api/langservice/capabilities returns the set of
  language-service features the running instance supports — replaces
  existdb-langserver's current probe hack (closes eXist-db#17)
- MIGRATION.md documents the rename for downstream consumers; removed
  once eXide / monex / existdb-langserver / notebook are updated

No backward-compatibility aliases. All four known consumers are
pre-release and will be updated in lockstep.

REST request/response shapes are unchanged in this PR; shape tightening
to LSP 3.17 isomorphism is tracked separately in eXist-db#16.

Closes eXist-db#7
Closes eXist-db#15
Closes eXist-db#17

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@joewiz joewiz force-pushed the feat/rename-lsp-to-langservice branch from 21a08aa to ed8385d Compare May 19, 2026 18:42
joewiz and others added 5 commits May 19, 2026 22:27
Renames the Maven artifactId, XAR target, EXPath package URI, and
related coordinates to match the GitHub repo rename in eXist-db#13. The repo
itself was renamed from eXist-db/exist-api to eXist-db/existdb-openapi
on GitHub (auto-redirect in place).

Per eXist-db#13, "existdb-openapi" matches what this project actually is — an
OpenAPI-described HTTP surface, distinct from RESTXQ, the legacy REST
Server, and XML:DB. The "exist-api" name was too generic given how
many APIs eXist already has.

Coordinates changed:
- artifactId: exist-api -> existdb-openapi
- project name: "Platform API Module" -> "eXist-db OpenAPI"
- scm/url: github.com/eXist-db/exist-api -> .../existdb-openapi
- package-name (EXPath URI): /pkg/api -> /pkg/openapi
- package-abbrev: exist-api -> existdb-openapi
- XAR target: exist-api -> existdb-openapi
- XAR tags: exist-api/platform-api -> existdb-openapi/openapi

MIGRATION.md updated to reflect the rename and document the coordinate
changes for downstream consumers.

Closes eXist-db#13

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The fileSet pointed to a non-existent directory and caused mvn package
to fail. Pre-existing issue, not related to the rename, but blocking
local XAR builds — removing as part of this PR so the rename is
properly buildable. XQSuite tests can be added back later under a real
directory when there are tests to ship.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ules

Three fixes from smoke-testing on eXist 7.0-SNAPSHOT:

1. langservice:capabilities used bare true / false in map literals.
   XQuery has no boolean literals — they're functions (true(),
   false()). Bare identifiers were being parsed as path steps,
   raising err:XPDY0002 at runtime. Fixed.

2. Drop ordered=true from CursorModule and LangServiceModule
   super(...) calls.

   AbstractInternalModule with ordered=true uses binary search over
   the FunctionDef[] for call dispatch, which requires alphabetical
   sorting of the array. CursorModule's lifecycle-ordered declaration
   (eval/fetch/close) violated that invariant, making cursor:close()
   silently unparseable at the call site even though
   inspect:inspect-module-uri showed the signature registered fine.
   The error message ("Unexpectedly received N parameter(s)") was
   misleading.

   ordered=true is a performance optimization for modules with many
   functions (FnModule has ~500). For modules with a handful of
   functions, linear scan via the 2-arg super() is strictly better:
   no sort invariant to violate, no need to declare functions
   alphabetically vs. semantically. Refs eXist-db/exist#6378.

3. Renamed local $cursor variable to $cursor-id in modules/query.xqm
   to avoid visual confusion with the cursor: namespace prefix.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Local tooling artifacts (Claude Code session state, Codacy analyzer
config) that crept in during the rename PR via 'git add -A'. Adding
to .gitignore so they stay out.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Covers what existdb-openapi is (and isn't), how it fits among eXist's
several historical HTTP surfaces, a quick-start with curl, an endpoint
index grouped by concern (db, query, langservice, users/groups/packages,
search, system), the two internal XQuery namespaces (lang:* and
cursor:*), the cursor lifecycle, configuration knobs (cursor.maximumSize
etc.), build instructions, project layout, versioning policy, and
pointers to consumers (eXide, existdb-langserver, monex, notebook) and
the open 1.0 tracking issues (eXist-db#2, eXist-db#15, eXist-db#16, eXist-db#17, eXist-db#13).

The XAR assembly already declared README.md as a fileSet include, so
the README ships with the package.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@joewiz joewiz force-pushed the feat/rename-lsp-to-langservice branch from 4bfb120 to a9b10e4 Compare May 20, 2026 02:27
Copy link
Copy Markdown
Contributor

@duncdrum duncdrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no more blockers from my side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants