Unnamed repository; edit this file 'description' to name the repository.
LSP: Fix `Client::supports_feature` check for 'colorProvider'
The old check would allow sending textDocument/documentColor requests
when the server declared `{"colorProvider": false}` in its capabilities
as this was `Some`:
Some(ColorProviderCapability::Simple(false))
The Julia language server sets this explicitly to `false` in the wild.
| -rw-r--r-- | helix-lsp/src/client.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/helix-lsp/src/client.rs b/helix-lsp/src/client.rs index f8275105..01b1b2c3 100644 --- a/helix-lsp/src/client.rs +++ b/helix-lsp/src/client.rs @@ -356,7 +356,14 @@ impl Client { capabilities.inlay_hint_provider, Some(OneOf::Left(true) | OneOf::Right(InlayHintServerCapabilities::Options(_))) ), - LanguageServerFeature::DocumentColors => capabilities.color_provider.is_some(), + LanguageServerFeature::DocumentColors => matches!( + capabilities.color_provider, + Some( + ColorProviderCapability::Simple(true) + | ColorProviderCapability::ColorProvider(_) + | ColorProviderCapability::Options(_) + ) + ), } } |