Compare commits
2 Commits
d774c2867f
...
15d3879525
Author | SHA1 | Date | |
---|---|---|---|
15d3879525 | |||
fb2d661a0e |
@ -26,15 +26,22 @@ function build.set_dir(dirname)
|
||||
|
||||
build.dir = build_dir
|
||||
|
||||
-- Invoke async function to avoid blocking the UI
|
||||
vim.schedule(function()
|
||||
echo('Processing compile_commands.json with compdb ...', 'DiagnosticInfo')
|
||||
|
||||
-- Post-process compile_commands.json with compdb
|
||||
local compile_commands = current_dir .. '/compile_commands.json'
|
||||
local output = vim.fn.systemlist(
|
||||
'compdb -p ' .. build.dir .. ' list > ' .. compile_commands)
|
||||
-- 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, {
|
||||
|
||||
-- Restart clangd language server
|
||||
-- TODO: Configure cmake language server?
|
||||
on_exit = function()
|
||||
vim.cmd [[ LspRestart clangd ]]
|
||||
echo('Build directory selected: ' .. dirname, 'DiagnosticInfo')
|
||||
end,
|
||||
|
||||
-- Display any error messages to the user
|
||||
on_stderr = function(_, output, _)
|
||||
-- Remove any lines containing a compdb warning
|
||||
local error = {}
|
||||
local warning = 'WARNING:compdb'
|
||||
@ -49,14 +56,11 @@ function build.set_dir(dirname)
|
||||
echo(vim.fn.join(error, '\n'), 'Error')
|
||||
return
|
||||
end
|
||||
end,
|
||||
|
||||
-- TODO: Configure cmake language server?
|
||||
|
||||
-- Restart clangd language server
|
||||
vim.cmd [[ LspRestart clangd ]]
|
||||
|
||||
echo('Build directory selected: ' .. dirname, 'DiagnosticInfo')
|
||||
end)
|
||||
stderr_buffered = true,
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
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$
|
||||
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