We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 60967ec commit 4f6026aCopy full SHA for 4f6026a
1 file changed
modules/compilecommands/_preload.lua
@@ -88,6 +88,23 @@ newaction {
88
elseif f ~= 0 then
89
printf("Generated %s...", path.getrelative(os.getcwd(), output_path))
90
end
91
+
92
+ -- clangd relies on the "directory" entries in compile_commands.json to exist in order to properly
93
+ -- resolve relative paths. This is to ensure that the compilecommands action generates them.
94
+ local paths_to_generate = {}
95
+ for _, cmd in ipairs(all_commands) do
96
+ local dir = cmd.directory
97
+ if dir and not os.isdir(dir) then
98
+ paths_to_generate[dir] = true
99
+ end
100
101
102
+ for dir, _ in pairs(paths_to_generate) do
103
+ local ok, err = os.mkdir(dir)
104
+ if not ok then
105
+ error(err, 0)
106
107
108
109
}
110
0 commit comments