Skip to content

Commit 6534893

Browse files
committed
feat: add a dedicated namespace property for the extensionData.
- Added an optional `namespace` property in the `ExtensionMetaData` interface. - Move the configuration namespace value of the `name` property in `setExtensionData` to the new `namespace` property as it's value. - Set the `name` property n `setExtensionData` to the name in the packageJson instead of the configuration namespace. - Change all occurrences of getting the `name` property to the new `namespace` property since each occurrence is for the namespace and not the actual name.
1 parent 824ce9b commit 6534893

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/configuration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export class Configuration {
220220
* @returns {vscode.WorkspaceConfiguration}
221221
*/
222222
public getConfiguration(): vscode.WorkspaceConfiguration {
223-
return vscode.workspace.getConfiguration(this.extensionData.get("name"), null);
223+
return vscode.workspace.getConfiguration(this.extensionData.get("namespace"), null);
224224
}
225225

226226
/**
@@ -932,7 +932,7 @@ export class Configuration {
932932
*/
933933
private handleChangeBladeMultiLineBlock(textEditor: vscode.TextEditor) {
934934
let langId = textEditor.document.languageId;
935-
const extensionName = this.extensionData.get("name");
935+
const extensionName = this.extensionData.get("namespace");
936936

937937
// Only carry out function if languageId is blade.
938938
if (langId === "blade" && !this.isLangIdDisabled(langId)) {

src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function activate(context: vscode.ExtensionContext) {
1818

1919
disposables.push(...configureCommentBlocksDisposable, ...registerCommandsDisposable);
2020

21-
const extensionName = extensionData.get("name");
21+
const extensionName = extensionData.get("namespace");
2222

2323
const extensionDisplayName = extensionData.get("displayName");
2424

src/extensionData.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export class ExtensionData {
6060

6161
// Set each key-value pair directly into the Map
6262
this.extensionData.set("id", this.packageJsonData.id);
63-
this.extensionData.set("name", this.packageJsonData.contributes.configuration.namespace);
63+
this.extensionData.set("name", this.packageJsonData.name);
64+
this.extensionData.set("namespace", this.packageJsonData.contributes.configuration.namespace);
6465
this.extensionData.set("displayName", this.packageJsonData.displayName);
6566
this.extensionData.set("version", this.packageJsonData.version);
6667
this.extensionData.set("userExtensionsPath", userExtensionsPath);

src/interfaces/extensionMetaData.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export interface ExtensionMetaData {
22
id: string;
33
name: string;
4+
namespace?: string;
45
displayName: string;
56
version: string;
67
userExtensionsPath: string;

0 commit comments

Comments
 (0)