File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,6 +101,20 @@ def write_compile_commands(compile_commands, output_file='compile_commands.json'
101101 except IOError as e :
102102 print (f"Failed to write to { output_file } file: { e } " )
103103
104+ def create_clangd_directory ():
105+ """
106+ 创建.clamd文件夹并写入.gitignore文件
107+ """
108+ clangd_dir = os .path .join ('.' , '.clangd' )
109+ try :
110+ os .makedirs (clangd_dir , exist_ok = True )
111+ gitignore_path = os .path .join (clangd_dir , '.gitignore' )
112+ with open (gitignore_path , 'w' , encoding = 'utf-8' ) as f :
113+ f .write ('*' )
114+ print ("Successfully created .clangd directory and .gitignore file" )
115+ except Exception as e :
116+ print (f"Failed to create .clangd directory or .gitignore file: { e } " )
117+
104118
105119def get_clangd_query_driver ():
106120 """获取clangd的query-driver路径"""
@@ -152,3 +166,4 @@ def find_compiler_in_settings(settings_path):
152166
153167 compile_info = parse_keil_project (keil_project_file )
154168 write_compile_commands (compile_info )
169+ create_clangd_directory ()
You can’t perform that action at this time.
0 commit comments