From 91ab0441a5e57723dd7904641b65b79e2e419188 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Sat, 12 Jul 2025 03:18:25 +0100 Subject: [PATCH 1/3] fix: [BUG]: single-line comment fails in VS Code June release Fixes yCodeTech/auto-comment-blocks#10 In the `setSingleLineCommentLanguageDefinitions` method, it uses the `String.includes` method to detect when the `lineComment` string `includes` a semi-colon - ;. The `lineComment` the language config has changed to be either a string or an object. The object has a `comment` and `noIndent` keys. The `includes` method fails due to it being an object and errors out with "lineComment.includes is not a function". To fix: - Added a check to see if the `lineComment` is an object with a `comment` key inside, if it does then use the string value of the `comment` key. Otherwise, it will use the string value of the `lineComment`. --- src/configuration.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/configuration.ts b/src/configuration.ts index 8c643e1..9f4ab51 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -519,16 +519,24 @@ export class Configuration { // If the config object has own property of comments AND the comments key has // own property of lineComment... if (Object.hasOwn(config, "comments") && Object.hasOwn(config.comments, "lineComment")) { + let lineComment = config.comments.lineComment; + + // Line comments can be a string or an object with a "comment" key. + // If the lineComment is an object, get the "comment" key value. + if (Object.hasOwn(lineComment, "comment")) { + lineComment = lineComment.comment; + } + // If the lineComment is "//"... - if (config.comments.lineComment === "//") { + if (lineComment === "//") { style = "//"; } // If the lineComment is "#"... - else if (config.comments.lineComment === "#") { + else if (lineComment === "#") { style = "#"; } // If the lineComment includes a ";" (; or ;;)... - else if (config.comments.lineComment.includes(";")) { + else if (lineComment.includes(";")) { style = ";"; } From 66de984a69245c0017cfdd9586f154ce4e1b7b25 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Sat, 12 Jul 2025 03:30:39 +0100 Subject: [PATCH 2/3] docs: added new version to changelog --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57ee28b..1b78b59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,20 @@ All notable changes to this extension will be documented in this file. This Changelog uses the [Keep a Changelog](http://keepachangelog.com/) structure. +## [1.1.9](https://github.com/yCodeTech/auto-comment-blocks/releases/tag/v1.1.9) - 2025-07-12 + +#### Fixed: + +- Fixes yCodeTech/auto-comment-blocks#10 + + The `lineComment` language config key has changed to be either a string or an object. With the object having `comment` and `noIndent` keys, which was introduced in VS Code's June 2025 release. This breaks the extension when encountering the `makefile` language, and an error occurs: + + > lineComment.includes is not a function + + To fix: + + - Added a check to see if the `lineComment` is an object with a `comment` key inside, if it does then use the string value of the `comment` key. Otherwise, it will use the string value of the `lineComment`. + ## [1.1.8](https://github.com/yCodeTech/auto-comment-blocks/releases/tag/v1.1.8) - 2025-06-19 #### Fixed: From 5a8504e727af5634ab978e5af753a83036bf9e70 Mon Sep 17 00:00:00 2001 From: yCodeTech Date: Sat, 12 Jul 2025 03:30:56 +0100 Subject: [PATCH 3/3] chore: version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 91922b1..f3c75be 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "automatic-comment-blocks", "displayName": "Automatic Comment Blocks", "description": "Provides block comment completion for Javadoc-style multi-line comments and single-line comment blocks for most officially supported languages.", - "version": "1.1.8", + "version": "1.1.9", "publisher": "ycodetech", "homepage": "https://github.com/ycodetech/auto-comment-blocks", "repository": {