From d068e8a4c4f54da17dc964b1329b0d98c4b59149 Mon Sep 17 00:00:00 2001 From: ruki Date: Tue, 14 Mar 2023 00:38:42 +0800 Subject: improve compile_commands extraconf --- xmake/rules/plugin/compile_commands/xmake.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/xmake/rules/plugin/compile_commands/xmake.lua b/xmake/rules/plugin/compile_commands/xmake.lua index 57514a768..9e44eb631 100644 --- a/xmake/rules/plugin/compile_commands/xmake.lua +++ b/xmake/rules/plugin/compile_commands/xmake.lua @@ -21,7 +21,7 @@ -- update compile_commandss.json automatically -- -- @code --- add_rules("plugin.compile_commands.autoupdate", {outputdir = ".vscode"}) +-- add_rules("plugin.compile_commands.autoupdate", {outputdir = ".vscode", lsp = "clangd"}) -- target("test") -- set_kind("binary") -- add_files("src/*.c") @@ -48,10 +48,8 @@ rule("plugin.compile_commands.autoupdate") for _, target in pairs(project.targets()) do table.join2(sourcefiles, target:sourcefiles(), target:headerfiles()) local extraconf = target:extraconf("rules", "plugin.compile_commands.autoupdate") - if extraconf and extraconf.outputdir then + if extraconf then outputdir = extraconf.outputdir - end - if extraconf and extraconf.lsp then lsp = extraconf.lsp end end -- cgit v1.3.1