Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically add copyright banner in VS Code

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!

like image 593
BigONotation Avatar asked Aug 08 '16 07:08

BigONotation


People also ask

How do you add copyright to VSCode?

The extension can be invoked by typing insert header or Copyright: insert header in the VSCode Command Palette.

How do I add a header in VSCode?

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.

How do I enable autofill in VS code?

Don't know if this helps, but you can press CTRL+SPACE to bring up autocomplete.


3 Answers

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!!

like image 184
Jakub Synowiec Avatar answered Oct 08 '22 01:10

Jakub Synowiec


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

like image 17
Mohideen bin Mohammed Avatar answered Oct 08 '22 01:10

Mohideen bin Mohammed


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.

like image 1
Leo Y Avatar answered Oct 07 '22 23:10

Leo Y