Fix exotic fold range kinds (#49151) (cherry-pick to preview) (#49152)
zed-zippy[bot]
and
Kirill Bulatov
created
Cherry-pick of #49151 to preview
----
Follow-up of https://github.com/zed-industries/zed/pull/48611
Despite Zed not declaring such support in its capabilities,
https://github.com/zed-industries/zed/blob/a0eb63d1affb6e7b7991e477c7e05824d0250255/crates/lsp/src/lsp.rs#L1010-L1016
`json-language-server` returns `object` as a folding range kind:
<img width="1728" height="720" alt="bad"
src="https://github.com/user-attachments/assets/ee574879-8657-41c8-ab12-562f3882f057"
/>
The spec, even 3.18, does not really seem to allow it explicitly:
https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/#foldingRangeKind
but mentions that the real type
> The type is a string since the value set is extensible
The PR adds a capture enum variant for such cases, to get the folds in
instead of failing on deserialization.
See also: https://github.com/zed-industries/lsp-types/pull/10
Release Notes:
- Fixed `json-language-server` document folds not being parsed correctly
Co-authored-by: Kirill Bulatov <kirill@zed.dev>