core: show warnings for deprecated or changed options (#129)

* moved helpers to lib folder

* Created proxy file for helpers.nix

* wrappers: removed code duplication

* null-ls: fix wrong name of variable

* added warnings module

* Added assertions

* bufferline: deprecated option

* nvim-tree: renamed options

* Fixed mkRenamedOption

* Bufferline: added new options

* Fixed deprecated option

Co-authored-by: Pedro Alves <pta2002@pta2002.com>
This commit is contained in:
Alexander Nortung 2023-01-24 01:28:01 +00:00 committed by GitHub
parent 5fac9be0ab
commit 63c256dc3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 369 additions and 206 deletions

View file

@ -1,8 +1,9 @@
{ config, pkgs, lib, ... }:
{ config, pkgs, lib, ... }@args:
with lib;
let
cfg = config.plugins.bufferline;
helpers = import ../helpers.nix { inherit lib; };
optionWarnings = import ../../lib/option-warnings.nix args;
helpers = import ../helpers.nix args;
highlight = mkOption {
type = types.nullOr (types.submodule ({ ... }: {
@ -23,6 +24,13 @@ let
};
in
{
imports = [
(optionWarnings.mkDeprecatedOption {
option = [ "plugins" "bufferline" "indicatorIcon" ];
alternative = [ "plugins" "bufferline" "indicator" "icon" ];
})
];
options = {
plugins.bufferline = {
enable = mkEnableOption "bufferline";
@ -56,6 +64,7 @@ in
description = "Command or function run when middle clicking on a buffer.";
default = null;
};
# is deprecated, but might still work
indicatorIcon = mkOption {
type = types.nullOr types.str;
description = "The Icon shown as a indicator for buffer. Changing it is NOT recommended,
@ -157,6 +166,21 @@ in
type = types.nullOr (types.enum [ "id" "extension" "relative_directory" "directory" "tabs" ]);
default = null;
};
indicator = mkOption {
default = null;
type = types.nullOr (types.submodule ({ ... }: {
options = {
icon = mkOption {
type = types.nullOr types.str;
default = null;
};
style = mkOption {
type = types.nullOr (types.enum [ "icon" "underline" "none" ]);
default = null;
};
};
}));
};
highlights = mkOption {
default = null;
type = types.nullOr (types.submodule ({ ... }: {
@ -241,7 +265,12 @@ in
right_mouse_command = cfg.rightMouseCommand;
left_mouse_command = cfg.leftMouseCommand;
middle_mouse_command = cfg.middleMouseCommand;
# deprecated, but might still work
indicator_icon = cfg.indicatorIcon;
indicator = {
icon = cfg.indicator.icon;
style = cfg.indicator.style;
};
buffer_close_icon = cfg.bufferCloseIcon;
modified_icon = cfg.modifiedIcon;
close_icon = cfg.closeIcon;