diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index d2a1a098..21e655d2 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -486,9 +486,3 @@ - Add [nvim-biscuits] to show block context. Available at `vim.utility.nvim-biscuits`. - -[JManch](https://github.com/JManch): - -- Fix default [blink.cmp] sources "path" and "buffer" not working when - `autocomplete.nvim-cmp.enable` was disabled and - `autocomplete.nvim-cmp.sources` had not been modified. diff --git a/modules/plugins/completion/blink-cmp/config.nix b/modules/plugins/completion/blink-cmp/config.nix index 5789c514..2efd8d79 100644 --- a/modules/plugins/completion/blink-cmp/config.nix +++ b/modules/plugins/completion/blink-cmp/config.nix @@ -5,12 +5,11 @@ }: let inherit (lib.modules) mkIf; inherit (lib.strings) optionalString; - inherit (lib.attrsets) optionalAttrs; inherit (lib.generators) mkLuaInline; inherit (lib.attrsets) attrValues filterAttrs mapAttrsToList; - inherit (lib.lists) map optional optionals elem; + inherit (lib.lists) map optional elem; inherit (lib.nvim.lua) toLuaObject; - inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs removeAttrs; + inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs; cfg = config.vim.autocomplete.blink-cmp; cmpCfg = config.vim.autocomplete.nvim-cmp; @@ -56,7 +55,7 @@ in { after = # lua '' - ${optionalString (config.vim.lazy.enable && cmpCfg.enable) + ${optionalString config.vim.lazy.enable (concatStringsSep "\n" (map (package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})") cmpCfg.sourcePlugins))} @@ -67,10 +66,7 @@ in { autocomplete = { enableSharedCmpSources = true; blink-cmp.setupOpts = { - sources = let - # We do not want nvim-cmp compat sources overriding built-in blink sources - filteredCmpSources = removeAttrs cmpCfg.sources blinkBuiltins; - in { + sources = { default = [ "lsp" @@ -78,16 +74,14 @@ in { "snippets" "buffer" ] - ++ optionals cmpCfg.enable (attrNames filteredCmpSources) + ++ (attrNames cmpCfg.sources) ++ (attrNames enabledBlinkSources); providers = - optionalAttrs cmpCfg.enable ( - mapAttrs (name: _: { - inherit name; - module = "blink.compat.source"; - }) - filteredCmpSources - ) + mapAttrs (name: _: { + inherit name; + module = "blink.compat.source"; + }) + cmpCfg.sources // (mapAttrs (name: definition: { inherit name; inherit (definition) module;