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.
pull/12085/head
Michael Davis 2025-04-28 09:44:23 -04:00
parent 9f3b193743
commit 47cdd23e50
No known key found for this signature in database
1 changed files with 8 additions and 1 deletions

View File

@ -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(_)
)
),
}
}