fix: hidden entries not showing up in the candidate list

`include_hidden` variable was accessed out of scope.
This commit is contained in:
Hoang Nguyen 2024-02-12 00:00:00 +07:00
parent 9d581eec5a
commit dda6ddb1df
No known key found for this signature in database
GPG Key ID: B0567C20730E9B11

View File

@ -117,13 +117,13 @@ source._candidates = function(_, dirname, include_hidden, option, callback)
end
local work
work = assert(vim.loop.new_work(function(_entries, _dirname,
work = assert(vim.loop.new_work(function(_entries, _dirname, _include_hidden,
label_trailing_slash, trailing_slash,
file_kind, folder_kind)
local items = {}
local function create_item(name, fs_type)
if not (include_hidden or string.sub(name, 1, 1) ~= '.') then
if not (_include_hidden or string.sub(name, 1, 1) ~= '.') then
return
end
@ -189,7 +189,7 @@ source._candidates = function(_, dirname, include_hidden, option, callback)
callback(nil, items)
end))
work:queue(entries, dirname, option.label_trailing_slash,
work:queue(entries, dirname, include_hidden, option.label_trailing_slash,
option.trailing_slash, cmp.lsp.CompletionItemKind.File,
cmp.lsp.CompletionItemKind.Folder)