Skip to content

Commit e22c759

Browse files
committed
project: Register dynamic capabilities even when registerOptions doesn't exist (#36554)
Closes #36482 Looks like we accidentally referenced [common/formatting.ts#L67-L70](https://github.com/microsoft/vscode-languageserver-node/blob/d90a87f9557a0df9142cfb33e251cfa6fe27d970/client/src/common/formatting.ts#L67-L70) instead of [common/client.ts#L2133](https://github.com/microsoft/vscode-languageserver-node/blob/d90a87f9557a0df9142cfb33e251cfa6fe27d970/client/src/common/client.ts#L2133). Release Notes: - Fixed code not formatting on save in language servers like Biome. (Preview Only)
1 parent 2715627 commit e22c759

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

crates/project/src/lsp_store.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12062,16 +12062,15 @@ impl LspStore {
1206212062
}
1206312063
}
1206412064

12065-
// Registration with empty capabilities should be ignored.
12066-
// https://github.com/microsoft/vscode-languageserver-node/blob/d90a87f9557a0df9142cfb33e251cfa6fe27d970/client/src/common/formatting.ts#L67-L70
12065+
// Registration with registerOptions as null, should fallback to true.
12066+
// https://github.com/microsoft/vscode-languageserver-node/blob/d90a87f9557a0df9142cfb33e251cfa6fe27d970/client/src/common/client.ts#L2133
1206712067
fn parse_register_capabilities<T: serde::de::DeserializeOwned>(
1206812068
reg: lsp::Registration,
1206912069
) -> anyhow::Result<Option<OneOf<bool, T>>> {
12070-
Ok(reg
12071-
.register_options
12072-
.map(|options| serde_json::from_value::<T>(options))
12073-
.transpose()?
12074-
.map(OneOf::Right))
12070+
Ok(match reg.register_options {
12071+
Some(options) => Some(OneOf::Right(serde_json::from_value::<T>(options)?)),
12072+
None => Some(OneOf::Left(true)),
12073+
})
1207512074
}
1207612075

1207712076
fn subscribe_to_binary_statuses(

0 commit comments

Comments
 (0)