I have a LspServerDescriptor whose getWorkspaceConfiguration looks something like this:
@Serializable
enum class E {
@SerialName("a") A,
@SerialName("b") B;
}
@Serializable
data class WorkspaceConfiguration(
val choice: E
)
override fun getWorkspaceConfiguration(item: ConfigurationItem) =
when (item.section) {
"somekey" -> WorkspaceConfiguration(choice = E.A)
else -> null
}
Json.encodeToString(workspaceConfiguration) works as expected. Yet, here’s the actual workspace/configuration response:
[{ "choice": 0 }]
It seems enum members are serialized using their ordinals rather than names. Why is this the case and what can I do so that my custom serial names are respected?