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)]