MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _generate_cpp_properties

Method _generate_cpp_properties

tools/ng/generator.py:127–156  ·  view source on GitHub ↗

Generate c_cpp_properties.json.

(self, vscode_dir: str, context, project_info: Dict)

Source from the content-addressed store, hash-verified

125 return True
126
127 def _generate_cpp_properties(self, vscode_dir: str, context, project_info: Dict) -> None:
128 """Generate c_cpp_properties.json."""
129 # Get toolchain info
130 toolchain = context.toolchain_manager.get_current()
131 compiler_path = ""
132 if toolchain and toolchain.info:
133 if toolchain.get_name() == "gcc":
134 compiler_path = os.path.join(toolchain.info.path, toolchain.info.prefix + "gcc")
135
136 config = {
137 "configurations": [
138 {
139 "name": "RT-Thread",
140 "includePath": [
141 "${workspaceFolder}/**"
142 ] + project_info.get('all_includes', []),
143 "defines": [f"{k}={v}" if v != '1' else k
144 for k, v in project_info.get('all_defines', {}).items()],
145 "compilerPath": compiler_path,
146 "cStandard": "c99",
147 "cppStandard": "c++11",
148 "intelliSenseMode": "gcc-arm" if "arm" in compiler_path else "gcc-x64"
149 }
150 ],
151 "version": 4
152 }
153
154 output_path = os.path.join(vscode_dir, 'c_cpp_properties.json')
155 with open(output_path, 'w') as f:
156 json.dump(config, f, indent=4)
157
158 def _generate_tasks(self, vscode_dir: str, context) -> None:
159 """Generate tasks.json."""

Callers 1

generateMethod · 0.95

Calls 6

openFunction · 0.50
get_currentMethod · 0.45
get_nameMethod · 0.45
joinMethod · 0.45
getMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected