Skip to content

Commit

Permalink
Merge pull request #181 from horriblename/feat-plugin-setup-config
Browse files Browse the repository at this point in the history
lib: function for custom plugin `setup()` arguments
  • Loading branch information
NotAShelf authored Jan 3, 2024
2 parents 2b4683f + 59b2e6b commit 39dd12f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/types/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
typesLanguage = import ./languages.nix {inherit lib;};
in {
inherit (typesDag) dagOf;
inherit (typesPlugin) pluginsOpt extraPluginType;
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption;
inherit (typesLanguage) diagnostics mkGrammarOption;
}
21 changes: 21 additions & 0 deletions lib/types/plugins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,25 @@ in {
inherit description default;
type = pluginsType;
};

# opts is a attrset of options, example:
# ```
# mkPluginSetupOption "telescope" {
# file_ignore_patterns = mkOption {
# description = "...";
# type = types.listOf types.str;
# default = [];
# };
# layout_config.horizontal = mkOption {...};
# }
# ```
mkPluginSetupOption = pluginName: opts:
mkOption {
description = "Option table to pass into the setup function of " + pluginName;
default = {};
type = types.submodule {
freeformType = with types; attrsOf anything;
options = opts;
};
};
}

0 comments on commit 39dd12f

Please sign in to comment.