mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-04-15 00:58:37 +00:00
completion/blink: don't break when modifying built-in sources.providers (#683)
Some checks failed
Check for typos in the source tree / check-typos (push) Has been cancelled
Some checks failed
Check for typos in the source tree / check-typos (push) Has been cancelled
This commit is contained in:
parent
fc520fa1ab
commit
1d7c27abd9
3 changed files with 24 additions and 7 deletions
|
@ -228,8 +228,9 @@
|
|||
syncing of nvim shell environment with direnv's.
|
||||
- Add [blink.cmp] source options and some default-disabled sources.
|
||||
- Add [blink.cmp] option to add
|
||||
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so
|
||||
blink.cmp can source snippets from it.
|
||||
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets)
|
||||
so blink.cmp can source snippets from it.
|
||||
- Fix [blink.cmp] breaking when built-in sources were modified.
|
||||
|
||||
[TheColorman](https://github.com/TheColorman):
|
||||
|
||||
|
|
|
@ -21,8 +21,9 @@
|
|||
freeformType = anything;
|
||||
options = {
|
||||
module = mkOption {
|
||||
type = str;
|
||||
description = "module of the provider";
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
description = "Provider module.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -40,7 +41,7 @@ in {
|
|||
providers = mkOption {
|
||||
type = attrsOf providerType;
|
||||
default = {};
|
||||
description = "Settings for completion providers";
|
||||
description = "Settings for completion providers.";
|
||||
};
|
||||
|
||||
transform_items = mkOption {
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.generators) mkLuaInline;
|
||||
inherit (lib.attrsets) attrValues filterAttrs;
|
||||
inherit (lib.lists) map optional;
|
||||
inherit (lib.attrsets) attrValues filterAttrs mapAttrsToList;
|
||||
inherit (lib.lists) map optional elem;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
|
||||
|
||||
|
@ -24,7 +24,22 @@
|
|||
|
||||
enabledBlinkSources = filterAttrs (_source: definition: definition.enable) cfg.sourcePlugins;
|
||||
blinkSourcePlugins = map (definition: definition.package) (attrValues enabledBlinkSources);
|
||||
|
||||
blinkBuiltins = [
|
||||
"path"
|
||||
"lsp"
|
||||
"snippets"
|
||||
"buffer"
|
||||
"omni"
|
||||
];
|
||||
in {
|
||||
assertions =
|
||||
mapAttrsToList (provider: definition: {
|
||||
assertion = elem provider blinkBuiltins || definition.module != null;
|
||||
message = "`config.vim.autocomplete.blink-cmp.setupOpts.sources.providers.${provider}.module` is `null`: non-builtin providers must set `module`.";
|
||||
})
|
||||
cfg.setupOpts.sources.providers;
|
||||
|
||||
vim = mkIf cfg.enable {
|
||||
startPlugins = ["blink-compat"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets");
|
||||
lazy.plugins = {
|
||||
|
|
Loading…
Add table
Reference in a new issue