Merge pull request #1054 from JManch/blink-cmp-fix-sources
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Treewide Checks / Validate flake (push) Has been cancelled
Treewide Checks / Check formatting (push) Has been cancelled
Treewide Checks / Check source tree for typos (push) Has been cancelled
Treewide Checks / Validate documentation builds (push) Has been cancelled
Treewide Checks / Validate hyperlinks in documentation sources (push) Has been cancelled
Treewide Checks / Validate Editorconfig conformance (push) Has been cancelled
Build and deploy documentation / Check latest commit (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled

fix(blink-cmp): Fix broken default sources
This commit is contained in:
raf 2025-08-07 10:48:38 +03:00 committed by GitHub
commit d61de135ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 10 deletions

View file

@ -486,3 +486,9 @@
- 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.

View file

@ -5,11 +5,12 @@
}: 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 elem;
inherit (lib.lists) map optional optionals elem;
inherit (lib.nvim.lua) toLuaObject;
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs;
inherit (builtins) concatStringsSep typeOf tryEval attrNames mapAttrs removeAttrs;
cfg = config.vim.autocomplete.blink-cmp;
cmpCfg = config.vim.autocomplete.nvim-cmp;
@ -55,7 +56,7 @@ in {
after =
# lua
''
${optionalString config.vim.lazy.enable
${optionalString (config.vim.lazy.enable && cmpCfg.enable)
(concatStringsSep "\n" (map
(package: "require('lz.n').trigger_load(${toLuaObject (getPluginName package)})")
cmpCfg.sourcePlugins))}
@ -66,7 +67,10 @@ in {
autocomplete = {
enableSharedCmpSources = true;
blink-cmp.setupOpts = {
sources = {
sources = let
# We do not want nvim-cmp compat sources overriding built-in blink sources
filteredCmpSources = removeAttrs cmpCfg.sources blinkBuiltins;
in {
default =
[
"lsp"
@ -74,14 +78,16 @@ in {
"snippets"
"buffer"
]
++ (attrNames cmpCfg.sources)
++ optionals cmpCfg.enable (attrNames filteredCmpSources)
++ (attrNames enabledBlinkSources);
providers =
mapAttrs (name: _: {
inherit name;
module = "blink.compat.source";
})
cmpCfg.sources
optionalAttrs cmpCfg.enable (
mapAttrs (name: _: {
inherit name;
module = "blink.compat.source";
})
filteredCmpSources
)
// (mapAttrs (name: definition: {
inherit name;
inherit (definition) module;