From f49f56d043d718c84e753f17b32e60a3ed5b83c8 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Wed, 13 Mar 2024 20:15:41 +0000 Subject: [PATCH] Ignore warnings from compdb in :BuildDir --- lua/build.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lua/build.lua b/lua/build.lua index 8e32593..134c8a4 100644 --- a/lua/build.lua +++ b/lua/build.lua @@ -34,8 +34,19 @@ function build.set_dir(dirname) local compile_commands = current_dir .. '/compile_commands.json' local output = vim.fn.systemlist( 'compdb -p ' .. build.dir .. ' list > ' .. compile_commands) - if table.maxn(output) > 0 then - echo(vim.fn.join(output, '\n'), 'Error') + + -- Remove any lines containing a compdb warning + local error = {} + local warning = 'WARNING:compdb' + for _, line in ipairs(output) do + if string.sub(line, 1, #warning) ~= warning then + table.insert(error, line) + end + end + + -- Display the error message if there was one + if table.maxn(error) > 0 then + echo(vim.fn.join(error, '\n'), 'Error') return end