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: 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": { 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 = ";"; }