Skip to content

Commit ecb3520

Browse files
authored
fix: only check enabled fallback sources (#232)
1 parent 76d11a6 commit ecb3520

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lua/blink/cmp/sources/lib/context.lua

+5-6
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,11 @@ end
7171
function sources_context:get_completions_for_sources(sources, context)
7272
local enabled_sources = vim.tbl_keys(sources)
7373
--- @type blink.cmp.SourceProvider[]
74-
local non_fallback_sources = vim.tbl_filter(
75-
function(source)
76-
return source.config.fallback_for == nil or #source.config.fallback_for(context, enabled_sources) == 0
77-
end,
78-
vim.tbl_values(sources)
79-
)
74+
local non_fallback_sources = vim.tbl_filter(function(source)
75+
local fallbacks = source.config.fallback_for and source.config.fallback_for(context, enabled_sources) or {}
76+
fallbacks = vim.tbl_filter(function(fallback) return sources[fallback] end, fallbacks)
77+
return #fallbacks == 0
78+
end, vim.tbl_values(sources))
8079

8180
-- get completions for each non-fallback source
8281
local tasks = vim.tbl_map(function(source)

0 commit comments

Comments
 (0)