modified config
This commit is contained in:
@@ -18,12 +18,10 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
})
|
||||
|
||||
-- Build
|
||||
local function run_build_qf(cmd)
|
||||
local function run_build_qf(cmd_args)
|
||||
local lines = {}
|
||||
|
||||
vim.notify("Build started...", vim.log.levels.INFO, { title = "Build" })
|
||||
|
||||
vim.fn.jobstart(cmd, {
|
||||
local job_id = vim.fn.jobstart(cmd_args, {
|
||||
on_stdout = function(_, data)
|
||||
if data then
|
||||
for _, line in ipairs(data) do
|
||||
@@ -44,7 +42,7 @@ local function run_build_qf(cmd)
|
||||
end,
|
||||
on_exit = function(_, exit_code)
|
||||
vim.fn.setqflist({}, "r", {
|
||||
title = cmd,
|
||||
title = table.concat(cmd_args, " "),
|
||||
lines = lines,
|
||||
})
|
||||
|
||||
@@ -57,6 +55,12 @@ local function run_build_qf(cmd)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
if job_id <= 0 then
|
||||
vim.notify("Failed to start build process!", vim.log.levels.ERROR, { title = "Build" })
|
||||
else
|
||||
vim.notify("Build started...", vim.log.levels.INFO, { title = "Build" })
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_augroup("Build", { clear = true })
|
||||
@@ -73,9 +77,13 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
coroutine.wrap(function()
|
||||
local csproj = ShowSelectionPanel(cwd, "Select Project:", { "/**/*.csproj" })
|
||||
if csproj then
|
||||
local cmd = "dotnet build "
|
||||
.. vim.fn.fnameescape(csproj.path)
|
||||
.. " /p:GenerateFullPaths=true /consoleloggerparameters:NoSummary"
|
||||
local cmd = {
|
||||
"dotnet",
|
||||
"build",
|
||||
csproj.path,
|
||||
"/p:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary",
|
||||
}
|
||||
|
||||
run_build_qf(cmd)
|
||||
end
|
||||
@@ -86,9 +94,13 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
coroutine.wrap(function()
|
||||
local sln = ShowSelectionPanel(cwd, "Select Solution:", { "/**/*.slnx", "/**/*.sln" })
|
||||
if sln then
|
||||
local cmd = "dotnet build "
|
||||
.. vim.fn.fnameescape(sln.path)
|
||||
.. " /p:GenerateFullPaths=true /consoleloggerparameters:NoSummary"
|
||||
local cmd = {
|
||||
"dotnet",
|
||||
"build",
|
||||
vim.fn.fnameescape(sln.path),
|
||||
"/p:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary",
|
||||
}
|
||||
|
||||
run_build_qf(cmd)
|
||||
end
|
||||
@@ -98,7 +110,7 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
-- <leader>cb to generate T4 templates
|
||||
vim.keymap.set("n", "<leader>cb", function()
|
||||
local ttfile = vim.fn.expand("%:p")
|
||||
run_build_qf("t4 " .. vim.fn.fnameescape(ttfile))
|
||||
run_build_qf({ "t4", ttfile })
|
||||
end, { buffer = event.buf, desc = "Generate T4 Template" })
|
||||
end
|
||||
end,
|
||||
|
||||
Reference in New Issue
Block a user