mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-16 22:07:09 +09:00
Add support for job control
This commit adds support for job control (running processes asynchronously from plugins) with the JobStart, JobSend, and JobStop functions (copying neovim's job control). This commit also makes the linter plugin work asynchronously, so the editor won't be frozen while the linter checks your code for errors.
This commit is contained in:
@@ -34,9 +34,11 @@ end
|
||||
function linter_lint(linter, cmd, errorformat)
|
||||
CurView():ClearGutterMessages(linter)
|
||||
|
||||
local handle = io.popen("(" .. cmd .. ")" .. " 2>&1")
|
||||
local lines = linter_split(handle:read("*a"), "\n")
|
||||
handle:close()
|
||||
JobStart(cmd, "", "", "linter_onExit", linter, errorformat)
|
||||
end
|
||||
|
||||
function linter_onExit(output, linter, errorformat)
|
||||
local lines = linter_split(output, "\n")
|
||||
|
||||
local regex = errorformat:gsub("%%f", "(.+)"):gsub("%%l", "(%d+)"):gsub("%%m", "(.+)")
|
||||
for _,line in ipairs(lines) do
|
||||
|
||||
Reference in New Issue
Block a user