diff options
| author | ruki <[email protected]> | 2026-06-24 22:27:37 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-06-24 22:27:37 +0800 |
| commit | c8eecb9e08362dc1cbd1686a74f23e38c7c21bc4 (patch) | |
| tree | 0e179b46c42eea5cc48b7b5cd9056b9d97b0c3c4 | |
| parent | 44711c34a5bfcb192df4985a30e4dfb1c4441c23 (diff) | |
| parent | 4aab79c8e91e7ed2c0cf1ae033b6de1a212ea431 (diff) | |
Merge pull request #7619 from choyy/clangd-casing-issue
workaround for clangd drive letter casing issue
| -rw-r--r-- | xmake/plugins/project/clang/compile_commands.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/xmake/plugins/project/clang/compile_commands.lua b/xmake/plugins/project/clang/compile_commands.lua index e38c1cef1..2f25194cc 100644 --- a/xmake/plugins/project/clang/compile_commands.lua +++ b/xmake/plugins/project/clang/compile_commands.lua @@ -210,12 +210,17 @@ function _make_arguments(jsonfile, arguments, opt) end -- make body + local projectdir = os.projectdir() + -- workaround for drive letter casing issue, can be removed when clangd resolves https://github.com/clangd/vscode-clangd/pull/747 + if is_host("windows") and (lsp == nil or lsp == "clangd") then + projectdir = projectdir:gsub("^[A-Z]:", string.lower) + 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 |
