An open API service indexing awesome lists of open source software.

https://github.com/5P5/vscode-file-header

Automatically (or by command or shortcut) insert (and update) file header text (author comment). Easy configuration and powerful customization to fit any needs!
https://github.com/5P5/vscode-file-header

author automated automatic comment copyright custom customization easy easy-to-use file-header file-info header info license multi-root multiroot power vscode vscode-extension

Last synced: 10 months ago
JSON representation

Automatically (or by command or shortcut) insert (and update) file header text (author comment). Easy configuration and powerful customization to fit any needs!

Awesome Lists containing this project

README

          

๐Ÿ‘Š Power Header ๐Ÿ’ฅ

Power Header automatically (or via command/shortcut Ctrl+Alt+H) inserts (and updates) file header text (author comment).

Power Header offers easy configuration and powerful customization to fit any needs!


vs-marketplace version
vs-marketplace installs
vs-marketplace downloads
vs-marketplace rating

short demo of Power Header in action

## Features

> The following are abridged descriptions. Please see in **Power Header** settings for all the juicy delicious details ๐Ÿคค

| What you ask for โ” | What you get โ— |
|:-:|---|
| ๐Ÿ—ƒ๏ธ Supported Languages | ๐Ÿ’ฏ% all of them! |
| โฉ Automatic Header Insert and Update | Sir, yes, sir!
Automagically โœจ insert header into new files (๐Ÿ›‘ black-/whitelist-support *of course*) and update on save.
Not a single keyboard shortcut pressed! |
| ๐Ÿ“„ Header Template | can be a **text string**, ๐Ÿ˜
read from a **local file**, ๐Ÿ˜ฒ
or even a **remote resource**! ๐Ÿคฏ (http(s)://)|
| ๐Ÿ”€ Variables for Interpolation in Template | **Ain't no hard-coded fields BS here!**
You can do whatever the f๐Ÿค you want!
Use all [vscode snippet variables](https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variables) and define custom variable pairs โ€” they can even be JavaScript code, allowing for arbitrary complex text, date formats, etc.! ๐ŸŽ‰ |
| ๐Ÿ’ฌ Comment Styles | โฌ› Block Comment style,
โž– Line Comment style,
๐Ÿ“ƒ or Insert header as is (your very own style). |
| ๐Ÿ”„ Header Content Update | Update the header via command/shortcut or automatically on file save.
JavaScript regular expression replace allows for arbitrary complex text updates. ๐ŸŽ‰
Use with caution โš ๏ธ |
| Wow, all this is awesome ๐Ÿ˜ฎ, but I have that super rare special edge-case in my multi-root workspace for this file language ๐Ÿฅบ
*โ€” I hear you say* โ‰ | Harness the full **Power Header** and *VS Code* built-in power ๐Ÿ’ฅ
You can always overwrite all **Power Header** settings in a (*Workspace* or *.vscode* folder) *settings.json*, even language specific: `"[]": { "powerHeader.": ... }`, to achieve your desired header style ๐Ÿ‘ |

## Use Case Examples (extending default settings)

1. Insert a simpler header in plain text files (via command/shortcut) โš™๏ธ *User settings.json*
```json
"[plaintext]": {
"powerHeader.commentMode": "raw",
"powerHeader.template": "Author: (email) / $TM_FILENAME @ !date!"
}
```
let's make this work โฉ automatically for plain text files only:
```jsonc
"[plaintext]": {
"powerHeader.autoInsert.enable": true,
"powerHeader.autoInsert.allow": "always",
"powerHeader.commentMode": "raw",
"powerHeader.template": "Author: (email) / $TM_FILENAME @ !date!"
}
```

1. Use another header for that client project โš™๏ธ *Workspace settings.json*
```jsonc
"powerHeader.template": "file://$WORKSPACE_FOLDER/dev/template.txt"
```

1. Your company requires you to use a specific header template in `cpp`? Easy! โš™๏ธ \
```jsonc
"[cpp]": {
"powerHeader.commentMode": "line",
"powerHeader.template": "https://intranet.company.com/static/templates/cpp/header",
}
```

## Extension Settings

See *Feature Contributions* tabโคด๏ธ and better check in *Settings*โžก๏ธ*Extensions*โžก๏ธ**Power Header** for detailed explanation.

> Unfortunately current *Feature Contributions* Description column does not support markdownDescription [๐Ÿž issue here](https://github.com/microsoft/vscode/issues/88927)

## Known Issues

๐Ÿž `"powerHeader.update.enable": "save"` will not work correctly in combination with `"files.autoSave": "onFocusChange"`
(The focus-losing document will be saved nonetheless, but *header content update* will be tried in the focus-gaining (editable) editor)
๐Ÿฉน Workarounds:
If you want to keep `"files.autoSave": "onFocusChange"` set `"powerHeader.update.enable": "manual"`
or use `"powerHeader.update.enable": "save"` with `"files.autoSave": "off|afterDelay|onWindowChange"` setting