Skip to content

Commit 056b0c5

Browse files
Simplify app setting visibility toggle - remove complex monkey-patching
Co-authored-by: alexweininger <[email protected]>
1 parent c9cffe4 commit 056b0c5

File tree

4 files changed

+6
-66
lines changed

4 files changed

+6
-66
lines changed

main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ let perfStats = {
1616

1717
Object.defineProperty(exports, "__esModule", { value: true });
1818

19-
const extension = require('./out/src/extension');
19+
const extension = require('./dist/extension.bundle');
2020

2121
async function activate(ctx) {
22-
return await extension.activateInternal(ctx, perfStats, true /* ignoreBundle */);
22+
return await extension.activateInternal(ctx, perfStats);
2323
}
2424

2525
async function deactivate(ctx) {

package.json

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -365,19 +365,7 @@
365365
"command": "azureFunctions.toggleAppSettingVisibility",
366366
"title": "%azureFunctions.toggleAppSettingVisibility%",
367367
"category": "Azure Functions",
368-
"icon": "$(eye)"
369-
},
370-
{
371-
"command": "azureFunctions.showAppSettingValue",
372-
"title": "%azureFunctions.showAppSettingValue%",
373-
"category": "Azure Functions",
374-
"icon": "$(eye)"
375-
},
376-
{
377-
"command": "azureFunctions.hideAppSettingValue",
378-
"title": "%azureFunctions.hideAppSettingValue%",
379-
"category": "Azure Functions",
380-
"icon": "$(eye-closed)"
368+
"icon": "$(eye-watch)"
381369
},
382370
{
383371
"command": "azureFunctions.uninstallFuncCoreTools",
@@ -729,13 +717,8 @@
729717
"group": "1@4"
730718
},
731719
{
732-
"command": "azureFunctions.showAppSettingValue",
733-
"when": "view =~ /(azureResourceGroups|azureFocusView|azureWorkspace)/ && viewItem =~ /applicationSettingItem.*(azFunc|localSettings).*hidden/",
734-
"group": "inline"
735-
},
736-
{
737-
"command": "azureFunctions.hideAppSettingValue",
738-
"when": "view =~ /(azureResourceGroups|azureFocusView|azureWorkspace)/ && viewItem =~ /applicationSettingItem.*(azFunc|localSettings).*visible/",
720+
"command": "azureFunctions.toggleAppSettingVisibility",
721+
"when": "view =~ /(azureResourceGroups|azureFocusView|azureWorkspace)/ && viewItem =~ /applicationSettingItem.*(azFunc|localSettings)/",
739722
"group": "inline"
740723
},
741724
{
@@ -916,14 +899,6 @@
916899
"command": "azureFunctions.toggleAppSettingVisibility",
917900
"when": "never"
918901
},
919-
{
920-
"command": "azureFunctions.showAppSettingValue",
921-
"when": "never"
922-
},
923-
{
924-
"command": "azureFunctions.hideAppSettingValue",
925-
"when": "never"
926-
},
927902
{
928903
"command": "azureFunctions.viewProperties",
929904
"when": "never"

package.nls.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@
108108
"azureFunctions.templateSource.default": "Default behavior using the best source available.",
109109
"azureFunctions.templateSource.staging": "Use the very latest templates from the staging template source.",
110110
"azureFunctions.templateVersion": "A runtime release version (any runtime) that species which templates will be used rather than the latest templates. This version will be used for ALL runtimes. (Requires a restart of VS Code to take effect)",
111-
"azureFunctions.toggleAppSettingVisibility": "Toggle App Setting Visibility.",
112-
"azureFunctions.showAppSettingValue": "Show App Setting Value",
113-
"azureFunctions.hideAppSettingValue": "Hide App Setting Value",
111+
"azureFunctions.toggleAppSettingVisibility": "Toggle App Setting Value Visibility",
114112
"azureFunctions.uninstallFuncCoreTools": "Uninstall Azure Functions Core Tools",
115113
"azureFunctions.validateFuncCoreTools": "Validate the Azure Functions Core Tools is installed before debugging.",
116114
"azureFunctions.viewCommitInGitHub": "View Commit in GitHub",

src/commands/registerCommands.ts

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -171,46 +171,13 @@ export function registerCommands(
171171
registerCommandWithTreeNodeUnwrapping('azureFunctions.stopFunctionApp', stopFunctionApp);
172172
registerCommandWithTreeNodeUnwrapping('azureFunctions.stopStreamingLogs', stopStreamingLogs);
173173
registerCommandWithTreeNodeUnwrapping('azureFunctions.swapSlot', swapSlot);
174-
// Monkey-patch AppSettingTreeItem to include visibility state in contextValue
175-
const originalContextValueGetter = Object.getOwnPropertyDescriptor(AppSettingTreeItem.prototype, 'contextValue')?.get;
176-
if (originalContextValueGetter) {
177-
Object.defineProperty(AppSettingTreeItem.prototype, 'contextValue', {
178-
get: function (this: AppSettingTreeItem) {
179-
const originalValue = originalContextValueGetter.call(this) as string;
180-
const isHidden = (this.label as string).includes('Hidden value');
181-
return isHidden ? `${originalValue};hidden` : `${originalValue};visible`;
182-
},
183-
configurable: true
184-
});
185-
}
186-
187174
registerCommandWithTreeNodeUnwrapping(
188175
'azureFunctions.toggleAppSettingVisibility',
189176
async (context: IActionContext, node: AppSettingTreeItem) => {
190177
await node.toggleValueVisibility(context);
191178
},
192179
250,
193180
);
194-
registerCommandWithTreeNodeUnwrapping(
195-
'azureFunctions.showAppSettingValue',
196-
async (context: IActionContext, node: AppSettingTreeItem) => {
197-
// Only show if currently hidden
198-
if (node.label.includes('Hidden value')) {
199-
await node.toggleValueVisibility(context);
200-
}
201-
},
202-
250,
203-
);
204-
registerCommandWithTreeNodeUnwrapping(
205-
'azureFunctions.hideAppSettingValue',
206-
async (context: IActionContext, node: AppSettingTreeItem) => {
207-
// Only hide if currently shown
208-
if (!node.label.includes('Hidden value')) {
209-
await node.toggleValueVisibility(context);
210-
}
211-
},
212-
250,
213-
);
214181
registerCommandWithTreeNodeUnwrapping('azureFunctions.uninstallFuncCoreTools', uninstallFuncCoreTools);
215182
registerCommandWithTreeNodeUnwrapping('azureFunctions.viewCommitInGitHub', viewCommitInGitHub);
216183
registerSiteCommand('azureFunctions.viewDeploymentLogs', unwrapTreeNodeCommandCallback(viewDeploymentLogs));

0 commit comments

Comments
 (0)