Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
and this project adheres to [Semantic Versioning](https://semver.org/).

## [1.0.19] - 16/02/2026

### Fixed

- processing of the description entry when charage returns are provided. (comments in front of the description content are now properly prepended)
- header checking (issue of a closing line being before the opening line)
- header checking (grace lines (the user defined maximum scan lines added onto the current user defined scan lines) when the opening line of the header was found but not the closing one)

## [1.0.18] - 7/02/2026

## Added
### Added

- language prepend option
- language append option
Expand All @@ -18,7 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
- tags to make the extension easier to get discovered on the different marketplaces
- GitHub Discussions for community engagement: [General Discussion](https://github.com/Asperguide/asper-header/discussions/35) and [Q&A](https://github.com/Asperguide/asper-header/discussions/36)

## Fixed
### Fixed

- issue introduced in version 1.0.17 where an extra line would be added after each single comment line.

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ The extension currently supports the following languages:
- Fix issue where version 1.0.17 would add extra lines between single line comments in the header
- Add tags to the extension to make it easier to find on the marketplaces

### 1.0.19

- Fix processing of the description entry when charage returns are provided. (comments in front of the description content are now properly prepended)
- Fix header checking (issue of a closing line being before the opening line, grace lines (the user defined maximum scan lines added onto the current user defined scan lines) when the opening line of the header was found but not the closing one)

---

## Community
Expand Down
12 changes: 10 additions & 2 deletions vscode/asperheader/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
and this project adheres to [Semantic Versioning](https://semver.org/).

## [1.0.19] - 16/02/2026

### Fixed

- processing of the description entry when charage returns are provided. (comments in front of the description content are now properly prepended)
- header checking (issue of a closing line being before the opening line)
- header checking (grace lines (the user defined maximum scan lines added onto the current user defined scan lines) when the opening line of the header was found but not the closing one)

## [1.0.18] - 7/02/2026

## Added
### Added

- language prepend option
- language append option
Expand All @@ -18,7 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
- tags to make the extension easier to get discovered on the different marketplaces
- GitHub Discussions for community engagement: [General Discussion](https://github.com/Asperguide/asper-header/discussions/35) and [Q&A](https://github.com/Asperguide/asper-header/discussions/36)

## Fixed
### Fixed

- issue introduced in version 1.0.17 where an extra line would be added after each single comment line.

Expand Down
5 changes: 5 additions & 0 deletions vscode/asperheader/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,11 @@ The extension currently supports the following languages:
- Fix issue where version 1.0.17 would add extra lines between single line comments in the header
- Add tags to the extension to make it easier to find on the marketplaces

### 1.0.19

- Fix processing of the description entry when charage returns are provided. (comments in front of the description content are now properly prepended)
- Fix header checking (issue of a closing line being before the opening line, grace lines (the user defined maximum scan lines added onto the current user defined scan lines) when the opening line of the header was found but not the closing one)

---

## Community
Expand Down
4 changes: 2 additions & 2 deletions vscode/asperheader/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vscode/asperheader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "asperheader",
"displayName": "Asper Header",
"description": "This is an extension that will allow the developers of the Asperguide project to sign their file in an easier way and quicker",
"version": "1.0.18",
"version": "1.0.19",
"publisher": "HenryLetellier",
"icon": "images/icon/favicon_transparent.png",
"repository": {
Expand Down
48 changes: 35 additions & 13 deletions vscode/asperheader/src/modules/commentGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,20 @@ export class CommentGenerator {
*/
private async determineHeaderDescription(): Promise<string[]> {
logger.debug(getMessage("inFunction", "determineHeaderDescription", "CommentGenerator"));
let final: string[] = [];
const usrProjectDescription: string = this.Config.get("projectDescription");
if (usrProjectDescription.length === 0) {
const rawAny = this.Config.get("projectDescription");
let intermediate: string = "";
if (Array.isArray(rawAny)) {
intermediate = rawAny.join(this.determineNewLine(this.documentEOL || vscode.EndOfLine.LF));
} else {
intermediate = String(rawAny ?? "");
}
if (intermediate.trim().length === 0) {
const usrResponse: string | undefined = await query.input(getMessage("getHeaderDescription"));
final.push(usrResponse || "");
intermediate = (usrResponse || "");
} else {
logger.debug(getMessage("configDescriptionUsed"));
final.push(usrProjectDescription);
}
const final = intermediate.split(/\r?\n/);
return final;
}

Expand Down Expand Up @@ -930,30 +935,47 @@ export class CommentGenerator {
logger.warning(getMessage("closedDocument"));
return undefined;
}
const documentTotalLines: number = this.documentBody.lineCount;
const eol: vscode.EndOfLine = this.documentEOL ?? vscode.EndOfLine.LF;
const opener: string = this.headerOpener(commentMiddle, eol, this.projectName);
const closer: string = this.headerCloser(commentMiddle, eol, this.projectName);
const scanLines: number = Math.min(this.maxScanLength, this.documentBody.lineCount);
const opener: string = this.headerOpener(commentMiddle, eol, this.projectName).trimEnd();
const closer: string = this.headerCloser(commentMiddle, eol, this.projectName).trimEnd();
const scanLines: number = Math.min(this.maxScanLength, documentTotalLines);
const graceLines: number = Math.min((this.maxScanLength * 2), documentTotalLines);
let lineOpenerFound: boolean = false;
let lineCloserFound: boolean = false;
for (let i = 0; i < scanLines; i++) {
for (let i = 0; i < scanLines || (i < graceLines && lineOpenerFound && !lineCloserFound); i++) {
const lineText = this.documentBody.lineAt(i).text;
if (lineText === opener.trimEnd() && lineCloserFound) {
if (i >= scanLines) {
logger.info(getMessage("graceLines"));
}

// If we encounter a closer before any opener, the header is broken
if (lineText === closer && !lineOpenerFound) {
logger.Gui.warning(getMessage("brokenHeader"));
return false;
}
if (lineText === closer.trimEnd() && !lineOpenerFound) {

// If we encounter an opener after a closer was already found, header is broken
if (lineText === opener && lineCloserFound) {
logger.Gui.warning(getMessage("brokenHeader"));
return false;
}
if (lineText === opener.trimEnd() && (!lineCloserFound && !lineOpenerFound)) {

// Detect opener
if (lineText === opener && !lineOpenerFound) {
lineOpenerFound = true;
this.headerInnerStart = i;
logger.info(getMessage("headerOpenerFound"));
continue;
}
if (lineText === closer.trimEnd() && (!lineCloserFound && lineOpenerFound)) {

// Detect closer (only valid if opener was already seen)
if (lineText === closer && !lineCloserFound) {
this.headerInnerEnd = i;
lineCloserFound = true;
}

if (lineCloserFound && lineOpenerFound) {
logger.info(getMessage("headerOpenerAndCloserFound"));
return true;
}
Expand Down
15 changes: 15 additions & 0 deletions vscode/asperheader/src/modules/messageReference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: (): string => "Please provide a description: ",
getHeaderPurpose: (): string => "Please provide the purpose of the file:",
getHeaderTags: (): string => "Please enter the tags for this file, separated by commas:",
graceLines: (): string => "Searching for header closer using grace lines.",
headerInjectQuestion: (): string => "No header was found in this document. Would you like to add one?",
headerInjectQuestionRefused: (): string => "You decided not to add the a header to the file.",
headerNotFound: (): string => "No header was found in this document.",
Expand Down Expand Up @@ -542,6 +543,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: (): string => "Veuillez fournir une description : ",
getHeaderPurpose: (): string => "Veuillez fournir l’objectif du fichier :",
getHeaderTags: (): string => "Veuillez saisir les tags de ce fichier, séparés par des virgules :",
graceLines: (): string => "Recherche du marqueur de fin d’en-tête en parcourant des lignes supplémentaires.",
headerInjectQuestion: (): string => "Aucun en-tête trouvé dans ce document. Souhaitez-vous en ajouter un ?",
headerInjectQuestionRefused: (): string => "Vous avez décidé de ne pas ajouter d'en-tête au fichier.",
headerNotFound: (): string => "Aucun en-tête trouvé dans ce document.",
Expand Down Expand Up @@ -687,6 +689,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: (): string => "Fornisci una descrizione: ",
getHeaderPurpose: (): string => "Fornisci lo scopo del file:",
getHeaderTags: (): string => "Inserisci i tag per questo file, separati da virgole:",
graceLines: (): string => "Ricerca del marcatore di chiusura dell'intestazione scansionando righe aggiuntive.",
headerInjectQuestion: (): string => "Nessuna intestazione trovata in questo documento. Vuoi aggiungerne una?",
headerInjectQuestionRefused: (): string => "Hai deciso di non aggiungere un'intestazione al file.",
headerNotFound: (): string => "Nessuna intestazione trovata in questo documento.",
Expand Down Expand Up @@ -832,6 +835,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: (): string => "Por favor, proporciona una descripción: ",
getHeaderPurpose: (): string => "Proporcione el propósito del archivo:",
getHeaderTags: (): string => "Ingrese las etiquetas para este archivo, separadas por comas:",
graceLines: (): string => "Buscando el marcador de cierre del encabezado escaneando líneas adicionales.",
headerInjectQuestion: (): string => "No se encontró encabezado en este documento. ¿Desea agregar uno?",
headerInjectQuestionRefused: (): string => "Decidió no agregar un encabezado al archivo.",
headerNotFound: (): string => "No se encontró encabezado en este documento.",
Expand Down Expand Up @@ -977,6 +981,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: () => "Bitte Beschreibung angeben:",
getHeaderPurpose: () => "Bitte Zweck der Datei angeben:",
getHeaderTags: () => "Bitte Tags für diese Datei eingeben, durch Kommas getrennt:",
graceLines: (): string => "Suche nach dem Header-Schlusszeichen, scanne zusätzliche Zeilen.",
headerInjectQuestion: () => "Kein Header gefunden. Möchten Sie einen hinzufügen?",
headerInjectQuestionRefused: () => "Sie haben entschieden, keinen Header hinzuzufügen.",
headerNotFound: () => "Kein Header in diesem Dokument gefunden.",
Expand Down Expand Up @@ -1122,6 +1127,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: () => "説明を入力してください: ",
getHeaderPurpose: () => "ファイルの目的を入力してください: ",
getHeaderTags: () => "このファイルのタグをカンマで区切って入力してください: ",
graceLines: (): string => "ヘッダーの終了マーカーを探索するために追加の行を走査しています。",
headerInjectQuestion: () => "このドキュメントにヘッダーが見つかりません。追加しますか?",
headerInjectQuestionRefused: () => "ファイルにヘッダーを追加しないことにしました。",
headerNotFound: () => "このドキュメントにヘッダーが見つかりません。",
Expand Down Expand Up @@ -1267,6 +1273,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: () => "설명을 입력하세요: ",
getHeaderPurpose: () => "파일의 목적을 입력하세요: ",
getHeaderTags: () => "이 파일의 태그를 쉼표로 구분하여 입력하세요: ",
graceLines: (): string => "추가 행을 스캔하여 헤더 종료를 검색합니다.",
headerInjectQuestion: () => "이 문서에서 헤더를 찾을 수 없습니다. 추가하시겠습니까?",
headerInjectQuestionRefused: () => "파일에 헤더를 추가하지 않기로 결정했습니다.",
headerNotFound: () => "이 문서에서 헤더를 찾을 수 없습니다.",
Expand Down Expand Up @@ -1412,6 +1419,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: () => "Пожалуйста, предоставьте описание: ",
getHeaderPurpose: () => "Пожалуйста, укажите назначение файла: ",
getHeaderTags: () => "Введите теги для этого файла через запятую: ",
graceLines: (): string => "Поиск конца заголовка, сканирование дополнительных строк.",
headerInjectQuestion: () => "Заголовок в этом документе не найден. Хотите добавить его?",
headerInjectQuestionRefused: () => "Вы решили не добавлять заголовок в файл.",
headerNotFound: () => "Заголовок в этом документе не найден.",
Expand Down Expand Up @@ -1557,6 +1565,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: () => "Por favor, forneça uma descrição: ",
getHeaderPurpose: () => "Por favor, forneça o propósito do arquivo:",
getHeaderTags: () => "Digite as tags para este arquivo, separadas por vírgulas:",
graceLines: (): string => "Procurando o marcador de fechamento do cabeçalho examinando linhas adicionais.",
headerInjectQuestion: () => "Nenhum cabeçalho encontrado neste documento. Deseja adicionar um?",
headerInjectQuestionRefused: () => "Você optou por não adicionar um cabeçalho ao arquivo.",
headerNotFound: () => "Nenhum cabeçalho encontrado neste documento.",
Expand Down Expand Up @@ -1702,6 +1711,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: () => "Lütfen bir açıklama sağlayın: ",
getHeaderPurpose: () => "Lütfen dosyanın amacını belirtin:",
getHeaderTags: () => "Bu dosya için etiketleri virgülle ayırarak girin:",
graceLines: (): string => "Başlık kapanış işaretini bulmak için ek satırlar taranıyor.",
headerInjectQuestion: () => "Bu belgede başlık bulunamadı. Eklemek ister misiniz?",
headerInjectQuestionRefused: () => "Dosyaya başlık eklememeyi seçtiniz.",
headerNotFound: () => "Bu belgede başlık bulunamadı.",
Expand Down Expand Up @@ -1847,6 +1857,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: () => "Podaj opis: ",
getHeaderPurpose: () => "Podaj cel pliku:",
getHeaderTags: () => "Wprowadź tagi dla tego pliku, oddzielone przecinkami:",
graceLines: (): string => "Wyszukiwanie znacznika końca nagłówka, skanuję dodatkowe wiersze.",
headerInjectQuestion: () => "Nie znaleziono nagłówka w tym dokumencie. Czy chcesz dodać jeden?",
headerInjectQuestionRefused: () => "Zdecydowano nie dodawać nagłówka do pliku.",
headerNotFound: () => "Nie znaleziono nagłówka w tym dokumencie.",
Expand Down Expand Up @@ -1992,6 +2003,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: () => "Zadejte popis: ",
getHeaderPurpose: () => "Zadejte účel souboru:",
getHeaderTags: () => "Zadejte tagy pro tento soubor, oddělené čárkou:",
graceLines: (): string => "Hledání ukončovací značky hlavičky skenováním dalších řádků.",
headerInjectQuestion: () => "V tomto dokumentu nebyla nalezena žádná hlavička. Chcete ji přidat?",
headerInjectQuestionRefused: () => "Rozhodli jste se nepřidávat hlavičku do souboru.",
headerNotFound: () => "V tomto dokumentu nebyla nalezena žádná hlavička.",
Expand Down Expand Up @@ -2137,6 +2149,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: () => "Adjon meg egy leírást: ",
getHeaderPurpose: () => "Adja meg a fájl célját:",
getHeaderTags: () => "Adja meg a fájl címkéit, vesszővel elválasztva:",
graceLines: (): string => "Fejléc lezáró jelének keresése további sorok átvizsgálásával.",
headerInjectQuestion: () => "Nem található fejléc ebben a dokumentumban. Szeretne hozzáadni egyet?",
headerInjectQuestionRefused: () => "Úgy döntött, hogy nem ad hozzá fejlécet a fájlhoz.",
headerNotFound: () => "Nem található fejléc ebben a dokumentumban.",
Expand Down Expand Up @@ -2282,6 +2295,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: () => "请输入描述:",
getHeaderPurpose: () => "请输入文件用途:",
getHeaderTags: () => "请输入文件标签,用逗号分隔:",
graceLines: (): string => "使用宽限行搜索头部结束标记。",
headerInjectQuestion: () => "未找到头部。是否添加一个?",
headerInjectQuestionRefused: () => "您选择不向文件添加头部。",
headerNotFound: () => "未找到头部。",
Expand Down Expand Up @@ -2427,6 +2441,7 @@ export const messages: Record<string, Record<string, (...args: any[]) => string>
getHeaderDescription: () => "請提供描述:",
getHeaderPurpose: () => "請提供檔案用途:",
getHeaderTags: () => "請輸入檔案標籤,用逗號分隔:",
graceLines: (): string => "使用寬限行搜尋標頭結束標記。",
headerInjectQuestion: () => "未找到頭部。是否添加一個?",
headerInjectQuestionRefused: () => "您選擇不向檔案添加頭部。",
headerNotFound: () => "未找到頭部。",
Expand Down