Is there an easy way to configure VS Code to add a custom Copyright banner to a file? I was thinking of using a code snippet. Is there a better way of achieving the same thing? Thanks!
The extension can be invoked by typing insert header or Copyright: insert header in the VSCode Command Palette.
Press Ctrl+. to trigger the Quick Actions and Refactorings menu. Select Add file header. To apply the file header to an entire project or solution, select Project or Solution under the Fix all occurrences in: option.
Don't know if this helps, but you can press CTRL+SPACE to bring up autocomplete.
There is an extension for this called File Header Comment.
Installation
Open Command Palette by pressing F1, find the option Extensions: Install Extensions
and look for File Header Comment extension.
Configuration
By default you don't have to set anything. It will detect most programming language for appropriate comment syntax. But if you want, you can set your own templates in Preferences - User Settings
. Please consult the extension documentation for more information.
Hope this helps!!
There is another extension available with more options,
psioniq File Header
to install, press ctrl+P and paste the following ext install psioniq.psi-header
Configure your header using, File->Preference->Settings->User Settings
Will jump into opportunity to add another one that I wrote: copyright-inserter
It works both in local and remote environments and supports all languages that are currently installed into your VSCode instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With