I've frequently found this error when writing new tests. I forgot to close a function() with its corresponding end clause, and suddenly telescope just explodes:
telescope.lua:301: Test_spec.lua:104: '<eof>' expected near 'end'
Telescope.lua:301 currently says:
local func = assert(loadfile(path))
setfenv(func, env)()
loadfile detects a syntax error on path, and this error goes 'up' until telescope crashes.
I suggest wrapping that loadfile with function() and pcall so telescope is a bit more resilient. Something similar to this:
local func = function() assert(loadfile(path)) end
setfenv(func, env)
local status, errmsg = pcall(func)
if status == false then -- indicate that there was a syntax error on the path
else -- regular treatment of path here
I've frequently found this error when writing new tests. I forgot to close a function() with its corresponding end clause, and suddenly telescope just explodes:
Telescope.lua:301 currently says:
loadfile detects a syntax error on path, and this error goes 'up' until telescope crashes.
I suggest wrapping that loadfile with function() and pcall so telescope is a bit more resilient. Something similar to this: