@@ -30,26 +30,6 @@ def generate(self):
30
30
"""Generate Makefile and VSCode launch and task files
31
31
"""
32
32
super (VSCode , self ).generate ()
33
- ctx = {
34
- 'name' : self .project_name ,
35
- 'elf_location' : join ('BUILD' , self .project_name )+ '.elf' ,
36
- 'c_symbols' : self .toolchain .get_symbols (),
37
- 'asm_symbols' : self .toolchain .get_symbols (True ),
38
- 'target' : self .target ,
39
- 'include_paths' : self .resources .inc_dirs ,
40
- 'load_exe' : str (self .LOAD_EXE ).lower ()
41
- }
42
-
43
- if not exists (join (self .export_dir , '.vscode' )):
44
- makedirs (join (self .export_dir , '.vscode' ))
45
-
46
- config_files = ['launch' , 'settings' , 'tasks' ]
47
- for file in config_files :
48
- if not exists ('.vscode/%s.json' % file ):
49
- self .gen_file ('vscode/%s.tmpl' % file , ctx ,
50
- '.vscode/%s.json' % file )
51
- else :
52
- print ('Keeping existing %s.json' % file )
53
33
54
34
# So.... I want all .h and .hpp files in self.resources.inc_dirs
55
35
all_directories = []
@@ -96,8 +76,27 @@ def generate(self):
96
76
]
97
77
}
98
78
99
- with open (join (self .export_dir , '.vscode' , 'c_cpp_properties.json' ), 'w' ) as outfile :
100
- json .dump (cpp_props , outfile , indent = 4 , separators = (',' , ': ' ))
79
+ ctx = {
80
+ 'name' : self .project_name ,
81
+ 'elf_location' : join ('BUILD' , self .project_name )+ '.elf' ,
82
+ 'c_symbols' : self .toolchain .get_symbols (),
83
+ 'asm_symbols' : self .toolchain .get_symbols (True ),
84
+ 'target' : self .target ,
85
+ 'include_paths' : self .resources .inc_dirs ,
86
+ 'load_exe' : str (self .LOAD_EXE ).lower (),
87
+ 'cpp_props' : json .dumps (cpp_props , indent = 4 , separators = (',' , ': ' ))
88
+ }
89
+
90
+ if not exists (join (self .export_dir , '.vscode' )):
91
+ makedirs (join (self .export_dir , '.vscode' ))
92
+
93
+ config_files = ['launch' , 'settings' , 'tasks' , 'c_cpp_properties' ]
94
+ for file in config_files :
95
+ if not exists ('.vscode/%s.json' % file ):
96
+ self .gen_file ('vscode/%s.tmpl' % file , ctx ,
97
+ '.vscode/%s.json' % file )
98
+ else :
99
+ print ('Keeping existing %s.json' % file )
101
100
102
101
@staticmethod
103
102
def clean (_ ):
@@ -116,5 +115,3 @@ class VSCodeArmc5(VSCode, Armc5):
116
115
class VSCodeIAR (VSCode , IAR ):
117
116
LOAD_EXE = True
118
117
NAME = "VSCode-IAR"
119
-
120
-
0 commit comments