|
Asper Header
1.0.14
The header injector extension
|
Intelligent file header generation and management system. More...

Public Member Functions | |
| constructor (languageComment:LazyFileLoader|undefined=undefined, editor:vscode.TextEditor|undefined=undefined, randomLogoInstance:RandomLogo|undefined=undefined) | |
| Constructor for CommentGenerator class. | |
Protected Member Functions | |
| locateIfHeaderPresent (comments:string[]) | |
| Scans document to detect existing header presence and boundaries. | |
Intelligent file header generation and management system.
The CommentGenerator class serves as the central orchestrator for all header-related operations within the AsperHeader extension. It provides comprehensive functionality for creating, updating, and maintaining file headers with rich metadata, ASCII art logos, and language-appropriate comment formatting.
Core Responsibilities:
RandomLogo for ASCII artArchitectural Features:
Configuration settingsHeader Structure: Generated headers follow a structured format including:
Performance Considerations:
Definition at line 135 of file commentGenerator.ts.
|
inline |
Constructor for CommentGenerator class.
| languageComment | Optional lazy loader for language comment configurations |
| editor | Optional VS Code text editor instance |
| randomLogoInstance | Optional random logo generator instance |
Initializes the comment generator with optional dependencies. If any parameter is undefined, appropriate warnings are logged and defaults are used.
Definition at line 180 of file commentGenerator.ts.
|
inlineprotected |
Scans document to detect existing header presence and boundaries.
| comments | Array of comment prefixes [opener, middle, closer] |
Searches the document within maxScanLength lines for header opener and closer patterns. Sets headerInnerStart and headerInnerEnd properties when valid header is found. Detects broken headers (mismatched/missing opener/closer).
Writes a new header to the beginning of the file
| editor | VS Code text editor instance |
| comments | Array of comment prefixes [opener, middle, closer] |
Generates a complete header using buildTheHeader() and inserts it at the top of the document. Handles shebang line detection and offset calculation.
Main method to inject or update header in active editor
Primary entry point for header injection functionality. Performs:
This method is typically called by user command activation.
Definition at line 768 of file commentGenerator.ts.