Conversation
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>
kubukoz
marked this pull request as ready for review
September 7, 2026 23:32
Contributor
|
Tick the box to add this pull request to the merge queue (same as
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, andentryisprotected, so there was no way to construct such a value at all.The root cause was upstream of the generator:
supportsCustomValueswas never decoded —langoustine.meta.Enumerationsimply had no such field, so the renderer had no way to know which enumerations were open.What this does
Adds the field to
langoustine.meta.Enumeration, and has the generator mix aCustomStringValues/CustomIntValues/CustomUIntValuestrait into the companions that declare it. Each exposes a publicapply:Enumerations that are closed in the spec stay closed. Affects
CodeActionKind,ErrorCodes,FoldingRangeKind,LSPErrorCodes,PositionEncodingKind,SemanticTokenModifiers,SemanticTokenTypesandWatchKind.ALLis unchanged in both content and visibility.Also here
A
.gitattributesmarking the checked-in generated sources and the vendored spec files aslinguist-generated, so they collapse in diffs and stay out of language statistics — which already helps in this PR's own diff.Note for review
The
Custom*Valuestraits areprivate[lsp], matching the existingStringEnum/IntEnum/UIntEnum. The inheritedapplyis still public and callable from user code — covered by the newCustomEnumValuesTest— while the internalrawextension stays internal. That is also why the test asserts on underlying values by round-tripping through the JSON codecs rather than callingraw.Testing
tests/test(40 passed),testsNative/test(27 passed),scalafmtCheckAllandheaderCheckall pass. JS tests could not run locally —nodeisn't installed on this machine — so those are left to CI; the module does compile.#216 (update to LSP 3.18) is based on this branch. That upgrade is what made the gap concrete: 3.18 turns
TextDocumentItem.languageIdintoLanguageKindrather than a bareString, so without this PR there would be no way to express a custom language id.🤖 Generated with Claude Code