Skip to content

ThemeRegistry.GetThemesInFamily("catppuccin") returns no themes, though FindTheme("catppuccin mocha") ignores case #118

Description

@matt-edmondson

What's wrong

ThemeRegistry.ThemesByFamily is built with ToDictionary using the default, case-sensitive string comparer (ThemeProvider/ThemeRegistry.cs:106-109). GetThemesInFamily (:146-152) and CreateThemeInstancesInFamily look families up in that dictionary.

Meanwhile, FindTheme is documented and implemented as case-insensitive. So at 9454d42:

  • GetThemesInFamily("Catppuccin").Count is 4.
  • GetThemesInFamily("catppuccin").Count is 0.
  • FindTheme("catppuccin mocha") finds the theme.
  • GetThemesInFamily(null!) throws ArgumentNullException from the dictionary, while FindTheme(null!) returns null.

Why it matters

A theme picker or config file that stores family names in a different case, such as lower-cased keys from a settings file or a CLI argument, gets an empty family back. Nothing reports an error, and the behaviour contradicts the registry's name lookup.

Suggested fix

  • Pass StringComparer.OrdinalIgnoreCase to the ToDictionary call.
  • Handle a null family the same way FindTheme handles a null name.

Acceptance criteria

  • GetThemesInFamily("catppuccin") and CreateThemeInstancesInFamily("CATPPUCCIN") return the four Catppuccin themes.
  • Null handling matches FindTheme.
  • A test covers the lower-case family lookup.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions