mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-11-12 16:35:30 +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.
|
syncing of nvim shell environment with direnv's.
|
||||||
- Add [blink.cmp] source options and some default-disabled sources.
|
- Add [blink.cmp] source options and some default-disabled sources.
|
||||||
- Add [blink.cmp] option to add
|
- Add [blink.cmp] option to add
|
||||||
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets) so
|
[friendly-snippets](https://github.com/rafamadriz/friendly-snippets)
|
||||||
blink.cmp can source snippets from it.
|
so blink.cmp can source snippets from it.
|
||||||
|
- Fix [blink.cmp] breaking when built-in sources were modified.
|
||||||
|
|
||||||
[TheColorman](https://github.com/TheColorman):
|
[TheColorman](https://github.com/TheColorman):
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,9 @@
|
||||||
freeformType = anything;
|
freeformType = anything;
|
||||||
options = {
|
options = {
|
||||||
module = mkOption {
|
module = mkOption {
|
||||||
type = str;
|
type = nullOr str;
|
||||||
description = "module of the provider";
|
default = null;
|
||||||
|
description = "Provider module.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -40,7 +41,7 @@ in {
|
||||||
providers = mkOption {
|
providers = mkOption {
|
||||||
type = attrsOf providerType;
|
type = attrsOf providerType;
|
||||||
default = {};
|
default = {};
|
||||||
description = "Settings for completion providers";
|
description = "Settings for completion providers.";
|
||||||
};
|
};
|
||||||
|
|
||||||
transform_items = mkOption {
|
transform_items = mkOption {
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.attrsets) attrValues filterAttrs;
|
inherit (lib.attrsets) attrValues filterAttrs mapAttrsToList;
|
||||||
inherit (lib.lists) map optional;
|
inherit (lib.lists) map optional elem;
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
|
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
|
||||||
|
|
||||||
|
|
@ -24,7 +24,22 @@
|
||||||
|
|
||||||
enabledBlinkSources = filterAttrs (_source: definition: definition.enable) cfg.sourcePlugins;
|
enabledBlinkSources = filterAttrs (_source: definition: definition.enable) cfg.sourcePlugins;
|
||||||
blinkSourcePlugins = map (definition: definition.package) (attrValues enabledBlinkSources);
|
blinkSourcePlugins = map (definition: definition.package) (attrValues enabledBlinkSources);
|
||||||
|
|
||||||
|
blinkBuiltins = [
|
||||||
|
"path"
|
||||||
|
"lsp"
|
||||||
|
"snippets"
|
||||||
|
"buffer"
|
||||||
|
"omni"
|
||||||
|
];
|
||||||
in {
|
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 {
|
vim = mkIf cfg.enable {
|
||||||
startPlugins = ["blink-compat"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets");
|
startPlugins = ["blink-compat"] ++ blinkSourcePlugins ++ (optional cfg.friendly-snippets.enable "friendly-snippets");
|
||||||
lazy.plugins = {
|
lazy.plugins = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue