summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2024-11-20 16:59:08 -0500
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2024-11-20 16:59:08 -0500
commite86613af7ee5af1cd53373e29869b5e67016805c (patch)
tree6b733248d1aa06a876fb7a4741852fe9f7d16049 /tools
parent3bdcd429444f1c935a858775fb665275e1af953f (diff)
Add workaround to fix clangd not being able to perform cross-file renames on Windows
Diffstat (limited to 'tools')
-rw-r--r--tools/project.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/project.py b/tools/project.py
index f1539647..3ae00dd3 100644
--- a/tools/project.py
+++ b/tools/project.py
@@ -1672,7 +1672,15 @@ def generate_compile_commands(
def default_format(o):
if isinstance(o, Path):
- return o.resolve().as_posix()
+ path_str = o.resolve().as_posix()
+ if os.name == "nt":
+ # clangd has an issue dealing with case-insensitive paths on Windows.
+ # If the drive letter of a path is a capital letter, clangd will fail to handle
+ # cross-file rename operations, so we have to convert the first character of the
+ # path to lowercase as a workaround.
+ # https://github.com/clangd/clangd/issues/108
+ path_str = path_str[0].lower() + path_str[1:]
+ return path_str
return str(o)
json.dump(clangd_config, w, indent=2, default=default_format)