Skip to content

Commit

Permalink
Can pass two value
Browse files Browse the repository at this point in the history
  • Loading branch information
uga-rosa committed Jan 21, 2024
1 parent 54be2f4 commit 96b608b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lua/cmp_dictionary/dict/trie.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ function M:update(paths, force)
for word in vim.gsplit(data, "\r?\n", { trimempty = true }) do
trie:insert(word)
end
return buffer.encode({ path = path, trie = trie })
return path, buffer.encode(trie)
---@diagnostic enable
end, function(encoded)
local obj = buffer.decode(encoded)
---@cast obj { path: string, trie: Trie }
self.trie_map[obj.path] = setmetatable(obj.trie, { __index = Trie })
end, function(path, encoded_trie)
local trie = buffer.decode(encoded_trie) --[[@as Trie]]
self.trie_map[path] = setmetatable(trie, { __index = Trie })
end)

for _, path in ipairs(paths) do
Expand Down

0 comments on commit 96b608b

Please sign in to comment.