-
Notifications
You must be signed in to change notification settings - Fork 0
Release v1.2.0: Enable language definitions to be auto updated and reconfigured when user settings change. #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…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.
There was a problem hiding this 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.", |
There was a problem hiding this comment.
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.
"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.", |
There was a problem hiding this comment.
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.
"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]; |
There was a problem hiding this comment.
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.
return this.getConfigurationValue<any>("supportUnsupportedLanguages")[key]; | |
return this.getConfigurationValue<SupportUnsupportedLanguagesConfig>("supportUnsupportedLanguages")[key]; |
Copilot uses AI. Check for mistakes.
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 newupdateSingleLineCommentLanguageDefinitions
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.