Skip to content

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

License

Notifications You must be signed in to change notification settings

jonathan8devs/vscode-file-header

 
 

Repository files navigation

👊 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 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: "[<language>]": { "powerHeader.<setting>": ... }, 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

    "[plaintext]": {
    	"powerHeader.commentMode": "raw",
    	"powerHeader.template": "Author: <author> (email) / $TM_FILENAME @ !date!"
    }

    let's make this work ⏩ automatically for plain text files only:

    "[plaintext]": {
    	"powerHeader.autoInsert.enable": true,
    	"powerHeader.autoInsert.allow": "always",
    	"powerHeader.commentMode": "raw",
    	"powerHeader.template": "Author: <author> (email) / $TM_FILENAME @ !date!"
    }
  2. Use another header for that client project ⚙️ Workspace settings.json

    "powerHeader.template": "file://$WORKSPACE_FOLDER/dev/template.txt"
  3. Your company requires you to use a specific header template in cpp? Easy! ⚙️ <any>

    "[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

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 91.3%
  • JavaScript 8.7%