-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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.4", | ||||||
"version": "1.2.0", | ||||||
"publisher": "ycodetech", | ||||||
"homepage": "https://github.com/ycodetech/auto-comment-blocks", | ||||||
"repository": { | ||||||
|
@@ -45,28 +45,74 @@ | |||||
"default": [], | ||||||
"markdownDescription": "Add language IDs here to disable any comment completion for that language." | ||||||
}, | ||||||
"auto-comment-blocks.supportUnsupportedLanguages": { | ||||||
"type": "object", | ||||||
"default": { | ||||||
"multiLineStyleBlocks": [ | ||||||
"blade", | ||||||
"html" | ||||||
], | ||||||
"slashStyleBlocks": [], | ||||||
"hashStyleBlocks": [], | ||||||
"semicolonStyleBlocks": [] | ||||||
}, | ||||||
"markdownDescription": "Enables unsupported languages to have comment completion. \n\rProperties: \n- `multiLineStyleBlocks` to enable multi-line block comment support. The default is `['blade', 'html']` \n- `slashStyleBlocks` to enable `//`-style single-line comment support. \n- `hashStyleBlocks` to enable `#`-style single-line comment support. \n- `semicolonStyleBlocks` to enable `;`-style single-line comment support.", | ||||||
"properties": { | ||||||
"multiLineStyleBlocks": { | ||||||
"type": "array", | ||||||
"default": [ | ||||||
"blade", | ||||||
"html" | ||||||
], | ||||||
"markdownDescription": "Add language IDs here to enable multi line comment blocks support for that language. This allows unsupported languages to have comment completion. The default is `['blade', 'html']`" | ||||||
}, | ||||||
"slashStyleBlocks": { | ||||||
"type": "array", | ||||||
"default": [], | ||||||
"markdownDescription": "Add language IDs to enable `//`-style single-line comment blocks for that language." | ||||||
}, | ||||||
"hashStyleBlocks": { | ||||||
"type": "array", | ||||||
"default": [], | ||||||
"markdownDescription": "Add language IDs to enable `#`-style single-line comment blocks for that language." | ||||||
}, | ||||||
"semicolonStyleBlocks": { | ||||||
"type": "array", | ||||||
"default": [], | ||||||
"markdownDescription": "Add language IDs to enable `;`-style single-line comment blocks for that language." | ||||||
} | ||||||
} | ||||||
}, | ||||||
"auto-comment-blocks.slashStyleBlocks": { | ||||||
"type": "array", | ||||||
"default": [], | ||||||
"markdownDescription": "Add language IDs here to enable `//` and `///`-style single-line comment blocks for that language. This allows unsupported languages to have comment completion." | ||||||
"markdownDescription": "Add language IDs here to enable `//` and `///`-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.", | ||||||
"markdownDeprecationMessage": "**Deprecated**: Please use `#auto-comment-blocks.supportUnsupportedLanguages#` with the property key `slashStyleBlocks` instead." | ||||||
}, | ||||||
"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.", | ||||||
"markdownDeprecationMessage": "**Deprecated**: Please use `#auto-comment-blocks.supportUnsupportedLanguages#` with the property key `hashStyleBlocks` instead." | ||||||
}, | ||||||
"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 commentThe reason will be displayed to describe this comment to others. Learn more. The deprecation message for
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
"markdownDeprecationMessage": "**Deprecated**: Please use `#auto-comment-blocks.supportUnsupportedLanguages#` with the property key `semicolonStyleBlocks` instead." | ||||||
}, | ||||||
"auto-comment-blocks.multiLineStyleBlocks": { | ||||||
"type": "array", | ||||||
"default": [ | ||||||
"blade", | ||||||
"html" | ||||||
], | ||||||
"markdownDescription": "Add language IDs here to enable multi-line comment blocks support for that language. This allows unsupported languages to have comment completion. The default is `['blade', 'html']`" | ||||||
"markdownDescription": "Add language IDs here to enable multi-line comment blocks support for that language. This allows unsupported languages to have comment completion. The default is `['blade', 'html']`", | ||||||
"deprecationMessage": "**Deprecated**: Please use `auto-comment-blocks.supportUnsupportedLanguages` with the property key `multiLineStyleBlocks` instead.", | ||||||
"markdownDeprecationMessage": "**Deprecated**: Please use `#auto-comment-blocks.supportUnsupportedLanguages#` with the property key `multiLineStyleBlocks` instead." | ||||||
}, | ||||||
"auto-comment-blocks.overrideDefaultLanguageMultiLineComments": { | ||||||
"type": "object", | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -247,6 +247,17 @@ export class Configuration { | |||||
return this.getConfigurationValue<string[]>("disabledLanguages").includes(langId); | ||||||
} | ||||||
|
||||||
/** | ||||||
* Update the single-line comment language definitions. | ||||||
*/ | ||||||
public updateSingleLineCommentLanguageDefinitions() { | ||||||
// Remove all elements from the current Map, so we can update | ||||||
// the definitions with an empty Map. | ||||||
this.singleLineBlocksMap.clear(); | ||||||
// Update the definitions. | ||||||
this.setSingleLineCommentLanguageDefinitions(); | ||||||
} | ||||||
|
||||||
/** | ||||||
* Is the multi-line comment overridden for the specified language ID? | ||||||
* | ||||||
|
@@ -271,6 +282,31 @@ export class Configuration { | |||||
return overriddenList[langId]; | ||||||
} | ||||||
|
||||||
/** | ||||||
* Get the custom supported language configuration value for the specified key. | ||||||
* | ||||||
* Decides which setting to return, either the old or new setting. | ||||||
* | ||||||
* @param {string} key - The configuration key to retrieve. Can be one of `"slashStyleBlocks"`, `"hashStyleBlocks"`, or `"semicolonStyleBlocks"`. | ||||||
* @returns {string[]} An array of strings representing the configuration values. | ||||||
*/ | ||||||
private getCustomSupportedLangConfigurationValue(key: "slashStyleBlocks" | "hashStyleBlocks" | "semicolonStyleBlocks"): string[] { | ||||||
/** | ||||||
* @deprecated since v1.2.0, will be removed in v2.0.0 | ||||||
*/ | ||||||
// Get the old configuration property. | ||||||
const oldConfigProp = this.getConfigurationValue<string[]>(key); | ||||||
|
||||||
// If old config property has a length more than 0 (ie. it has values in the array), | ||||||
// then return the old property array. | ||||||
if (oldConfigProp.length > 0) { | ||||||
return oldConfigProp; | ||||||
} | ||||||
|
||||||
// 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 commentThe reason will be displayed to describe this comment to others. Learn more. Using
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
} | ||||||
|
||||||
/** | ||||||
* Get an array of languages to skip, like plaintext, that don't have comment syntax | ||||||
* | ||||||
|
@@ -509,23 +545,23 @@ export class Configuration { | |||||
tempMap.clear(); | ||||||
|
||||||
// Get user-customized langIds for the //-style and add to the map. | ||||||
let customSlashLangs = this.getConfigurationValue<string[]>("slashStyleBlocks"); | ||||||
let customSlashLangs = this.getCustomSupportedLangConfigurationValue("slashStyleBlocks"); | ||||||
for (let langId of customSlashLangs) { | ||||||
if (langId && langId.length > 0) { | ||||||
tempMap.set(langId, "//"); | ||||||
} | ||||||
} | ||||||
|
||||||
// Get user-customized langIds for the #-style and add to the map. | ||||||
let customHashLangs = this.getConfigurationValue<string[]>("hashStyleBlocks"); | ||||||
let customHashLangs = this.getCustomSupportedLangConfigurationValue("hashStyleBlocks"); | ||||||
for (let langId of customHashLangs) { | ||||||
if (langId && langId.length > 0) { | ||||||
tempMap.set(langId, "#"); | ||||||
} | ||||||
} | ||||||
|
||||||
// Get user-customized langIds for the ;-style and add to the map. | ||||||
let customSemicolonLangs = this.getConfigurationValue<string[]>("semicolonStyleBlocks"); | ||||||
let customSemicolonLangs = this.getCustomSupportedLangConfigurationValue("semicolonStyleBlocks"); | ||||||
for (let langId of customSemicolonLangs) { | ||||||
if (langId && langId.length > 0) { | ||||||
tempMap.set(langId, ";"); | ||||||
|
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 referencesslashStyleBlocks
. It should referencehashStyleBlocks
instead.Copilot uses AI. Check for mistakes.