Skip to content

Commit 3ac9569

Browse files
authored
Merge pull request #11 from yCodeTech/fix/single-line-comment-config-change-in-vscode-june-2025-release
Fix extension failure due to single-line comment config changes in VS Code June 2025 release.
2 parents 7b51228 + 5a8504e commit 3ac9569

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ All notable changes to this extension will be documented in this file.
44

55
This Changelog uses the [Keep a Changelog](http://keepachangelog.com/) structure.
66

7+
## [1.1.9](https://github.com/yCodeTech/auto-comment-blocks/releases/tag/v1.1.9) - 2025-07-12
8+
9+
#### Fixed:
10+
11+
- Fixes yCodeTech/auto-comment-blocks#10
12+
13+
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:
14+
15+
> lineComment.includes is not a function
16+
17+
To fix:
18+
19+
- 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`.
20+
721
## [1.1.8](https://github.com/yCodeTech/auto-comment-blocks/releases/tag/v1.1.8) - 2025-06-19
822

923
#### Fixed:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "automatic-comment-blocks",
33
"displayName": "Automatic Comment Blocks",
44
"description": "Provides block comment completion for Javadoc-style multi-line comments and single-line comment blocks for most officially supported languages.",
5-
"version": "1.1.8",
5+
"version": "1.1.9",
66
"publisher": "ycodetech",
77
"homepage": "https://github.com/ycodetech/auto-comment-blocks",
88
"repository": {

src/configuration.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,16 +519,24 @@ export class Configuration {
519519
// If the config object has own property of comments AND the comments key has
520520
// own property of lineComment...
521521
if (Object.hasOwn(config, "comments") && Object.hasOwn(config.comments, "lineComment")) {
522+
let lineComment = config.comments.lineComment;
523+
524+
// Line comments can be a string or an object with a "comment" key.
525+
// If the lineComment is an object, get the "comment" key value.
526+
if (Object.hasOwn(lineComment, "comment")) {
527+
lineComment = lineComment.comment;
528+
}
529+
522530
// If the lineComment is "//"...
523-
if (config.comments.lineComment === "//") {
531+
if (lineComment === "//") {
524532
style = "//";
525533
}
526534
// If the lineComment is "#"...
527-
else if (config.comments.lineComment === "#") {
535+
else if (lineComment === "#") {
528536
style = "#";
529537
}
530538
// If the lineComment includes a ";" (; or ;;)...
531-
else if (config.comments.lineComment.includes(";")) {
539+
else if (lineComment.includes(";")) {
532540
style = ";";
533541
}
534542

0 commit comments

Comments
 (0)