Skip to content

Commit

Permalink
Use vim.json to serialize
Browse files Browse the repository at this point in the history
related: #58
  • Loading branch information
uga-rosa committed Jan 24, 2024
1 parent 5374e33 commit 51c48f9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lua/cmp_dictionary/dict/trie.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
local buffer = require("string.buffer")
local Trie = require("cmp_dictionary.lib.trie")
local uv = vim.uv or vim.loop

Expand Down Expand Up @@ -39,10 +38,10 @@ function M:update(paths, force)
for word in vim.gsplit(data, "\r?\n", { trimempty = true }) do
trie:insert(word)
end
return path, buffer.encode(trie)
return path, vim.json.encode(trie)
---@diagnostic enable
end, function(path, encoded_trie)
local trie = buffer.decode(encoded_trie) --[[@as Trie]]
local trie = vim.json.decode(encoded_trie) --[[@as Trie]]
self.trie_map[path] = setmetatable(trie, { __index = Trie })
end)

Expand Down

0 comments on commit 51c48f9

Please sign in to comment.