Compare commits
2 Commits
d774c2867f
...
15d3879525
Author | SHA1 | Date | |
---|---|---|---|
15d3879525 | |||
fb2d661a0e |
@ -26,37 +26,41 @@ function build.set_dir(dirname)
|
|||||||
|
|
||||||
build.dir = build_dir
|
build.dir = build_dir
|
||||||
|
|
||||||
-- Invoke async function to avoid blocking the UI
|
echo('Processing compile_commands.json with compdb ...', 'DiagnosticInfo')
|
||||||
vim.schedule(function()
|
local compile_commands = current_dir .. '/compile_commands.json'
|
||||||
echo('Processing compile_commands.json with compdb ...', 'DiagnosticInfo')
|
-- Post-process compile_commands.json with compdb as an async job to avoid
|
||||||
|
-- blocking the user interface
|
||||||
|
vim.fn.jobstart(
|
||||||
|
'compdb -p ' .. build.dir .. ' list > ' .. compile_commands, {
|
||||||
|
|
||||||
-- Post-process compile_commands.json with compdb
|
-- Restart clangd language server
|
||||||
local compile_commands = current_dir .. '/compile_commands.json'
|
-- TODO: Configure cmake language server?
|
||||||
local output = vim.fn.systemlist(
|
on_exit = function()
|
||||||
'compdb -p ' .. build.dir .. ' list > ' .. compile_commands)
|
vim.cmd [[ LspRestart clangd ]]
|
||||||
|
echo('Build directory selected: ' .. dirname, 'DiagnosticInfo')
|
||||||
|
end,
|
||||||
|
|
||||||
-- Remove any lines containing a compdb warning
|
-- Display any error messages to the user
|
||||||
local error = {}
|
on_stderr = function(_, output, _)
|
||||||
local warning = 'WARNING:compdb'
|
-- Remove any lines containing a compdb warning
|
||||||
for _, line in ipairs(output) do
|
local error = {}
|
||||||
if string.sub(line, 1, #warning) ~= warning then
|
local warning = 'WARNING:compdb'
|
||||||
table.insert(error, line)
|
for _, line in ipairs(output) do
|
||||||
end
|
if string.sub(line, 1, #warning) ~= warning then
|
||||||
end
|
table.insert(error, line)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Display the error message if there was one
|
-- Display the error message if there was one
|
||||||
if table.maxn(error) > 0 then
|
if table.maxn(error) > 0 then
|
||||||
echo(vim.fn.join(error, '\n'), 'Error')
|
echo(vim.fn.join(error, '\n'), 'Error')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
-- TODO: Configure cmake language server?
|
stderr_buffered = true,
|
||||||
|
}
|
||||||
-- Restart clangd language server
|
)
|
||||||
vim.cmd [[ LspRestart clangd ]]
|
|
||||||
|
|
||||||
echo('Build directory selected: ' .. dirname, 'DiagnosticInfo')
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function build.select_dir(callback)
|
function build.select_dir(callback)
|
||||||
|
@ -43,7 +43,3 @@ vim.keymap.set('n', 'Q', '<nop>', {noremap = true})
|
|||||||
|
|
||||||
-- Undo neovim's default mapping of Y to y$
|
-- Undo neovim's default mapping of Y to y$
|
||||||
vim.cmd('unmap Y')
|
vim.cmd('unmap Y')
|
||||||
|
|
||||||
-- Move visually selected blocks around
|
|
||||||
vim.keymap.set('v', 'J', ":move '>+1<CR>gv=gv'")
|
|
||||||
vim.keymap.set('v', 'K', ":move '<-2<CR>gv=gv'")
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user