mirror of
https://github.com/zoriya/dotfiles.git
synced 2026-05-25 23:58:38 +00:00
Switch to plenary jobs
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
local Job = require'plenary.job'
|
||||
|
||||
local M = {}
|
||||
|
||||
M.pattern = "*.sln"
|
||||
@@ -16,8 +18,14 @@ M.list = function ()
|
||||
return ret
|
||||
end
|
||||
|
||||
M.build = function ()
|
||||
return "dotnet build"
|
||||
M.build = function (proj, opts)
|
||||
return Job:new(vim.tbl_deep_extend("force", opts, {
|
||||
command = "dotnet",
|
||||
args = {"build", proj},
|
||||
on_stdout = function(error, data)
|
||||
print(error, data)
|
||||
end,
|
||||
}))
|
||||
end
|
||||
|
||||
M.errorformat = [[%f(%l\,%c): %t%*[^ ] %m]]
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
local Job = require'plenary.job'
|
||||
local has_icon, nwicon = pcall(require, 'nvim-web-devicons')
|
||||
|
||||
local M = {
|
||||
adapters = {},
|
||||
projects = {},
|
||||
config = {
|
||||
height = 10,
|
||||
height = 15,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ M.select_proj = function (on_select)
|
||||
vim.fn.fnamemodify(proj.file, ':e'),
|
||||
{ default = true }
|
||||
) or " "
|
||||
return icon .. " " .. proj.name
|
||||
return icon .. " " .. proj.name, { {{0, 5}, "Comment"} }
|
||||
end
|
||||
}, function (proj)
|
||||
if not proj then return end
|
||||
@@ -63,13 +64,9 @@ M.build = function (post)
|
||||
M.select_proj(M.build)
|
||||
return
|
||||
end
|
||||
M._post_callback = post
|
||||
M._old_efm = vim.g.errorformat
|
||||
local old = vim.g.asyncrun_open
|
||||
vim.g.asyncrun_open = M.config.height
|
||||
vim.go.errorformat = proj.adapter.errorformat
|
||||
vim.cmd(":AsyncRun -post=lua\\ require('build').post_build() " .. proj.adapter.build(proj))
|
||||
vim.g.asyncrun_open = old
|
||||
proj.adapter.build(proj, {
|
||||
on_exit = post,
|
||||
}):start()
|
||||
end
|
||||
|
||||
M.run = function ()
|
||||
|
||||
Reference in New Issue
Block a user