Skip to content
This repository was archived by the owner on Feb 19, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/neuron/cmd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function M.new_edit(neuron_dir)
command = "neuron",
args = {"new"},
cwd = neuron_dir,
-- on_stderr = utils.on_stderr_factory("neuron new"),
on_stderr = utils.on_stderr_factory("neuron new"),
interactive = false,
on_exit = vim.schedule_wrap(
function(job, return_val)
Expand Down
17 changes: 16 additions & 1 deletion lua/neuron/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,26 @@ function M.path_from_id(id, neuron_dir, callback)
}:start()
end

local fake_errors = {
[[%s*Plugins enabled:]],
[[%s*Loading directory tree]],
[[%s*Building graph]]
}

function M.is_an_error(data)
for i=1,#fake_errors do
if data:match(fake_errors[i]) then
return false
end
end
return true
end

function M.on_stderr_factory(name)
return vim.schedule_wrap(
function(error, data)
assert(not error, error)
if data ~= nil then
if data ~= nil and M.is_an_error(data) then
vim.cmd(string.format("echoerr 'An error occured from running %s: %s'", name, data))
end
end
Expand Down