Asper Header  1.0.14
The header injector extension
Loading...
Searching...
No Matches
processConfiguration.ts
Go to the documentation of this file.
1
68import * as vscode from 'vscode';
69import * as CONST from '../constants';
70
92 private statusError: number = CONST.statusError;
94 private statusSuccess: number = CONST.statusSuccess;
96 private extensionName: string = CONST.extensionName;
98 private moduleName: string = CONST.moduleName;
100 private projectCopyright: string = CONST.projectCopyright;
101
102 // Header decoration and formatting settings
104 private headerOpenerDecorationOpen: string = CONST.headerOpenerDecorationOpen;
106 private headerOpenerDecorationClose: string = CONST.headerOpenerDecorationClose;
108 private headerCommentSpacing: string = CONST.headerCommentSpacing;
109
110 // Telegraph-style symbols for header formatting
112 private telegraphBegin: string = CONST.telegraphBegin;
114 private telegraphEnd: string = CONST.telegraphEnd;
116 private telegraphBlockStop: string = CONST.telegraphBlockStop;
118 private telegraphEndOfTransmission: string = CONST.telegraphEndOfTransmission;
120 private headerAddBlankLineAfterMultiline: boolean = CONST.headerAddBlankLineAfterMultiline;
122 private headerKeyDefinitionSeparator: string = CONST.headerKeyDefinitionSeparator;
123
124 // Header section keys and labels
126 private headerLogoKey: string = CONST.headerLogoKey;
128 private headerProjectKey: string = CONST.headerProjectKey;
130 private headerFileKey: string = CONST.headerFileKey;
132 private headerCreationDateKey: string = CONST.headerCreationDateKey;
134 private headerLastModifiedKey: string = CONST.headerLastModifiedKey;
136 private headerDescriptionKey: string = CONST.headerDescriptionKey;
138 private headerCopyrightKey: string = CONST.headerCopyrightKey;
140 private headerTagKey: string = CONST.headerTagKey;
142 private headerPurposeKey: string = CONST.headerPurposeKey;
143
144 // Date and time formatting separators
146 private headerTimeSeperatorHour: string = CONST.headerTimeSeperatorHour;
148 private headerTimeSeperatorMinute: string = CONST.headerTimeSeperatorMinute;
150 private headerTimeSeperatorSecond: string = CONST.headerTimeSeperatorSecond;
152 private headerTimeAndDateSeperator: string = CONST.headerTimeAndDateSeperator;
154 private headerDateSeperatorDay: string = CONST.headerDateSeperatorDay;
156 private headerDateSeperatorMonth: string = CONST.headerDateSeperatorMonth;
158 private headerDateSeperatorYear: string = CONST.headerDateSeperatorYear;
159
160 // Content and behavior configuration
162 private headerLogo: string[] = CONST.defaultHeaderLogo;
164 private maxScanLength: number = CONST.defaultMaxScanLength;
165
166 // Feature toggle flags
168 private enableDebug: boolean = CONST.enableDebug;
170 private refreshOnSave: boolean = CONST.refreshOnSave;
172 private promptToCreateIfMissing: boolean = CONST.promptToCreateIfMissing;
174 private randomLogo: boolean = CONST.randomLogo;
175
176 // File filtering configuration
178 private extensionIgnore: string[] = CONST.extensionIgnore;
179
181 private workspaceName: string | undefined = undefined;
182
184 private useWorkspaceNameWhenAvailable: boolean = CONST.useWorkspaceNameWhenAvailable;
185
187 private projectDescription: string = CONST.projectDescription;
188
208 async refreshVariables(): Promise<void> {
209 const config = vscode.workspace.getConfiguration(CONST.moduleName);
210
211 this.extensionName = config.get<string>("extensionName", CONST.extensionName);
212 this.projectCopyright = config.get<string>("projectCopyright", CONST.projectCopyright);
213 this.headerOpenerDecorationOpen = config.get<string>("headerOpenerDecorationOpen", CONST.headerOpenerDecorationOpen);
214 this.headerOpenerDecorationClose = config.get<string>("headerOpenerDecorationClose", CONST.headerOpenerDecorationClose);
215 this.headerCommentSpacing = config.get<string>("headerCommentSpacing", CONST.headerCommentSpacing);
216 this.telegraphBegin = config.get<string>("telegraphBegin", CONST.telegraphBegin);
217 this.telegraphEnd = config.get<string>("telegraphEnd", CONST.telegraphEnd);
218 this.telegraphBlockStop = config.get<string>("telegraphBlockStop", CONST.telegraphBlockStop);
219 this.telegraphEndOfTransmission = config.get<string>("telegraphEndOfTransmission", CONST.telegraphEndOfTransmission);
220 this.headerAddBlankLineAfterMultiline = config.get<boolean>("headerAddBlankLineAfterMultiline", CONST.headerAddBlankLineAfterMultiline);
221 this.headerKeyDefinitionSeparator = config.get<string>("headerKeyDefinitionSeparator", CONST.headerKeyDefinitionSeparator);
222 this.headerLogoKey = config.get<string>("headerLogoKey", CONST.headerLogoKey);
223 this.headerProjectKey = config.get<string>("headerProjectKey", CONST.headerProjectKey);
224 this.headerFileKey = config.get<string>("headerFileKey", CONST.headerFileKey);
225 this.headerCreationDateKey = config.get<string>("headerCreationDateKey", CONST.headerCreationDateKey);
226 this.headerLastModifiedKey = config.get<string>("headerLastModifiedKey", CONST.headerLastModifiedKey);
227 this.headerDescriptionKey = config.get<string>("headerDescriptionKey", CONST.headerDescriptionKey);
228 this.headerCopyrightKey = config.get<string>("headerCopyrightKey", CONST.headerCopyrightKey);
229 this.headerTagKey = config.get<string>("headerTagKey", CONST.headerTagKey);
230 this.headerPurposeKey = config.get<string>("headerPurposeKey", CONST.headerPurposeKey);
231 this.headerTimeSeperatorHour = config.get<string>("headerTimeSeperatorHour", CONST.headerTimeSeperatorHour);
232 this.headerTimeSeperatorMinute = config.get<string>("headerTimeSeperatorMinute", CONST.headerTimeSeperatorMinute);
233 this.headerTimeSeperatorSecond = config.get<string>("headerTimeSeperatorSecond", CONST.headerTimeSeperatorSecond);
234 this.headerTimeAndDateSeperator = config.get<string>("headerTimeAndDateSeperator", CONST.headerTimeAndDateSeperator);
235 this.headerDateSeperatorDay = config.get<string>("headerDateSeperatorDay", CONST.headerDateSeperatorDay);
236 this.headerDateSeperatorMonth = config.get<string>("headerDateSeperatorMonth", CONST.headerDateSeperatorMonth);
237 this.headerDateSeperatorYear = config.get<string>("headerDateSeperatorYear", CONST.headerDateSeperatorYear);
238 this.headerLogo = config.get<string[]>("headerLogo", CONST.defaultHeaderLogo);
239 this.maxScanLength = config.get<number>("maxScanLength", CONST.defaultMaxScanLength);
240 this.enableDebug = config.get<boolean>("enableDebug", CONST.enableDebug);
241 this.refreshOnSave = config.get<boolean>("refreshOnSave", CONST.refreshOnSave);
242 this.promptToCreateIfMissing = config.get<boolean>("promptToCreateIfMissing", CONST.promptToCreateIfMissing);
243 this.randomLogo = config.get<boolean>("randomLogo", CONST.randomLogo);
244 this.extensionIgnore = config.get<string[]>("extensionIgnore", CONST.extensionIgnore);
245 this.useWorkspaceNameWhenAvailable = config.get<boolean>("useWorkspaceNameWhenAvailable", CONST.useWorkspaceNameWhenAvailable);
246 this.projectDescription = config.get<string>("projectDescription", CONST.projectDescription);
247 }
248
268 get(key: string): any {
269 // fallback to CONST if no runtime override exists
270 return (this as any)[key] ?? (CONST as any)[key];
271 }
272
282 setWorkspaceName(workpaceName: string | undefined = undefined): void {
283 this.workspaceName = workpaceName;
284 }
285
294 getWorkspaceName(): string | undefined {
295 return this.workspaceName;
296 }
297}
298
307
335
Core configuration management class with dynamic VS Code settings integration.
export const headerOpenerDecorationOpen
Opening decoration pattern for header borders.
Definition constants.ts:68
export const headerDateSeperatorYear
Separator character after year in date formatting (empty for no separator)
Definition constants.ts:138
export const extensionIgnore
Array of file extensions to ignore during header processing.
Definition constants.ts:245
export const headerCreationDateKey
Key identifier for file creation timestamp field.
Definition constants.ts:109
export const telegraphEndOfTransmission
Telegraph protocol end of transmission acknowledgment.
Definition constants.ts:93
export const headerDateSeperatorDay
Separator character between day and month in date formatting.
Definition constants.ts:134
export const headerLogoKey
Key identifier for logo/ASCII art section in headers.
Definition constants.ts:103
export const extensionName
Human-readable name of the extension.
Definition constants.ts:57
export const moduleName
Module identifier used in package.json and extension marketplace.
Definition constants.ts:59
export const useWorkspaceNameWhenAvailable
the user setting that allows them to toggle to prefer the useage of a workspace name when available
Definition constants.ts:238
export const projectCopyright
Copyright notice for project attribution.
Definition constants.ts:61
export const headerTimeAndDateSeperator
Separator character between date and time components.
Definition constants.ts:132
export const promptToCreateIfMissing
Whether to prompt user to create header if missing during operations.
Definition constants.ts:232
export const enableDebug
Global debug mode flag for development and troubleshooting.
Definition constants.ts:222
export const telegraphBlockStop
Telegraph protocol block termination marker.
Definition constants.ts:84
export const headerTimeSeperatorHour
Separator character between hour and minute in time formatting.
Definition constants.ts:126
export const telegraphEnd
Telegraph protocol marker indicating message transmission end.
Definition constants.ts:82
export const headerKeyDefinitionSeparator
Separator string between header keys and their values.
Definition constants.ts:96
export const headerTagKey
Key identifier for tag/category field in headers.
Definition constants.ts:117
export const headerProjectKey
Key identifier for project name field in headers.
Definition constants.ts:105
export const headerDateSeperatorMonth
Separator character between month and year in date formatting.
Definition constants.ts:136
export const randomLogo
Whether to use random logo selection instead of default logo.
Definition constants.ts:235
export const telegraphBegin
Telegraph protocol marker indicating message transmission start.
Definition constants.ts:80
export const headerPurposeKey
Key identifier for purpose/objective field in headers.
Definition constants.ts:119
export const statusError
Return code indicating operation failure or error condition.
Definition constants.ts:48
export const headerTimeSeperatorSecond
Separator character after seconds in time formatting (empty for no separator)
Definition constants.ts:130
export const headerLastModifiedKey
Key identifier for last modification timestamp field.
Definition constants.ts:111
export const headerFileKey
Key identifier for filename field in headers.
Definition constants.ts:107
export const headerDescriptionKey
Key identifier for file description field in headers.
Definition constants.ts:113
export const headerOpenerDecorationClose
Closing decoration pattern for header borders.
Definition constants.ts:70
export const statusSuccess
Return code indicating successful operation completion.
Definition constants.ts:50
export const headerCopyrightKey
Key identifier for copyright information field.
Definition constants.ts:115
export const refreshOnSave
Whether to automatically refresh headers when files are saved.
Definition constants.ts:229
export const projectDescription
The dummy variable containing the description to use instead of having to ask the user the question e...
Definition constants.ts:248
export const headerCommentSpacing
Standard spacing character used in header comment formatting.
Definition constants.ts:73
export const headerTimeSeperatorMinute
Separator character between minute and second in time formatting.
Definition constants.ts:128
import type
export const Record< string,(...args:any[])=> string
export type CodeConfigType
Type alias for the Configuration class.
import *as vscode from vscode
const instance
Singleton configuration instance for application-wide use.
export const CodeConfig
Exported configuration singleton for extension-wide access @export Primary configuration interface us...