Skip to content

This is the vscode extension to be used to add a custom header to the files that will be used for the asperguide program.

License

Notifications You must be signed in to change notification settings

Asperguide/asper-header

AsperHeader

AsperHeader Logo

AsperHeader is a Visual Studio Code extension built primarily for the Asperguide development team. It provides an easy and standardized way to generate, insert, and maintain structured file headers across projects.

Although tailored for Asperguide, it is available on the VS Code Marketplace and Open VSX Registry for anyone who may find it useful.


Source repository

The source repository can be found here: GitHub

Join our community discussions:


Developper documentation

You can find the developper documentation here (generated by doxygen): https://asperguide.github.io/asper-header/


Features

  • Insert structured headers into your source files with a single command.
  • Embed an ASCII logo at the top of the header.
  • Automatically include:
    • Project name
    • File name
    • Creation date
    • Last modified date (auto-updates on save)
    • Description block (supports multiline)
    • Copyright
    • Tags / keywords (optional)
    • Purpose section
    • Watermark
  • Configurable formatting:
    • Customize comment styles and separators.
    • Adjust scan length for detecting headers.
    • Random ASCII logo option.
  • Commands available via Command Palette or keyboard shortcuts:
    • AsperHeader: Add a header to the file (Ctrl+Alt+H), for Mac: (Cmd+Alt+H)
    • AsperHeader: Refresh the header (Ctrl+Alt+U), for Mac: (Cmd+Alt+U)
    • AsperHeader: Display a random logo (in a new window) (Ctrl+Alt+Shift+L), for Mac: (Cmd+Alt+Shift+L)
    • AsperHeader: easter egg (Ctrl+Alt+Shift+D), for Mac: (Cmd+Alt+Shift+D)
    • AsperHeader: diplay the author's name (Ctrl+Alt+Shift+A), for Mac: (Cmd+Alt+Shift+A)
    • AsperHeader: To Morse
    • AsperHeader: From Morse

Demo

Bellow is a video demoing the different features of the extension: (sorry for the low quality, github filesize restrictions oblige)

If animation fails to load, click here (gif) or here (mp4) Extension demo


Requirements

None. The extension works out of the box with Visual Studio Code.


Extension Settings

AsperHeader contributes the following settings:

Setting Type Default Description
asperheader.extensionName string "AsperHeader" Name of the extension being used.
asperheader.projectCopyright string "(c) Asperguide" Copyright message for the header.
asperheader.headerOpenerDecorationOpen string "+==== " Opening text for the header frame.
asperheader.headerOpenerDecorationClose string " =================+" Closing text for the header frame.
asperheader.headerCommentSpacing string " " Spacing between the comment symbol and the header text.
asperheader.telegraphBegin string "BEGIN" Text used for header begin marker.
asperheader.telegraphEnd string "END" Text used for header end marker.
asperheader.telegraphBlockStop string "/STOP" Marks the end of a header block section.
asperheader.telegraphEndOfTransmission string "// AR" End-of-transmission marker.
asperheader.headerAddBlankLineAfterMultiline boolean false Insert a blank line after multiline blocks.
asperheader.headerKeyDefinitionSeparator string ": " Separator between key and value in header.
asperheader.headerLogoKey string "LOGO" Header key for ASCII logo.
asperheader.headerProjectKey string "PROJECT" Header key for project name.
asperheader.headerFileKey string "FILE" Header key for file name.
asperheader.headerCreationDateKey string "CREATION DATE" Header key for creation date.
asperheader.headerLastModifiedKey string "LAST Modified" Header key for last modified date.
asperheader.headerDescriptionKey string "DESCRIPTION" Header key for file description.
asperheader.headerCopyrightKey string "COPYRIGHT" Header key for copyright.
asperheader.headerTagKey string "TAG" Header key for tags.
asperheader.headerPurposeKey string "PURPOSE" Header key for purpose section.
asperheader.headerTimeSeperatorHour string ":" Separator for hours in timestamps.
asperheader.headerTimeSeperatorMinute string ":" Separator for minutes in timestamps.
asperheader.headerTimeSeperatorSecond string "" Separator for seconds in timestamps.
asperheader.headerTimeAndDateSeperator string " " Separator between time and date.
asperheader.headerDateSeperatorDay string "-" Separator for day in dates.
asperheader.headerDateSeperatorMonth string "-" Separator for month in dates.
asperheader.headerDateSeperatorYear string "" Separator for year in dates.
asperheader.headerLogo array [ASCII logo default] Default ASCII logo array.
asperheader.maxScanLength number 100 Maximum lines scanned for existing headers.
asperheader.enableDebug boolean true Enable debug logging.
asperheader.refreshOnSave boolean true Automatically refresh header on file save.
asperheader.promptToCreateIfMissing boolean true Prompt to create header if missing.
asperheader.randomLogo boolean false Insert a random ASCII logo on each header generation.
asperheader.extensionIgnore array [] File extensions to ignore when saving.
asperheader.useWorkspaceNameWhenAvailable boolean false Use the workspace name when available.
asperheader.projectDescription string "" The description to use instead of asking the user every time.
asperheader.languagePrepend object {} If set, and language is matched, will put the text specified in the string in front of the comment during the initial generation of the header. example for python: {"python": "r"}, example for bash scripts: {"bash":"#!/usr/bin/env bash\n"}
asperheader.languageAppend object {} If set, and language is matched, will append the text specified in the string after the comment during the initial generation of the header. Useful for adding formatting or boilerplate. example: {"python": "\n# Code begins"} to add a separator comment after the header
asperheader.languageSingleLineCommentOverride object {} Specify an override of your choice for the single line comment to be used when it's specified language (name is case insensitive) is matched. example: {"idris":"|||"} instead of the default '--'
asperheader.languageMultiLineCommentOverride object {} Specify an override of your choice for the multiline comment to be used when it's specified language (name is case insensitive) is matched. example: {"c":["/*","**","*/"]}
asperheader.removeTrailingHeaderSpaces boolean true Toggle wether to remove trailing whitespaces from the lines in the header that might contain them due to the generation (i.e: a space after the LOGO: due to there being a newline instead of text)
asperheader.preferSingleLineComments boolean false Prefer using the single line comments when available for the language instead of the multiline version

