From d63ac3eb39161a63a14f54f0be388a9f082a1af3 Mon Sep 17 00:00:00 2001 From: Quentin Boyer Date: Fri, 17 Jan 2025 20:37:49 +0100 Subject: [PATCH] update-scripts: Handle missing descriptions for enums --- update-scripts/rust-analyzer/default.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/update-scripts/rust-analyzer/default.nix b/update-scripts/rust-analyzer/default.nix index 199450e9..9154395e 100644 --- a/update-scripts/rust-analyzer/default.nix +++ b/update-scripts/rust-analyzer/default.nix @@ -184,12 +184,15 @@ let }; pluginDefault = default; description = + let + globalDescription = '' + ${filteredMarkdownDesc} + ''; + in if enum == null && (anyOf == null || builtins.all (subProp: !(lib.hasAttr "enum" subProp)) anyOf) then - '' - ${filteredMarkdownDesc} - '' + globalDescription else if enum != null then assert lib.assertMsg (anyOf == null) "enum + anyOf types are not yet handled"; enumDesc enum enumDescriptions @@ -202,7 +205,11 @@ let ) "anyOf types may currently only contain a single enum"; lib.head subEnums; in - enumDesc subEnum.enum subEnum.enumDescriptions; + if subEnum ? enumDescriptions then + enumDesc subEnum.enum subEnum.enumDescriptions + else + globalDescription; + }; rustAnalyzerOptions = builtins.map (