ymotongpoo / vsc-licenser

License handler extension for Visual Studio Code.
Apache License 2.0
45 stars 40 forks source link
license typescript vscode-extension

Licenser

An extension for adding license headers and LICENSE files into your workspace. You can find this extension on Marketplace for VS Code.

Install

Launch VS Code, go to the Quick Open menu (Ctrl+P on Windows/Linux, ⌘P on macOS), and type:

ext install licenser

Commands and features

This extension provides shortcuts to insert license headers to source code files and to create a LICENSE file based on the configurations in settings.json. This extension not only provides shortcuts but also enables auto-insertion of license header on creation of new file.

You can call these commands via Command Palette (Ctrl+Shift+P on Windows/Linux, ⌘⇧P on OS X):

Programming languages supported by this extension are (alphabetical order):

The following programing languages/frameworks are supported in the manual configurations of this extension (see contributes.languages in package.json):

Configurations

licenser.license

"licenser.license": "AL2"

This setting defines the license used by the project.

Currently, supported licenses are:

licenser.author

"licenser.author": "Yoshi Yamaguchi"

This setting defines the author name that would be inserted into the license header template.

licenser.projectName

"licenser.projectName": "Awesome project"

This setting should be in Workspace settings. This setting defines the project name you are working on. This setting is only used in the template for GPLv2 and GPLv3. Default value would be your workspace root directory name. Be aware that this setting should be in Workspace setting, not in User setting, since User setting affects all workspaces which are not relevant to this project name.

licenser.useSingleLineStyle

"licenser.useSingleLineStyle": true

This setting defines your preference of comment style. If this setting is set as true, licenser uses single line comment style for license header in case that the language has single line comment style. If it is set as true but the language doesn't have single line comment style, multi line comment will be applied.

licenser.customTermsAndConditions

"licenser.customTermsAndConditions": "Copyright @YEAR@ @AUTHOR@\n\nThese are my terms and conditions..."

This setting defines the text used to create the LICENSE file when the "Custom" license type is selected.

The following placeholders can be used:

Note: Newlines are not allowed in settings strings, so you must use \n instead. Other characters, such as double-quotes, may need to be escaped as well. Consider using a regex replace to convert an existing multi-line file to a single line.

licenser.customTermsAndConditionsFile

"licenser.customTermsAndConditionsFile": "path/to/terms.txt"

This setting defines the path to a file that contains the text for the custom terms and conditions. This will override licenser.customTermsAndConditions if present.

Placeholders are the same as licenser.customTermsAndConditions.

licenser.customHeader

"licenser.customHeader": "@FILE@ - @PROJECT@\n\nCopyright @YEAR@ @AUTHOR@\n\nThis is my license..."

This setting defines the text used to create the license header file when the "Custom" license type is selected.

Placeholders and escaping requirements are the same as licenser.customTermsAndConditions.

licenser.customHeaderFile

"licenser.customHeaderFile": "path/to/header.txt"

This setting defines the path to a file that contains the text for the custom header. This will override licenser.customHeader if present.

Placeholders are the same as licenser.customTermsAndConditions.

licenser.disableAutoHeaderInsertion

"licenser.disableAutoHeaderInsertion": false

This setting defines the behavior of header auto-insertion. If this setting is set as true, licenser will disable auto-insertion of license header on creation of new file.

licenser.excludeFileExtensions

"licenser.excludeFileExtensions": ["txt", "c"]

This setting will exclude files with a matching extension in their name from having a license header auto inserted. There is no limit in the amount of entries this array can have. This setting is case insensitive.

Call to action

Report issues

Finally the author bought Windows 10 machine, and he can test the app by himself! For bug reporting, please create a ticket on GitHub repository.

Pull requests

This repository is mainly developed under 'develop' branch, so please make pull requests there, not to 'master' branch.

Changelogs

See all changes in CHANGELOG.

Contributors

See CONTRIBUTORS file for all contributors so far. Thank you for your contributions!

Reference