Repository navigation
Description
Part of #138
Popularity: 1/7 corpus consumers (slang-server)
Related issues
- Related fork issues: Map (Lane 2): JSON / RPC & Format Interop #86 (
Map (Lane 2): JSON / RPC & Format Interop), Map (Lane 4): Schema & Contract Fidelity #88 (Map (Lane 4): Schema & Contract Fidelity), Triage & Design Notes (Fork-Only): Speculative Schema / Contract APIs #136.
Observed Downstream Workaround (hudson-trading/slang-server @ 1b413a46)
LSP defines numerous "open/extensible string enum" types where the specification lists well-known predefined values while explicitly allowing clients to send custom extension strings (e.g. CodeActionKind "refactor.move", FoldingRangeKind "custom.region", SemanticTokenTypes, LanguageKind, etc.).
Because rfl::Literal<...> is strictly closed-world and rejects any string outside its compile-time list, slang-server had to rip rfl::Literal out of 15 LSP wire types in commit 1e371b7 (PR #417: "LSP: Relax rfl::Literal types to string"), replacing every wire field with bare std::string while keeping a parallel *Options = rfl::Literal<...> shadow alias solely for compile-time-checked string construction:
include/lsp/LspTypes.h#L273-L278:/// A set of predefined code action kinds. The LSP code action kind namespace is open ended, /// so clients can advertise and request extension kinds outside this predefined set. using CodeActionKindOptions = rfl::Literal<"", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports", "source.fixAll", "notebook">; using CodeActionKind = std::string;
- Same split repeated across 14 additional types in
include/lsp/LspTypes.h:FileOperationPatternKind(#L254-L255),MarkupKind(#L372-L373),FoldingRangeKind(#L384-L385),TokenFormat(#L508-L509),ResourceOperationKind(#L537-L538),LanguageKind(#L609-L618),FailureHandlingKind(#L632-L634),PositionEncodingKind(#L1337-L1338),TraceValue(#L2801-L2802),UniquenessLevel(#L3724-L3725),MonikerKind(#L4146-L4147),SemanticTokenTypes(#L6642-L6647),SemanticTokenModifiers(#L6654-L6657), andDocumentDiagnosticReportKind(#L6847-L6848). - Call sites must convert through the shadow
*Optionsalias on every construction/comparison:src/codeactions/AddDefine.cpp#L31:.kind = lsp::CodeActionKindOptions::from_name<"quickfix">().str(),src/util/Converters.cpp#L139:.kind = lsp::MarkupKindOptions::from_name<"markdown">().str(),- Plus
AddInclude.cpp#L190,ExpandMacro.cpp#L73,Formatting.cpp#L374,L453,Markdown.cpp#L154, and regression testLspExtensibleStringEnums_AllowExtensionKindsattests/cpp/CodeActionTests.cpp#L251-L287.
Root Cause & Suggested Direction
rfl::Literal<...> only models closed string enumerations; reflect-cpp has no open/extensible literal vocabulary type (analogous to TypeScript's "quickfix" | (string & {}) or JSON Schema anyOf: [{enum: [...]}, {type: "string"}]) that preserves compile-time-checked known values and schema hints while accepting unknown extension strings on parse.
Consider an open-enum / extensible-literal type or rfl::Variant<rfl::Literal<...>, std::string> ergonomics helper (with compile-time make<"known">() construction, direct string comparison, and clean JSON Schema emission) so protocol consumers do not have to split every extensible string enum into *Options + std::string.
Activity
[-]API/Literal (slang-server): closed-world rfl::Literal forces abandoning it across 15 extensible LSP string-enum types (*Options + std::string + .from_name<...>().str())[/-][+]API/Literal: closed-world rfl::Literal forces abandoning it across 15 extensible LSP string-enum types (*Options + std::string + .from_name<...>().str())[/+]clockblocker commentedon Nov 29, 2026
Triage decision: closing as
wontfix(not planned) for the upstream adoption track.Rationale: Making
rfl::Literalopen/extensible for LSP string enums is a single-repo convenience (slang-server) wherestd::string+ named constants already works cleanly without weakeningrfl::Literal's closed-world compile-time contract. Zero external adoption leverage.