Adding config for the build tool

This commit is contained in:
Zoe Roux
2022-03-20 22:02:11 +01:00
parent 51d3f6c7b2
commit c31adc2fa0
3 changed files with 23 additions and 4 deletions
@@ -3,13 +3,13 @@ local M = {}
M.pattern = "*.sln"
M.list = function ()
-- broken
local projs = io.popen("dotnet sln list | tail -n +3")
local ret = {}
for line in projs:lines() do
table.insert(ret, {
name = line:match("([^/]+).csproj$"),
file = line,
icon = "",
})
end
projs:close()
+20 -1
View File
@@ -2,10 +2,18 @@ local has_icon, nwicon = pcall(require, 'nvim-web-devicons')
local M = {
adapters = {},
projects = {},
config = {
runner = "AsyncRun",
},
}
table.insert(M.adapters, require "build.adapters.dotnet")
M.setup = function (config)
M.config = vim.tbl_deep_extend('keep', M.config, config)
end
-- https://stackoverflow.com/questions/49907620/how-to-fuse-array-in-lua
local function concatArray(a, b)
local result = {unpack(a)}
@@ -37,9 +45,20 @@ M.select_proj = function ()
return icon .. " " .. proj.name
end
}, function (proj)
M.projects[vim.fn.getcwd()] = proj
if M.config.on_select then
M.config.on_select()
end
end)
end
M.get_project = function ()
return M.projects[vim.fn.getcwd()]
end
M.build = function ()
vim.cmd(M.config.runner .. " " .. M.get_project().adapter.build())
end
return M
+2 -2
View File
@@ -116,8 +116,8 @@ return packer.startup(function(use)
use { "lewis6991/gitsigns.nvim", requires = { 'nvim-lua/plenary.nvim' } }
use "tpope/vim-dispatch"
use "skywind3000/asyncrun.vim"
use "datamadsen/vim-compiler-plugin-for-dotnet"
if PACKER_BOOTSTRAP then