diff options
| author | chooyy <[email protected]> | 2026-06-24 14:12:54 +0800 |
|---|---|---|
| committer | chooyy <[email protected]> | 2026-06-24 14:12:54 +0800 |
| commit | 8d706cb5bb681a2a06492ded4dd81faf6c5249e5 (patch) | |
| tree | de2129635c3d7b1020eb51ad0c87eaaf8e980163 /xmake/plugins/project | |
| parent | bcd6a836dd03db0418a6f5c604d63c96f887483a (diff) | |
workaround for clangd drive letter casing issue
Diffstat (limited to 'xmake/plugins/project')
| -rw-r--r-- | xmake/plugins/project/clang/compile_commands.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/xmake/plugins/project/clang/compile_commands.lua b/xmake/plugins/project/clang/compile_commands.lua index e38c1cef1..db759f54c 100644 --- a/xmake/plugins/project/clang/compile_commands.lua +++ b/xmake/plugins/project/clang/compile_commands.lua @@ -210,12 +210,16 @@ function _make_arguments(jsonfile, arguments, opt) end -- make body + local projectdir = os.projectdir() + if is_host("windows") then -- workaround for drive letter casing issue, can be removed when cland resolves https://github.com/clangd/vscode-clangd/pull/747 + projectdir = projectdir:gsub("^([A-Z]):", function(d) return d:lower() .. ":" end) + end jsonfile:printf( [[%s{ "directory": "%s", "arguments": ["%s"], "file": "%s" -}]], (_g.firstline and "" or ",\n"), _escape_path(os.projectdir()), table.concat(arguments_escape, "\", \""), _escape_path(sourcefile)) +}]], (_g.firstline and "" or ",\n"), _escape_path(projectdir), table.concat(arguments_escape, "\", \""), _escape_path(sourcefile)) -- clear first line marks _g.firstline = false |
