fix: change global config to default option
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
local Trans = require('Trans')
|
||||
local M = Trans.metatable('backend')
|
||||
local conf = Trans.conf
|
||||
|
||||
--- INFO :Parse online engine keys config file
|
||||
local path = Trans.conf.dir .. '/Trans.json'
|
||||
local path = conf.dir .. '/Trans.json'
|
||||
local file = io.open(path, "r")
|
||||
|
||||
if file then
|
||||
@@ -14,19 +15,12 @@ if file then
|
||||
end
|
||||
|
||||
|
||||
|
||||
local default_opts = vim.deepcopy(Trans.conf.backend)
|
||||
for name, private_opts in pairs(result or {}) do
|
||||
local opts = vim.tbl_extend('keep', Trans.conf.backend[name] or {}, default_opts, private_opts)
|
||||
|
||||
local backend = M[name]
|
||||
local opts = vim.tbl_extend('keep', conf.backend[name] or {}, conf.backend.default, private_opts)
|
||||
for k, v in pairs(opts) do
|
||||
if not backend[k] then
|
||||
backend[k] = v
|
||||
end
|
||||
M[name][k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
Reference in New Issue
Block a user