File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -547,15 +547,24 @@ def _get_headers(compile_action, source_path: str):
547
547
# Cache for future use
548
548
if output_file :
549
549
os .makedirs (os .path .dirname (cache_file_path ), exist_ok = True )
550
- with open (cache_file_path , 'w' ) as cache_file :
551
- json .dump ((compile_action .actionKey , list (headers )), cache_file )
550
+ _cache_compile_action (compile_action , cache_file_path , headers )
552
551
553
552
if {exclude_headers } == "external" :
554
553
headers = {header for header in headers if _file_is_in_main_workspace_and_not_external (header )}
555
554
556
555
return headers
556
+
557
557
_get_headers .has_logged = False
558
558
559
+ def _cache_compile_action (compile_action , cache_file_path , headers ):
560
+ cache = (compile_action .actionKey , list (headers ))
561
+ try :
562
+ from orjson import dumps
563
+ with open (cache_file_path , 'wb' ) as cache_file :
564
+ cache_file .write (dumps (cache ))
565
+ except ImportError :
566
+ with open (cache_file_path , 'w' ) as cache_file :
567
+ json .dump (cache , cache_file )
559
568
560
569
def _get_files (compile_action ):
561
570
"""Gets the ({source files}, {header files}) clangd should be told the command applies to."""
You can’t perform that action at this time.
0 commit comments