Open svvac opened 2 years ago
The following patch works around the issue by manually escaping the plugin names in the output object, but it's rather brittle, and still relies on vim.inspect
for the plugin configs:
-- Crude `vim.inspect` replacement that unconditionnaly escapes plugin names to avoid invalid keys such as lua keywords
-- Assumes the plugin objects are properly serialized by vim.inspect
local out = '{\n'
for k, v in pairs(result) do
-- indent:
local objstr = table.concat(vim.split(vim.inspect(v), '\n'), '\n ')
local objkeystr = ' [' .. string.format('%q', k) .. '] = ' .. objstr .. ',\n'
out = out .. objkeystr
end
out = out .. '}'
return out
nvim
v0.7.2
packer
90b323bccc04ad9b23c971a85813a1405c7725a8Using a plugin name that is a reserved word in lua breaks the
packer_compiled.lua
file.This appears to be due to using the builtin
vim.inspect
as a means to stringify a table as lua code, however its output is not guaranteed to be deserializable as valid lua code.https://github.com/wbthomason/packer.nvim/blob/3a9f9801f683946b9f1047d8f4bf9946c29e927d/lua/packer/compile.lua#L178