Conversation
|
So you could just do this without any errors, like we do in LSP, no? |
|
In the JSON schema it's an enum so it ends up as |
|
Hm... that's another point where the metaModel deviates from the specs 😠 (Edit: fixed typo) I think all LSP types that have |
|
It's just the way they handle cases where the value is a literal but also they want to provide some pre-existing values for it. Perhaps we could just generate those types differently. Instead of creating an enum, create a simple type alias like: LanguageKind = str | Literal['json', 'python', ...]? |
|
Nah, that doesn't work that great. |
|
This will work: languageId: Union['LanguageKind', str] |
|
I'd probably prefer to keep the enums restricted to the predefined values. Would it be possible to make the generator produce |
|
Yeah, it's possible but would need refactoring because currently we don't have full enum schema when generating the reference. |
|
Let's get this cleanup merged before I do the follow up changes: #38 |
|
Follow up: #39 |
Add
_missing_implementation for string enumerations that havesupportsCustomValuesspecified in schema.LSP-jsonhas a code that assigns custom language ID toTextDocument.languageId. That triggers a type error:Adding
_missing_implementation allows us to use a code like:to set custom language ID without triggering type error.