changeset 6751:5f429c3a082e

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.
author Michael Davis <mcarsondavis@gmail.com>
date Mon, 28 Apr 2025 09:44:23 -0400
parents 34defb465c67
children 26763ac2b61e
files helix-lsp/src/client.rs
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/helix-lsp/src/client.rs	Sat Apr 19 08:58:13 2025 -0400
+++ b/helix-lsp/src/client.rs	Mon Apr 28 09:44:23 2025 -0400
@@ -356,7 +356,14 @@
                 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(_)
+                )
+            ),
         }
     }