The VS Code Cpptools extension contributes a context menu item "Create Declaration / Definition" when right clicking a declaration in a header file.
Clicking that menu item/action causes the extension to create a source file whose extension is .cpp
. However, I want it to be .cc
not .cpp
I can’t find the setting about file extension.
Is there any way to make source file not .cpp
but something else like .cc
or .cxx
?
My VS Code version is 1.78.2 (latest)
2
Answers
I started a GitHub discussion in the VS Code Cpptools repo to ask this here.
The current answer is that this is not currently possible (source: from the mouth of the maintainers).
An issue ticket has been created for this feature-request at Enable changing the file extension of files created when using the "Create Declaration / Definition"
#10970. Since such a feature would require support from the server side of the extension, an issue ticket for that has been created at C++ Create Declaration / Definition always uses .cpp/.h file extensions with no way to configure it.
I’m not aware of any workarounds (aside from manually renaming the file to change the file extension yourself after the new file is created).
I’ll update this answer if/when the answer changes.