TopStamp Extension
This extension helps you create and manage header comments and version logs for your source code files. It automatically inserts metadata such as @Author
, creation date
, and refreshes the last modification date
whenever the file is saved. The extension is highly customizable, allowing you to personalize the header format and version logs for different programming languages.
Features
TopStamp provides several useful features to enhance your workflow:
Manual Header Creation: Adds a standardized header to your source code files when you execute the command TopStamp: Add Main Header. This header includes fields like @Author
, creation date
, modification date
and description
.
Version Log Management: Inserts a version log section into your file at the current cursor position when you execute the command TopStamp: Add Version Info, allowing you to document changes made to the file along with the date and author of the changes.
Auto-Refresh Modification Date: When enabled, it automatically updates the {ModifiedTime}
timestamp whenever the file is saved. By default, this feature is set to false.
Customizable Headers: You can fully customize the content of headers and version logs, adding your own personalized fields. For each language, such as Python, Java, C, C++, JavaScript, Ruby, PHP, and Go
, the format and fields can be adjusted.
Language-Specific Settings: Provides specific header and version log formats for different programming languages, making it adaptable for various development environments.
Enable Auto-Refresh for Document: The command TopStamp: Enable Auto-Refresh for Document allows users to enable automatic updating of the modification date for the currently open document.
Disable Auto-Refresh for Document: The command TopStamp: Disable Auto-Refresh for Document disables the automatic updating of the modification date for the currently open document, giving users full control over this feature.
Tip: You can adjust the header and version log format for each programming language.
Requirements
TopStamp requires Visual Studio Code version ^1.93.0
or higher. There are no other external dependencies required for this extension.
Extension Settings
This extension contributes the following settings, allowing you to customize the behavior of the headers and version logs:
TopStamp.autoRefreshModificationDate
: Enable or disable automatic updating of the modification date on file save (default: false
).
- Language-Specific Settings: You can define specific formats and fields for the headers and version logs based on the programming language in use.
Default Folder for Settings
The default settings for these headers and logs are stored in the settings.json
file in your Visual Studio Code workspace. You can customize these settings per language, pressing Ctrl+Shift+P
and typing Preferences: Open User Settings (JSON)
.
If you start typeing TopStamp.{languageID}
you can easily find all the three types of setting, format
, header
or versionlog
.
For enableing the automatic updating of the modification date on file save, type "TopStamp.autoRefreshModificationDate"
and set its value to true
.
Example Settings for Different Languages
Python
"TopStamp.python.format": {
"startWith": "'''\n",
"middleWith": " || ",
"endWith": "'''\n"
},
"TopStamp.python.header": {
"Headerprefix": "* File informations *\n",
"Author": "@Author: Your Name\n",
"CreateTime": {
"label": "Created on {CreateTime}\n",
"format": "YYYY-MM-DD, HH:mm:ss"
},
"ModifiedTime": {
"label": "Last modified at {ModifiedTime}\n",
"format": "YYYY-MM-DD, HH:mm:ss"
},
"ModifiedBy": "Modified by: Your Name\n",
"Description": "Description: \n"
},
"TopStamp.python.versionlog": {
"VersionLogPrefix": "* New version infos *\n",
"CreateTime": {
"label": "Created on {CreateTime}\n",
"format": "YYYY-MM-DD, HH:mm:ss"
},
"CreatedBy": "@Your Name\n",
"Feature1": "Feature 1: \n",
"Feature2": "Feature 2:...\n"
}
Further instructions on settings
Default value (for Python):
"TopStamp.python.format": {
"startWith": "'''\n",
"middleWith": " || ",
"endWith": "'''\n"
}
It can be easily adjusted, modifying only the characters, but not the fields of this setting set.
- startWith: should be the multiline comment starting character (specific for the given language)
- middleWith: can be adjusted for preferences
- endWith: should be the multiline comment ending character (specific for the given language)
Adjusted version:
"TopStamp.python.format": {
"startWith": "'''\n",
"middleWith": "|",
"endWith": "'''\n"
}
Default value (for Python):
"TopStamp.python.header": {
"Headerprefix": "* File informations *\n",
"Author": "@Author: Your Name\n",
"CreateTime": {
"label": "Created on {CreateTime}\n",
"format": "YYYY-MM-DD, HH:mm:ss"
},
"ModifiedTime": {
"label": "Last modified at {ModifiedTime}\n",
"format": "YYYY-MM-DD, HH:mm:ss"
},
"ModifiedBy": "Modified by: Your Name\n",
"Description": "Description: \n"
},
It can be easily adjusted by:
- modity the text after the fields:
"Headerprefix": "* General file informations *\n"
- remove the text after the filed in order to delete them:
"Headerprefix": ""
- modify the date and time formats:
"CreateTime": {
"label": "Created on {CreateTime}\n",
"format": "YYYY. MMMM DD., HH:mm"
},
- add new fields at the end of the comment (make sure to add commas after every line, except the last one)
"Testcomment":"Testcomment",
"Testcomment2":"Testcomment2"
Adjusted version:
"TopStamp.python.header": {
"Headerprefix": "* General file informations *\n",
"Author": "@Author: Boogie\n",
"CreateTime": {
"label": "Created on {CreateTime}\n",
"format": "YYYY. MMMM DD., HH:mm"
},
"ModifiedTime": {
"label": "Last modified at {ModifiedTime}\n",
"format": "YYYY-MM-DD, HH:mm:ss"
},
"ModifiedBy": "Modified by: Your Name\n",
"Description": "",
"Testcomment":"Testcomment",
"Testcomment2":"Testcomment2"
},
.versionlog
Default value (for Python):
"TopStamp.python.versionlog": {
"VersionLogPrefix": "* New version infos *\n",
"CreateTime": {
"label": "Created on {CreateTime}\n",
"format": "YYYY-MM-DD, HH:mm:ss"
},
"CreatedBy": "@Your Name\n",
"Feature1": "Feature 1: \n",
"Feature2": "Feature 2:...\n"
}
It can be easily adjusted by:
- modity the text after the fields:
"VersionLogPrefix": "* Version infos *\n"
- remove the text after the filed if you would not like to add them (
warning: do not delete the fields for this purpose
):
"VersionLogPrefix": ""
- modify the date and time formats:
"CreateTime": {
"label": "Created on {CreateTime}\n",
"format": "YYYY. MMMM DD., HH:mm"
},
- add new fields at the end of the comment (make sure to add commas after every line, except the last one)
"Testcomment":"Testcomment",
"Testcomment2":"Testcomment2"
Adjusted version:
"TopStamp.python.versionlog": {
"VersionLogPrefix": "* version infos *\n",
"CreateTime": {
"label": "Created on {CreateTime}\n",
"format": "YYYY. MMMM DD., HH:mm"
},
"CreatedBy": "@Boogie\n",
"Feature1": "Changed features: \n",
"Feature2": "",
"Testcomment":"Testcomment",
"Testcomment2":"Testcomment2"
}
Known Issues
- Compatibility: Auto-refreshing the last modification date might not work correctly if the document language or file type is not supported.
- Custom Settings Conflicts: In rare cases, incorrect configuration settings might cause the headers to appear incorrectly. Always ensure that your format and field labels are set correctly.
Release Notes
0.0.1
- Initial release of TopStamp with support for creating headers, version logs customizable fields.
- Language-specific header and log configurations for Python, JavaScript, and more.
- Auto-saving feature that automatically updates the last modification date upon saving the document.
If you have any questions, suggestions, or feedback regarding this extension, feel free to reach out via email:
I look forward to hearing from you!
License
MIT