Known Issues

None so far.


Supported Languages

AsperHeader now provides comprehensive multilingual support for user interface messages, error reporting, and interactive elements. Each language includes full translations with culturally appropriate phrasing and proper handling of technical terminology.

The extension currently supports the following languages:

Language Locale Code
English (US) en
French fr
Italian it
Spanish es
German de
Japanese ja
Korean ko
Russian ru
Portuguese (Brazil) pt-br
Turkish tr
Polish pl
Czech cs
Hungarian hu
Simplified Chinese zh-cn
Traditional Chinese zh-tw

Note: If a message is missing in a given language, it will automatically fall back to English (en) to ensure consistent functionality across all locales.


Release Notes

1.0.0

  • Initial release of AsperHeader.
  • Supports injecting structured headers with ASCII logos.
  • Automatic last modified date updates on save.
  • Configurable settings for flexible formatting.
  • Optional random logo insertion.

1.0.1

  • Add the missing .tsx file format to the comment identification logic

1.0.2

  • Fix file format parsing error
  • Add more supported vscode languages
  • Add the mac equivalent in keybindings

1.0.3

  • Fix esbuild script to fail on missing files
  • Update the modules logo
  • Update functions to work with older versions of the vscode library

1.0.4

  • Fix the copy button functionality
  • Update the logger so that the non-gui based can be visible in non-debug mode
  • Fix import path in the file regarding the required json file as the name had changed but not been reflected in the code
  • Update the doxygen comments to make the code clearer
  • Refactor some minor sections of the code
  • Add more unit tests for module stability

1.0.5

  • Add 12 more languages to the module (es, zh-cn, zh-tw, de, ja, ko, ru, pt-br, tr, pl, cs, hu)
  • Update messageReference.ts in order to support such languages

1.0.6

  • Fix the debug check
  • Fix test with the logger

1.0.7

  • Update the package dependency versions
  • Update the comment choices in the comment dictionnary so that they are as silent as possible

1.0.8

  • Add a text to morse and morse to text translator.
  • Update the doxygen documentation

1.0.9

  • Add additional debug lines to help track the program evolution when running.

1.0.10

  • Fix the indefinite hang when a file does not exist, it now errors out after 5 seconds/attempt if the file is not found
  • Update the program to check 2 different paths due to possible alterations of how the module packaging could shift.
  • Refactor the lazyFileLoad class to be more robust to different file types and paths.
  • Add the missing translations for the recently added sentences (v1.0.8, v1.0.9, v1.0.10)
  • Add jsonc file loading suppport
  • Add a script to help make sure that the languages all have the same amount of entries (so that the program will not throw a sentence not found due to a missing text entry).

1.0.11

  • Add the missing translations

1.0.12

  • Fix the types in the user settings for the extension.

1.0.13

  • Add support for .env, pip requirements, .gitignore, LICENSE, code-workspace files

1.0.14

  • Add an option to provide a default description to avoid having to ask the user for it at every trigger.

1.0.15

  • Add support for rtf, properties and doxyfile files

1.0.16

  • Add support for PlantUML files
  • Update package dependency versions

1.0.17

  • Fix issue of bulk saving only updating the open file.

1.0.18

  • Add an option to specify a character to add before the header based on the language (during initial header generation)
  • Add an option to specify a character to add after the header based on the language (during initial header generation)
  • Add an option to toggle between single and multi line comments preference (during initial generation)
  • Add an option to override the comment used for single line comments per language (during initial generation)
  • Add an option to override the comment used for multiline comments per language (during initial generation)
  • Fix issue where version 1.0.17 would add extra lines between single line comments in the header
  • Add tags to the extension to make it easier to find on the marketplaces

1.0.19

  • Fix processing of the description entry when charage returns are provided. (comments in front of the description content are now properly prepended)
  • Fix header checking (issue of a closing line being before the opening line, grace lines (the user defined maximum scan lines added onto the current user defined scan lines) when the opening line of the header was found but not the closing one)

Community

Join the conversation and connect with other AsperHeader users:

We'd love to see your custom configurations, ASCII art logos, and creative header designs!


Following Extension Guidelines

This extension follows VS Code Extension Guidelines.


For More Information


Enjoy using AsperHeader!

About

This is the vscode extension to be used to add a custom header to the files that will be used for the asperguide program.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •