From 616a578e84d5b0de87361b7414669593f22e1181 Mon Sep 17 00:00:00 2001 From: "David Z. Chen" Date: Sun, 16 Jun 2024 13:06:45 -0700 Subject: [PATCH] Apply patch from #199. --- refresh.template.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/refresh.template.py b/refresh.template.py index 3b33701..ecdfdac 100644 --- a/refresh.template.py +++ b/refresh.template.py @@ -614,6 +614,10 @@ def _get_files(compile_action): """Gets the ({source files}, {header files}) clangd should be told the command applies to.""" # Getting the source file is a little trickier than it might seem. + is_precompiled_header = any([arg == "-xc++-header" for arg in compile_action.arguments]) + if is_precompiled_header: + header_files = [arg for arg in compile_action.arguments if not arg.startswith('-') and arg.endswith(".h")] + return set(), set(header_files) # First, we do the obvious thing: Filter args to those that look like source files. source_file_candidates = [arg for arg in compile_action.arguments if not arg.startswith('-') and arg.endswith(_get_files.source_extensions)]