visual-studio-code

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!


Solution

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