diff options
| author | shaqtsui <[email protected]> | 2023-03-13 21:05:53 +0800 |
|---|---|---|
| committer | shaqtsui <[email protected]> | 2023-03-13 21:05:53 +0800 |
| commit | 5c1381bf26478008735e8d646f19058e8c3c9c92 (patch) | |
| tree | ed5a4230b07f6a063de77edd937fb0f2cd589e45 /xmake/rules/plugin | |
| parent | f7402903d2c94766c490c42809f46ac8577c6d22 (diff) | |
plugin.compile_commands.autoupdate support lsp option
Diffstat (limited to 'xmake/rules/plugin')
| -rw-r--r-- | xmake/rules/plugin/compile_commands/xmake.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/xmake/rules/plugin/compile_commands/xmake.lua b/xmake/rules/plugin/compile_commands/xmake.lua index f32468959..51d1f712f 100644 --- a/xmake/rules/plugin/compile_commands/xmake.lua +++ b/xmake/rules/plugin/compile_commands/xmake.lua @@ -43,6 +43,7 @@ rule("plugin.compile_commands.autoupdate") local lockfile = io.openlock(tmpfile .. ".lock") if lockfile:trylock() then local outputdir + local lsp local sourcefiles = {} for _, target in pairs(project.targets()) do table.join2(sourcefiles, target:sourcefiles(), target:headerfiles()) @@ -50,13 +51,16 @@ rule("plugin.compile_commands.autoupdate") if extraconf and extraconf.outputdir then outputdir = extraconf.outputdir end + if extraconf and extraconf.lsp then + lsp = extraconf.lsp + end end table.sort(sourcefiles) depend.on_changed(function () -- we use task instead of os.exec("xmake") to avoid the project lock local filename = "compile_commands.json" local filepath = outputdir and path.join(outputdir, filename) or filename - task.run("project", {kind = "compile_commands", outputdir = outputdir}) + task.run("project", {kind = "compile_commands", outputdir = outputdir, lsp = lsp}) print("compile_commands.json updated!") end, {dependfile = dependfile, files = project.allfiles(), |
