Skip to content

Update LSP spec to 3.18 and regenerate - #216

Draft
kubukoz wants to merge 2 commits into
neandertech:mainfrom
kubukoz:update-lsp-spec-3.18
Draft

kubukoz wants to merge 2 commits into
neandertech:mainfrom
kubukoz:update-lsp-spec-3.18

Conversation

@kubukoz

@kubukoz kubukoz commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #217. That PR contains the first commit here (Allow constructing custom values for open enumerations); this one adds the 3.18 upgrade on top. GitHub won't let me set the base to a branch on my fork, so this PR is still targeting main and its diff includes both commits — review the second commit only, or merge #217 first and this will shrink to just the 3.18 change.

Bumps V.LSP_PROTOCOL to 3.18, refreshes the vendored metaModel.json / metaModel.schema.json via sbt updateModelFiles, and regenerates the bindings with sbt generateLSP.

The 3.18 meta-model only adds optional fields (sinceTags, clientCapability, serverCapability, typeName), which the derived circe decoders in langoustine.meta already ignore — so the generator needed no changes.

Breaking API changes from the spec

  • InitializeParams.clientInfo and InitializeResult.serverInfo are now top-level ClientInfo / ServerInfo structures instead of anonymous nested literals. They are no longer nested in the owning objects, so InitializeResult.ServerInfo(...) becomes ServerInfo(...) (both are exported from langoustine.lsp.all).
  • TextDocumentItem.languageId is now LanguageKind — an opaque string type, not a bare String. It is marked supportsCustomValues, so a custom language id is written LanguageKind("my-toy-lang"), using the constructor from Allow constructing custom values for open enumerations #217.
  • TextDocumentEdit.edits gained SnippetTextEdit in its union.
  • The TraceValues enumeration was renamed to TraceValue. The stale generated file is deleted here by hand, since generateLSP writes files but does not prune removed ones.

New requests

  • workspace/textDocumentContent
  • workspace/textDocumentContent/refresh

Other changes

  • Callers updated in modules/example, modules/e2e-tests, modules/tests and the docs.
  • DeriveScalacheckArbitrary gains a genUnion3 for the widened edits union.
  • CustomEnumValuesTest (added in Allow constructing custom values for open enumerations #217) gains LanguageKind cases.
  • Codec snapshots regenerated for the new field ordering (JVM and Native were regenerated by the test run; the testsJS set was synced to match, as all three are kept identical and Node isn't available locally).
  • Spec doc links repointed from .../lsp/3.17/... to 3.18.

Note for review

LanguageKind.ALL has 61 entries for 62 named values: upstream spells both Delphi and Pascal as "pascal", so they are aliases. Left as-is, since both names resolve correctly — there is a test pinning this.

Testing

tests/test (42 passed), testsNative/test (29 passed), scalafmtCheckAll and headerCheck all pass. JS tests and the Node.js half of e2e-tests could not run locally — node isn't installed on this machine — so those are left to CI; both modules do compile.

🤖 Generated with Claude Code

kubukoz and others added 2 commits September 8, 2026 01:23
The LSP spec marks eight enumerations with `supportsCustomValues`,
meaning a peer may legally send a value outside the set the spec defines.
The generated companions only exposed the predefined entries, and `entry`
is `protected`, so there was no way to build such a value.

The `supportsCustomValues` flag was being dropped entirely on decode, so
add it to `langoustine.meta.Enumeration` and have the generator mix a
`CustomStringValues` / `CustomIntValues` / `CustomUIntValues` trait into
the companions that declare it. Each provides a public `apply`, so e.g.
`CodeActionKind("mytool.fixAll")` now works, while enumerations that are
closed in the spec stay closed.

Affects CodeActionKind, ErrorCodes, FoldingRangeKind, LSPErrorCodes,
PositionEncodingKind, SemanticTokenModifiers, SemanticTokenTypes and
WatchKind.

`ALL` is unchanged and still lists the predefined values.

Also add a `.gitattributes` marking the checked-in generated sources and
the vendored spec files as `linguist-generated`, so they collapse in
diffs and stay out of language stats.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Bump `V.LSP_PROTOCOL` to 3.18, refresh the vendored `metaModel.json` /
`metaModel.schema.json` via `sbt updateModelFiles`, and regenerate the
LSP bindings with `sbt generateLSP`.

The 3.18 meta-model adds only optional fields (`sinceTags`,
`clientCapability`, `serverCapability`, `typeName`), which the derived
circe decoders in `langoustine.meta` already ignore, so the generator
needed no changes.

Spec changes that affect the public API:

* `InitializeParams.clientInfo` and `InitializeResult.serverInfo` are now
  top-level `ClientInfo` / `ServerInfo` structures rather than anonymous
  nested literals, so they are no longer nested in the owning objects.
  Both are exported from `langoustine.lsp.all`.
* `TextDocumentItem.languageId` is now `LanguageKind` -- an opaque string
  type -- instead of a bare `String`. `LanguageKind` is marked
  `supportsCustomValues`, so a custom language id is written
  `LanguageKind("my-toy-lang")`, using the constructor added in the
  parent commit.
* `TextDocumentEdit.edits` gained `SnippetTextEdit` in its union.
* The `TraceValues` enumeration was renamed to `TraceValue`; the stale
  generated file is removed, as the generator does not prune.
* Two new requests: `workspace/textDocumentContent` and
  `workspace/textDocumentContent/refresh`.

Callers in the example, docs and tests are updated accordingly, and the
JVM/JS/Native codec snapshots are regenerated for the new field ordering.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant