Skip to content

Fix exotic fold range kinds - #49151

Merged
SomeoneToIgnore merged 1 commit into
mainfrom
kb/lenient-fold-types
Feb 13, 2026
Merged

Fix exotic fold range kinds#49151
SomeoneToIgnore merged 1 commit into
mainfrom
kb/lenient-fold-types

Conversation

@SomeoneToIgnore

@SomeoneToIgnore SomeoneToIgnore commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Follow-up of #48611

Despite Zed not declaring such support in its capabilities,

zed/crates/lsp/src/lsp.rs

Lines 1010 to 1016 in a0eb63d

folding_range_kind: Some(FoldingRangeKindCapability {
value_set: Some(vec![
FoldingRangeKind::Comment,
FoldingRangeKind::Region,
FoldingRangeKind::Imports,
]),
}),

json-language-server returns object as a folding range kind:

bad

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: zed-industries/lsp-types#10

Release Notes:

  • Fixed json-language-server document folds not being parsed correctly

<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: zed-industries/lsp-types#10
@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Feb 13, 2026
@zed-community-bot zed-community-bot Bot added the staff Pull requests authored by a current member of Zed staff label Feb 13, 2026
@SomeoneToIgnore
SomeoneToIgnore enabled auto-merge (squash) February 13, 2026 23:42
@SomeoneToIgnore
SomeoneToIgnore merged commit 21bc4f1 into main Feb 13, 2026
38 checks passed
@SomeoneToIgnore
SomeoneToIgnore deleted the kb/lenient-fold-types branch February 13, 2026 23:51
@SomeoneToIgnore

Copy link
Copy Markdown
Contributor Author

/cherry-pick preview

github-actions Bot pushed a commit that referenced this pull request Feb 13, 2026
Follow-up of #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: zed-industries/lsp-types#10

Release Notes:

- Fixed `json-language-server` document folds not being parsed correctly
zed-zippy Bot added a commit that referenced this pull request Feb 14, 2026
Cherry-pick of #49151 to preview

----
Follow-up of #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: zed-industries/lsp-types#10

Release Notes:

- Fixed `json-language-server` document folds not being parsed correctly

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
rtfeldman pushed a commit that referenced this pull request Feb 17, 2026
Follow-up of #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: zed-industries/lsp-types#10

Release Notes:

- Fixed `json-language-server` document folds not being parsed correctly
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
Follow-up of zed-industries#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: zed-industries/lsp-types#10

Release Notes:

- Fixed `json-language-server` document folds not being parsed correctly
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
Follow-up of zed-industries#48611

Despite Zed not declaring such support in its capabilities,


https://github.com/zed-industries/zed/blob/219b612f63da6698b321e3b741d46954b566eb37/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: zed-industries/lsp-types#10

Release Notes:

- Fixed `json-language-server` document folds not being parsed correctly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement staff Pull requests authored by a current member of Zed staff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant