mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-04-27 11:55:22 +00:00
chore: add language.<name>.lsp.servers deprecation information
This commit is contained in:
parent
a3aa4e49d1
commit
ec8a66bb3c
16 changed files with 126 additions and 33 deletions
|
|
@ -1,9 +1,9 @@
|
|||
{lib}: let
|
||||
inherit (builtins) toJSON;
|
||||
inherit (builtins) toJSON attrNames;
|
||||
inherit (lib.options) mergeEqualOption;
|
||||
inherit (lib.lists) singleton;
|
||||
inherit (lib.strings) isString stringLength match;
|
||||
inherit (lib.types) listOf mkOptionType coercedTo;
|
||||
inherit (lib.types) listOf mkOptionType coercedTo enum;
|
||||
inherit (lib.trivial) warn;
|
||||
in {
|
||||
mergelessListOf = elemType:
|
||||
|
|
@ -39,4 +39,28 @@ in {
|
|||
''
|
||||
(singleton x))
|
||||
(listOf t);
|
||||
|
||||
# Create an enum type for `values`, which additionally accepts deprecated
|
||||
# values listed in the `renames` attrset as `old = new` pairs.
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# vim.languages.typescript.lsp.servers = mkOption {
|
||||
# type = renamedEnum
|
||||
# "vim.languages.typescript.lsp.servers"
|
||||
# ["typescript-language-server" "some-other-server"]
|
||||
# { ts_ls = "typescript-language-server"; };
|
||||
# }
|
||||
#
|
||||
# With this option definition, when users enter `ts_ls`, they
|
||||
# get a warning "`ts_ls` is deprecated, use `typescript-language-server`
|
||||
# instead", and typescript-language-server is automatically used.
|
||||
enumWithRename = option: values: renames:
|
||||
coercedTo (enum (attrNames renames)) (
|
||||
old:
|
||||
warn
|
||||
"${option}: `${old}` is deprecated, use `${renames.${old}}` instead"
|
||||
renames.${old}
|
||||
)
|
||||
(enum values);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue