22 * @file extension.ts
33 * @brief Main extension entry point for AsperHeader VS Code extension
44 * @author Henry Letellier
5- * @version 1.0.5
5+ * @version 1.0.8
66 * @date 2025
77 *
88 * This file serves as the primary activation point for the AsperHeader VS Code extension,
1919 * - Document save event handling with header refresh
2020 *
2121 * The extension integrates multiple specialized modules:
22- * - CommentGenerator: Automated header injection and refresh
23- * - RandomLogo: ASCII art logo selection and display
24- * - Darling: Easter egg functionality with character display
25- * - Watermark: Author watermark management
26- * - MorseTranslator: Text-to-Morse code conversion utilities
27- * - Logger : Dual-channel logging system for development and user feedback
22+ * - { @link CommentGenerator} : Automated header injection and refresh
23+ * - { @link RandomLogo} : ASCII art logo selection and display
24+ * - { @link Darling} : Easter egg functionality with character display
25+ * - { @link Watermark} : Author watermark management
26+ * - { @link MorseTranslator} : Text-to-Morse code conversion utilities
27+ * - { @link logger} : Dual-channel logging system for development and user feedback
2828 *
2929 * @example Extension activation workflow:
3030 * ```typescript
@@ -52,6 +52,7 @@ import { CommentGenerator } from './modules/commentGenerator';
5252import { CodeConfig , CodeConfigType } from "./modules/processConfiguration" ;
5353import { Watermark } from "./modules/watermark" ;
5454import { RandomLogo } from "./modules/randomLogo" ;
55+ import { query } from "./modules/querier" ;
5556
5657// ---- SHared variables ----
5758
@@ -96,6 +97,7 @@ function getFileInfo(editor: vscode.TextEditor) {
9697
9798/**
9899 * @brief Displays a simple greeting message from the extension
100+ * @return Void - Operation completes synchronously
99101 *
100102 * Basic command implementation showing informational notification
101103 * to verify extension functionality and user interaction.
@@ -106,6 +108,7 @@ function helloWorldCommand() {
106108
107109/**
108110 * @brief Inserts greeting message with current file information
111+ * @return Promise<void> - Resolves when message insertion is complete
109112 *
110113 * Advanced hello command that analyzes the active editor and
111114 * inserts contextual information including file path, extension,
@@ -130,6 +133,7 @@ async function sayHelloWorldCommand() {
130133/**
131134 * @brief Thread-safe document update handler for save events
132135 * @param document VS Code text document being saved
136+ * @return Promise<void> - Resolves when update operation is complete or skipped
133137 *
134138 * Implements concurrency control to prevent multiple simultaneous
135139 * header updates during save operations. Uses WeakSet tracking
@@ -155,6 +159,7 @@ async function updateSaveSafe(document: vscode.TextDocument) {
155159
156160/**
157161 * @brief Updates cached workspace name from VS Code workspace state
162+ * @return Void - Updates configuration cache synchronously
158163 *
159164 * Analyzes current workspace configuration to extract and cache
160165 * the workspace name for use in header generation. Handles both
@@ -174,6 +179,46 @@ function refreshWorkspaceName() {
174179 CodeConfig . setWorkspaceName ( workspaceName ) ;
175180}
176181
182+ /**
183+ * @brief Converts user input to Morse code through interactive GUI dialog
184+ * @return Promise<void> - Resolves when conversion and display are complete
185+ *
186+ * Presents an input dialog for text entry, converts the input to Morse code
187+ * using {@link MorseTranslator}, and displays the result through both console
188+ * and GUI notification channels.
189+ */
190+ async function toMorseGui ( ) {
191+ const usr_input : string | undefined = await query . input ( getMessage ( "toMorseGetInput" ) ) ;
192+ if ( usr_input === undefined ) {
193+ logger . Gui . info ( getMessage ( "operationCanceled" ) ) ;
194+ return ;
195+ }
196+ const converted_response : string = MorseTranslator . toMorse ( usr_input ) ;
197+ logger . info ( getMessage ( "convertedContentCli" , converted_response ) ) ;
198+ logger . Gui . info ( getMessage ( "convertedContentGui" ) ) ;
199+ logger . Gui . info ( `${ converted_response } ` ) ;
200+ }
201+
202+ /**
203+ * @brief Converts Morse code input to plain text through interactive GUI dialog
204+ * @return Promise<void> - Resolves when conversion and display are complete
205+ *
206+ * Presents an input dialog for Morse code entry, converts the input to plain text
207+ * using {@link MorseTranslator}, and displays the result through both console
208+ * and GUI notification channels.
209+ */
210+ async function fromMorseGui ( ) {
211+ const usr_input : string | undefined = await query . input ( getMessage ( "fromMorseGetInput" ) ) ;
212+ if ( usr_input === undefined ) {
213+ logger . Gui . info ( getMessage ( "operationCanceled" ) ) ;
214+ return ;
215+ }
216+ const converted_response : string = MorseTranslator . fromMorse ( usr_input ) ;
217+ logger . info ( getMessage ( "convertedContentCli" , converted_response ) ) ;
218+ logger . Gui . info ( getMessage ( "convertedContentGui" ) ) ;
219+ logger . Gui . info ( `${ converted_response } ` ) ;
220+ }
221+
177222/**
178223 * @brief Main extension activation entry point
179224 * @param context VS Code extension context providing access to extension resources
@@ -235,12 +280,15 @@ export async function activate(context: vscode.ExtensionContext) {
235280 vscode . commands . registerCommand ( `${ moduleName } .darling` , DARLING . displayRandomPersonInWindow . bind ( DARLING ) ) ,
236281 vscode . commands . registerCommand ( `${ moduleName } .author` , WATERMARK . displayRandomAuthorWatermarkInWindow . bind ( WATERMARK ) ) ,
237282 vscode . commands . registerCommand ( `${ moduleName } .displayRandomLogo` , RANDOM_LOGO . displayRandomLogoInWindow . bind ( RANDOM_LOGO ) ) ,
283+ vscode . commands . registerCommand ( `${ moduleName } .toMorse` , toMorseGui ) ,
284+ vscode . commands . registerCommand ( `${ moduleName } .fromMorse` , fromMorseGui ) ,
238285 vscode . workspace . onDidSaveTextDocument ( async ( document : vscode . TextDocument ) => { await updateSaveSafe ( document ) ; } )
239286 ) ;
240287}
241288
242289/**
243290 * @brief Extension cleanup and deactivation handler
291+ * @return Void - Completes synchronously with no explicit cleanup
244292 *
245293 * Called when extension is deactivated, disabled, or VS Code closes.
246294 * Currently implements graceful shutdown without explicit cleanup
0 commit comments