@@ -177,20 +177,24 @@ export class CommentGenerator {
177177 * is undefined, appropriate warnings are logged and defaults are used.
178178 */
179179 constructor ( languageComment : LazyFileLoader | undefined = undefined , editor : vscode . TextEditor | undefined = undefined , randomLogoInstance : RandomLogo | undefined = undefined ) {
180+ logger . debug ( getMessage ( "inFunction" , "constructor" , "CommentGenerator" ) ) ;
180181 if ( languageComment !== undefined ) {
181182 this . languageComment = languageComment ;
183+ logger . debug ( getMessage ( "foundLanguageComment" ) ) ;
182184 } else {
183185 logger . warning ( getMessage ( "missingLanguageComment" ) ) ;
184186 }
185187 if ( ! editor ) {
186188 logger . warning ( getMessage ( "noFocusedEditors" ) ) ;
187189 } else {
188190 this . updateFileInfo ( editor ) ;
191+ logger . debug ( getMessage ( "foundFocusEditor" ) ) ;
189192 }
190193 if ( ! randomLogoInstance ) {
191194 logger . warning ( getMessage ( "noLogoInstanceProvided" ) ) ;
192195 } else {
193196 this . randomLogo = randomLogoInstance ;
197+ logger . debug ( getMessage ( "foundLogoInstance" ) ) ;
194198 }
195199 }
196200
@@ -203,9 +207,12 @@ export class CommentGenerator {
203207 * for use in text manipulation operations.
204208 */
205209 private determineNewLine ( eol : vscode . EndOfLine ) : string {
210+ logger . debug ( getMessage ( "inFunction" , "determineNewLine" , "CommentGenerator" ) ) ;
206211 if ( eol === vscode . EndOfLine . LF ) {
212+ logger . debug ( getMessage ( "foundNewLine" , "\\n" ) ) ;
207213 return "\n" ;
208214 } else {
215+ logger . debug ( getMessage ( "foundNewLine" , "\\r\\n" ) ) ;
209216 return "\r\n" ;
210217 }
211218 }
@@ -221,6 +228,7 @@ export class CommentGenerator {
221228 * formatting and project name.
222229 */
223230 private headerOpener ( comment : string , eol : vscode . EndOfLine , projectName : string = this . Config . get ( "extensionName" ) ) : string {
231+ logger . debug ( getMessage ( "inFunction" , "headerOpener" , "CommentGenerator" ) ) ;
224232 let final : string = comment + this . Config . get ( "headerOpenerDecorationOpen" ) ;
225233 final += this . Config . get ( "telegraphBegin" ) + " " ;
226234 final += projectName ;
@@ -238,6 +246,7 @@ export class CommentGenerator {
238246 * Supports both language ID matching and file extension fallback.
239247 */
240248 private async determineCorrectComment ( ) : Promise < CommentStyle > {
249+ logger . debug ( getMessage ( "inFunction" , "determineCorrectComment" , "CommentGenerator" ) ) ;
241250 const primaryKey : string = "langs" ;
242251 let commentStructure : CommentStyle = {
243252 singleLine : [ ] ,
@@ -318,6 +327,7 @@ export class CommentGenerator {
318327 * for the current file. The description will be included in the header.
319328 */
320329 private async determineHeaderDescription ( ) : Promise < string [ ] > {
330+ logger . debug ( getMessage ( "inFunction" , "determineHeaderDescription" , "CommentGenerator" ) ) ;
321331 let final : string [ ] = [ ] ;
322332 const usrResponse : string | undefined = await query . input ( getMessage ( "getHeaderDescription" ) ) ;
323333 final . push ( usrResponse || "" ) ;
@@ -332,6 +342,7 @@ export class CommentGenerator {
332342 * for categorizing the current file.
333343 */
334344 private async determineHeaderTags ( ) : Promise < string [ ] > {
345+ logger . debug ( getMessage ( "inFunction" , "determineHeaderTags" , "CommentGenerator" ) ) ;
335346 let final : string [ ] = [ ] ;
336347 const usrResponse : string | undefined = await query . input ( getMessage ( "getHeaderTags" ) ) ;
337348 final . push ( usrResponse || "" ) ;
@@ -346,6 +357,7 @@ export class CommentGenerator {
346357 * purpose or function of the current file.
347358 */
348359 private async determineHeaderPurpose ( ) : Promise < string [ ] > {
360+ logger . debug ( getMessage ( "inFunction" , "determineHeaderPurpose" , "CommentGenerator" ) ) ;
349361 let final : string [ ] = [ ] ;
350362 const usrResponse : string | undefined = await query . input ( getMessage ( "getHeaderPurpose" ) ) ;
351363 final . push ( usrResponse || "" ) ;
@@ -363,6 +375,7 @@ export class CommentGenerator {
363375 * option if only one exists, or the first option if user cancels selection.
364376 */
365377 private async getSingleCommentOption ( commentOptions : string [ ] ) : Promise < string > {
378+ logger . debug ( getMessage ( "inFunction" , "getSingleCommentOption" , "CommentGenerator" ) ) ;
366379 if ( commentOptions . length === 0 ) {
367380 logger . Gui . error ( getMessage ( "noCommentToShow" ) ) ;
368381 throw Error ( getMessage ( "noCommentToShow" ) ) ;
@@ -383,6 +396,7 @@ export class CommentGenerator {
383396 * (like "File:", "Date:") and their corresponding values.
384397 */
385398 private addKeyDefinitionSeparator ( ) : string {
399+ logger . debug ( getMessage ( "inFunction" , "addKeyDefinitionSeparator" , "CommentGenerator" ) ) ;
386400 const userSettingDefinedElement : string = this . Config . get ( "headerKeyDefinitionSeparator" ) ;
387401 return userSettingDefinedElement || this . Config . get ( "headerKeyDefinitionSeparator" ) ;
388402 }
@@ -397,6 +411,7 @@ export class CommentGenerator {
397411 * Uses configured date separators and formatting from the extension settings.
398412 */
399413 private addCreationDate ( comment : string , eol : vscode . EndOfLine ) {
414+ logger . debug ( getMessage ( "inFunction" , "addCreationDate" , "CommentGenerator" ) ) ;
400415 const now = new Date ( ) ;
401416 const day = String ( now . getDate ( ) ) . padStart ( 2 , "0" ) ;
402417 const month = String ( now . getMonth ( ) + 1 ) . padStart ( 2 , "0" ) ; // Months are 0-based
@@ -421,6 +436,7 @@ export class CommentGenerator {
421436 * the date using configured separators.
422437 */
423438 private addLastModifiedDate ( comment : string , eol : vscode . EndOfLine ) {
439+ logger . debug ( getMessage ( "inFunction" , "addLastModifiedDate" , "CommentGenerator" ) ) ;
424440 const now : Date = new Date ( ) ;
425441 const day : string = String ( now . getDate ( ) ) . padStart ( 2 , "0" ) ;
426442 const month : string = String ( now . getMonth ( ) + 1 ) . padStart ( 2 , "0" ) ; // Months are 0-based
@@ -454,6 +470,7 @@ export class CommentGenerator {
454470 * optional blank line based on configuration.
455471 */
456472 private addMultilineKey ( comment : string , eol : vscode . EndOfLine , tagName : string , tagDefinition : string [ ] ) : string {
473+ logger . debug ( getMessage ( "inFunction" , "addMultilineKey" , "CommentGenerator" ) ) ;
457474 const eolStr : string = this . determineNewLine ( eol ) ;
458475 let final : string = comment + tagName + this . addKeyDefinitionSeparator ( ) + eolStr ;
459476 for ( let i = 0 ; i < tagDefinition . length ; i ++ ) {
@@ -477,6 +494,7 @@ export class CommentGenerator {
477494 * Creates a single-line key-value pair in the header format.
478495 */
479496 private addSingleLineKey ( comment : string , eol : vscode . EndOfLine , tagName : string , tagDefinition : string ) : string {
497+ logger . debug ( getMessage ( "inFunction" , "addSingleLineKey" , "CommentGenerator" ) ) ;
480498 let final : string = comment + tagName + this . addKeyDefinitionSeparator ( ) ;
481499 final += tagDefinition + this . determineNewLine ( eol ) ;
482500 return final ;
@@ -492,6 +510,7 @@ export class CommentGenerator {
492510 * before the final header closing line.
493511 */
494512 private beforeHeaderCloser ( comment : string , eol : vscode . EndOfLine ) : string {
513+ logger . debug ( getMessage ( "inFunction" , "beforeHeaderCloser" , "CommentGenerator" ) ) ;
495514 return comment + this . Config . get ( "telegraphEndOfTransmission" ) + this . determineNewLine ( eol ) ;
496515 }
497516
@@ -506,6 +525,7 @@ export class CommentGenerator {
506525 * formatting and project name, matching the opener format.
507526 */
508527 private headerCloser ( comment : string , eol : vscode . EndOfLine , projectName : string = this . Config . get ( "extensionName" ) ) : string {
528+ logger . debug ( getMessage ( "inFunction" , "headerCloser" , "CommentGenerator" ) ) ;
509529 let final : string = comment + this . Config . get ( "headerOpenerDecorationOpen" ) ;
510530 final += this . Config . get ( "telegraphEnd" ) + " " ;
511531 final += projectName ;
@@ -524,6 +544,7 @@ export class CommentGenerator {
524544 * and updates configuration-dependent properties.
525545 */
526546 private updateFileInfo ( editor : vscode . TextEditor , document : vscode . TextDocument | undefined = undefined ) {
547+ logger . debug ( getMessage ( "inFunction" , "updateFileInfo" , "CommentGenerator" ) ) ;
527548 this . headerInnerEnd = undefined ;
528549 this . headerInnerStart = undefined ;
529550 if ( document === undefined ) {
@@ -561,6 +582,7 @@ export class CommentGenerator {
561582 * both multi-line and single-line comment styles with user prompting when needed.
562583 */
563584 private async getCorrectCommentPrefix ( determinedComment : CommentStyle ) : Promise < string [ ] > {
585+ logger . debug ( getMessage ( "inFunction" , "getCorrectPrefix" , "CommentGenerator" ) ) ;
564586 let commentOpener : string = "" ;
565587 let commentMiddle : string = "" ;
566588 let commentCloser : string = "" ;
@@ -612,6 +634,7 @@ export class CommentGenerator {
612634 * - Closing comment delimiter
613635 */
614636 private async buildTheHeader ( comments : string [ ] ) : Promise < string [ ] > {
637+ logger . debug ( getMessage ( "inFunction" , "buildTheHeader" , "CommentGenerator" ) ) ;
615638 const eol : vscode . EndOfLine = this . documentEOL || vscode . EndOfLine . LF ;
616639 const unknownTerm : string = getMessage ( "unknown" ) ;
617640 const commentOpener : string = comments [ 0 ] || "" ;
@@ -675,6 +698,7 @@ export class CommentGenerator {
675698 * boundaries have been previously determined by locateIfHeaderPresent().
676699 */
677700 private async updateEditDate ( editor : vscode . TextEditor , comments : string [ ] ) {
701+ logger . debug ( getMessage ( "inFunction" , "updateEditDate" , "CommentGenerator" ) ) ;
678702 const commentOpener : string = comments [ 0 ] || "" ;
679703 const commentMiddle : string = comments [ 1 ] || "" ;
680704 const commentCloser : string = comments [ 2 ] || "" ;
@@ -735,6 +759,7 @@ export class CommentGenerator {
735759 * header is found. Detects broken headers (mismatched/missing opener/closer).
736760 */
737761 protected locateIfHeaderPresent ( comments : string [ ] ) : boolean | undefined {
762+ logger . debug ( getMessage ( "inFunction" , "locateIfHeaderPresent" , "CommentGenerator" ) ) ;
738763 const commentOpener : string = comments [ 0 ] || "" ;
739764 const commentMiddle : string = comments [ 1 ] || "" ;
740765 const commentCloser : string = comments [ 2 ] || "" ;
@@ -790,6 +815,7 @@ export class CommentGenerator {
790815 * top of the document. Handles shebang line detection and offset calculation.
791816 */
792817 private async writeHeaderToFile ( editor : vscode . TextEditor , comments : string [ ] ) : Promise < number > {
818+ logger . debug ( getMessage ( "inFunction" , "writeHeaderToFile" , "CommentGenerator" ) ) ;
793819 let offset : number = 0 ;
794820 const headerContent : string [ ] = await this . buildTheHeader ( comments ) ;
795821 // determine if the first line has a shebang like line on the first line, if true, add a new line, and write from that line.
@@ -809,6 +835,7 @@ export class CommentGenerator {
809835 * This method is typically called by user command activation.
810836 */
811837 async injectHeader ( ) {
838+ logger . debug ( getMessage ( "inFunction" , "injectHeader" , "CommentGenerator" ) ) ;
812839 const editor = vscode . window . activeTextEditor ;
813840 if ( editor === undefined ) {
814841 logger . error ( getMessage ( "noFocusedEditors" ) ) ;
@@ -870,6 +897,7 @@ export class CommentGenerator {
870897 * file name, and full file path against minimatch patterns.
871898 */
872899 private async allowedToActivate ( ) : Promise < boolean > {
900+ logger . debug ( getMessage ( "inFunction" , "allowedToActivate" , "CommentGenerator" ) ) ;
873901 const ignored : string [ ] = CodeConfig . get ( "extensionIgnore" ) ?? [ ] ;
874902
875903 for ( const pattern of ignored ) {
@@ -894,6 +922,7 @@ export class CommentGenerator {
894922 * dependency injection or runtime reconfiguration.
895923 */
896924 updateLogoInstanceRandomiser ( randomLogoInstance : RandomLogo ) : void {
925+ logger . debug ( getMessage ( "inFunction" , "updateLogoInstanceRandomiser" , "CommentGenerator" ) ) ;
897926 this . randomLogo = randomLogoInstance ;
898927 }
899928
@@ -908,6 +937,7 @@ export class CommentGenerator {
908937 * 3. Do nothing (if refresh disabled or file excluded)
909938 */
910939 async refreshHeader ( document : vscode . TextDocument | undefined ) {
940+ logger . debug ( getMessage ( "inFunction" , "refreshHeader" , "CommentGenerator" ) ) ;
911941 const refreshOnSave : boolean = CodeConfig . get ( "refreshOnSave" ) ;
912942 const promptToCreateIfMissing : boolean = CodeConfig . get ( "promptToCreateIfMissing" ) ;
913943 if ( ! refreshOnSave ) {
0 commit comments