Skip to content

Commit

Permalink
update-scripts: Handle missing descriptions for enums
Browse files Browse the repository at this point in the history
  • Loading branch information
traxys committed Jan 17, 2025
1 parent 674790d commit d63ac3e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions update-scripts/rust-analyzer/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 (
Expand Down

0 comments on commit d63ac3e

Please sign in to comment.