Skip to content

Conversation

yCodeTech
Copy link
Owner

@yCodeTech yCodeTech commented Jan 6, 2025

Release v1.2.0 adds ability to automatically update it's language definitions and reconfigure the comment blocks when user settings change.

Changelog Brief Overview:

Added:

  • Added the ability to automatically update the extension's language definitions and reconfigure the comment blocks support when user settings change.

  • Added new user setting:

    • auto-comment-blocks.supportUnsupportedLanguages as the new and preferred way of adding unsupported languages for comment support for all single and multi-line comment blocks. The setting combines the old individual settings into one setting so it's easier to detect when they change. The object properties have the same names as the now deprecated individual settings: multiLineStyleBlocks, slashStyleBlocks, hashStyleBlocks, semicolonStyleBlocks.
  • Added an on change event for the new supportUnsupportedLanguages setting to detect when the user changes the settings, and then uses the new updateSingleLineCommentLanguageDefinitions public method to update the language definitions.

Deprecated:

The following user settings are now deprecated:

  • auto-comment-blocks.slashStyleBlocks
  • auto-comment-blocks.hashStyleBlocks
  • auto-comment-blocks.semicolonStyleBlocks
  • auto-comment-blocks.multiLineStyleBlocks

They all have deprecation description warnings that are shown in the settings.json file. These settings also no longer appear in the Settings UI panel, in favour of the new combined setting auto-comment-blocks.supportUnsupportedLanguages.

These deprecated settings will be removed in the major version v2.0.0.

…ings have changed.

Added:

- A new user setting: `auto-comment-blocks.supportUnsupportedLanguages`. This is the new and preferred way of adding unsupported languages to be supported for all single and multi-line comment blocks.

The `supportUnsupportedLanguages` object combines the old individual settings into one setting so it's easier to detect when they change.

The properties have the same names as the now deprecated individual settings: `multiLineStyleBlocks`, `slashStyleBlocks`, `hashStyleBlocks`, `semicolonStyleBlocks`.

- `updateSingleLineCommentLanguageDefinitions` public method to update the single-line comment language definitions.

- An on change event for the new supportUnsupportedLanguages setting instead of the multiple events for the deprecated old settings, making the code DRY. Also added code to call the new `updateSingleLineCommentLanguageDefinitions` method to update the language definitions when the user changes the settings.

- `getCustomSupportedLangConfigurationValue` method to get the custom supported language configuration value for the specified key. If the old user settings have values, then it will use the old deprecated setting, otherwise it will get the value from the new `supportUnsupportedLanguages` setting. Changed all relevant code in the `setSingleLineCommentLanguageDefinitions` method to use this new method of getting the user config settings.

Deprecated:

The following user settings are now deprecated:
- `auto-comment-blocks.slashStyleBlocks`
- `auto-comment-blocks.hashStyleBlocks`
- `auto-comment-blocks.semicolonStyleBlocks`
- auto-comment-blocks.multiLineStyleBlocks

They all have deprecation description warnings that are shown in the settings.json. These settings also no longer appear in the Settings UI panel, in favour of the new combined setting `auto-comment-blocks.supportUnsupportedLanguages`.

These deprecated settings will be removed in the major version v2.0.0

Removed:

- The on change events for the deprecated individual settings.
@yCodeTech yCodeTech requested a review from Copilot July 27, 2025 05:31
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This release introduces automatic reconfiguration capabilities for language definitions when user settings change, eliminating the need for manual extension host restarts. The change consolidates multiple deprecated settings into a single unified configuration object.

  • Replaces manual reload prompts with automatic language definition updates
  • Introduces unified supportUnsupportedLanguages setting to replace four deprecated individual settings
  • Implements real-time reconfiguration without requiring extension host restart

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/extension.ts Replaces manual reload prompts with automatic reconfiguration using new unified setting
src/configuration.ts Adds public method for updating language definitions and backward compatibility logic
package.json Adds new unified setting configuration and marks old settings as deprecated

},
"auto-comment-blocks.hashStyleBlocks": {
"type": "array",
"default": [],
"markdownDescription": "Add language IDs here to enable `#`-style single-line comment blocks for that language. This allows unsupported languages to have comment completion."
"markdownDescription": "Add language IDs here to enable `#`-style single-line comment blocks for that language. This allows unsupported languages to have comment completion.",
"deprecationMessage": "**Deprecated**: Please use `auto-comment-blocks.supportUnsupportedLanguages` with the property key `slashStyleBlocks` instead.",
Copy link
Preview

Copilot AI Jul 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deprecation message for hashStyleBlocks incorrectly references slashStyleBlocks. It should reference hashStyleBlocks instead.

Suggested change
"deprecationMessage": "**Deprecated**: Please use `auto-comment-blocks.supportUnsupportedLanguages` with the property key `slashStyleBlocks` instead.",
"deprecationMessage": "**Deprecated**: Please use `auto-comment-blocks.supportUnsupportedLanguages` with the property key `hashStyleBlocks` instead.",

Copilot uses AI. Check for mistakes.

},
"auto-comment-blocks.semicolonStyleBlocks": {
"type": "array",
"default": [],
"markdownDescription": "Add language IDs here to enable `;`-style single-line comment blocks for that language. This allows unsupported languages to have comment completion."
"markdownDescription": "Add language IDs here to enable `;`-style single-line comment blocks for that language. This allows unsupported languages to have comment completion.",
"deprecationMessage": "**Deprecated**: Please use `auto-comment-blocks.supportUnsupportedLanguages` with the property key `slashStyleBlocks` instead.",
Copy link
Preview

Copilot AI Jul 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deprecation message for semicolonStyleBlocks incorrectly references slashStyleBlocks. It should reference semicolonStyleBlocks instead.

Suggested change
"deprecationMessage": "**Deprecated**: Please use `auto-comment-blocks.supportUnsupportedLanguages` with the property key `slashStyleBlocks` instead.",
"deprecationMessage": "**Deprecated**: Please use `auto-comment-blocks.supportUnsupportedLanguages` with the property key `semicolonStyleBlocks` instead.",

Copilot uses AI. Check for mistakes.

}

// Otherwise, return the property array from the new supportUnsupportedLanguages setting.
return this.getConfigurationValue<any>("supportUnsupportedLanguages")[key];
Copy link
Preview

Copilot AI Jul 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using any type defeats TypeScript's type safety. Consider defining a proper interface for the supportUnsupportedLanguages configuration object with properties multiLineStyleBlocks, slashStyleBlocks, hashStyleBlocks, and semicolonStyleBlocks as string arrays.

Suggested change
return this.getConfigurationValue<any>("supportUnsupportedLanguages")[key];
return this.getConfigurationValue<SupportUnsupportedLanguagesConfig>("supportUnsupportedLanguages")[key];

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant