diff --git a/.gitignore b/.gitignore index b48762b3cf15..166279f9de7a 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ ID # User files that may appear at the root /.clang-tidy +/.clangd /.mozconfig* /mozconfig* /old-configure diff --git a/.hgignore b/.hgignore index a60e256e58b3..318cfb8772e1 100644 --- a/.hgignore +++ b/.hgignore @@ -33,6 +33,7 @@ compile_commands\.json # User files that may appear at the root ^\.clang-tidy +^\.clangd ^\.mozconfig ^mozconfig* ^\.moz-fast-forward diff --git a/python/mozbuild/mozbuild/backend/mach_commands.py b/python/mozbuild/mozbuild/backend/mach_commands.py index 51552c6c9a23..7190e7dd1d11 100644 --- a/python/mozbuild/mozbuild/backend/mach_commands.py +++ b/python/mozbuild/mozbuild/backend/mach_commands.py @@ -299,11 +299,18 @@ def setup_clangd_rust_in_vscode(command_context): with open(".clang-tidy", "w") as file: yaml.dump(clang_tidy, file) + clangd_cfg = { + "CompileFlags": { + "CompilationDatabase": clangd_cc_path, + } + } + + with open(".clangd", "w") as file: + yaml.dump(clangd_cfg, file) + return { "clangd.path": clangd_path, "clangd.arguments": [ - "--compile-commands-dir", - clangd_cc_path, "-j", str(multiprocessing.cpu_count() // 2), "--limit-results",