mirror of https://github.com/folke/lazy.nvim.git
fix(util): dump
This commit is contained in:
parent
c501b429cf
commit
025520d083
|
@ -237,6 +237,8 @@ function M._dump(value, result)
|
||||||
table.insert(result, tostring(value))
|
table.insert(result, tostring(value))
|
||||||
elseif t == "string" then
|
elseif t == "string" then
|
||||||
table.insert(result, ("%q"):format(value))
|
table.insert(result, ("%q"):format(value))
|
||||||
|
elseif t == "table" and value._raw then
|
||||||
|
table.insert(result, value._raw)
|
||||||
elseif t == "table" then
|
elseif t == "table" then
|
||||||
table.insert(result, "{")
|
table.insert(result, "{")
|
||||||
local i = 1
|
local i = 1
|
||||||
|
@ -244,7 +246,11 @@ function M._dump(value, result)
|
||||||
for k, v in pairs(value) do
|
for k, v in pairs(value) do
|
||||||
if k == i then
|
if k == i then
|
||||||
elseif type(k) == "string" then
|
elseif type(k) == "string" then
|
||||||
|
if k:match("^[a-zA-Z]+$") then
|
||||||
|
table.insert(result, ("%s="):format(k))
|
||||||
|
else
|
||||||
table.insert(result, ("[%q]="):format(k))
|
table.insert(result, ("[%q]="):format(k))
|
||||||
|
end
|
||||||
else
|
else
|
||||||
table.insert(result, k .. "=")
|
table.insert(result, k .. "=")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue