Socket
Socket
Sign inDemoInstall

@microsoft/vscode-azext-utils

Package Overview
Dependencies
Maintainers
10
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/vscode-azext-utils - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

1

out/src/index.js

@@ -59,2 +59,3 @@ "use strict";

__exportStar(require("./utils/contextUtils"), exports);
__exportStar(require("./utils/credentialUtils"), exports);
__exportStar(require("./utils/findFreePort"), exports);

@@ -61,0 +62,0 @@ __exportStar(require("./utils/nonNull"), exports);

@@ -21,2 +21,4 @@ "use strict";

const vscode_azureresources_api_1 = require("@microsoft/vscode-azureresources-api");
const GenericTreeItem_1 = require("../../../tree/GenericTreeItem");
const localize_1 = require("../../../localize");
/**

@@ -35,2 +37,3 @@ * Provides compatability with {@link AzExtParentTreeItem.pickTreeItemImpl}

return __awaiter(this, void 0, void 0, function* () {
this.setCustomPlaceholder(wizardContext);
(yield this.provideCompatabilityWithPickTreeItemImpl(wizardContext)) || (yield _super.prompt.call(this, wizardContext));

@@ -40,2 +43,13 @@ });

/**
* If the last picked item is an `AzExtParentTreeItem`
* and has a `childTypeLabel` set, use that as the placeholder.
*/
setCustomPlaceholder(context) {
const lastPickedItem = (0, getLastNode_1.getLastNode)(context);
const lastPickedItemUnwrapped = (0, vscode_azureresources_api_1.isWrapper)(lastPickedItem) ? lastPickedItem.unwrap() : lastPickedItem;
if ((0, isAzExtTreeItem_1.isAzExtParentTreeItem)(lastPickedItemUnwrapped) && lastPickedItemUnwrapped.childTypeLabel) {
this.promptOptions.placeHolder = (0, localize_1.localize)('selectTreeItem', 'Select {0}', lastPickedItemUnwrapped.childTypeLabel);
}
}
/**
* Mimics how the legacy {@link AzExtParentTreeItem.pickChildTreeItem}

@@ -53,2 +67,6 @@ * uses {@link AzExtParentTreeItem.pickTreeItemImpl} to customize the tree item picker.

if (children && children.length) {
if (this.pickOptions.skipIfOne) {
// don't skip if one if a command pick is present
this.pickOptions.skipIfOne = !children.some(child => (0, GenericTreeItem_1.isGenericTreeItem)(child) || child instanceof GenericTreeItem_1.GenericTreeItem);
}
const customChild = yield this.getCustomChildren(wizardContext, lastPickedItemUnwrapped);

@@ -85,3 +103,18 @@ const customPick = children.find((child) => {

}
/**
* Mimics logic in `AzExtTreeItem.includeInTreePicker`, which supports the `AzExtTreeItem.isAncestorOfImpl` method
*/
isAncestorPick(_node, elementWrapper) {
const element = (0, vscode_azureresources_api_1.isWrapper)(elementWrapper) ? elementWrapper.unwrap() : elementWrapper;
const include = Array.isArray(this.pickOptions.contextValueFilter.include) ? this.pickOptions.contextValueFilter.include : [this.pickOptions.contextValueFilter.include];
return include.some((val) => {
if ((0, isAzExtTreeItem_1.isAzExtTreeItem)(element) && element.isAncestorOfImpl) {
return element.isAncestorOfImpl(val);
}
else {
return (0, isAzExtTreeItem_1.isAzExtParentTreeItem)(element);
}
});
}
}
//# sourceMappingURL=CompatibilityContextValueQuickPickStep.js.map

4

out/src/pickTreeItem/contextValue/compatibility/CompatibilityRecursiveQuickPickStep.js

@@ -62,3 +62,3 @@ "use strict";

const ti = (0, isAzExtTreeItem_1.isAzExtTreeItem)(lastPickedItem) ? lastPickedItem : yield this.treeDataProvider.getTreeItem(lastPickedItem);
if (this.pickFilter.isFinalPick(ti)) {
if (this.pickFilter.isFinalPick(ti, lastPickedItem)) {
// The last picked node matches the expected filter

@@ -81,3 +81,3 @@ // No need to continue prompting

promptSteps: [
new CompatibilityRecursiveQuickPickStep(this.treeDataProvider, Object.assign(Object.assign({}, this.pickOptions), { skipIfOne: !shouldAddCreatePick, create: shouldAddCreatePick ? {
new CompatibilityRecursiveQuickPickStep(this.treeDataProvider, Object.assign(Object.assign({}, this.pickOptions), { create: shouldAddCreatePick ? {
callback: lastPickedItemTi.createChild.bind(lastPickedItemTi),

@@ -84,0 +84,0 @@ label: (_a = lastPickedItemTi.createNewLabel) !== null && _a !== void 0 ? _a : (0, localize_1.localize)('createNewItem', '$(plus) Create new {0}', lastPickedItemTi.childTypeLabel)

@@ -32,5 +32,5 @@ "use strict";

}
isAncestorPick(node) {
isAncestorPick(treeItem, _element) {
// `TreeItemCollapsibleState.None` and `undefined` are both falsy, and indicate that a `TreeItem` cannot have children--and therefore, cannot be an ancestor pick
return !!node.collapsibleState;
return !!treeItem.collapsibleState;
}

@@ -37,0 +37,0 @@ matchesSingleFilter(matcher, nodeContextValues) {

@@ -31,3 +31,3 @@ "use strict";

}
if (this.pickFilter.isFinalPick(yield this.treeDataProvider.getTreeItem(lastPickedItem))) {
if (this.pickFilter.isFinalPick(yield this.treeDataProvider.getTreeItem(lastPickedItem), lastPickedItem)) {
// The last picked node matches the expected filter

@@ -34,0 +34,0 @@ // No need to continue prompting

@@ -60,4 +60,4 @@ "use strict";

const childPairs = childElements.map((childElement, i) => [childElement, childItems[i]]);
const finalChoices = childPairs.filter(([, ti]) => this.pickFilter.isFinalPick(ti));
const ancestorChoices = childPairs.filter(([, ti]) => this.pickFilter.isAncestorPick(ti));
const finalChoices = childPairs.filter(([el, ti]) => this.pickFilter.isFinalPick(ti, el));
const ancestorChoices = childPairs.filter(([el, ti]) => this.pickFilter.isAncestorPick(ti, el));
let promptChoices = [];

@@ -64,0 +64,0 @@ if (finalChoices.length === 0) {

@@ -7,3 +7,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.GenericTreeItem = void 0;
exports.isGenericTreeItem = exports.GenericTreeItem = void 0;
const AzExtTreeItem_1 = require("./AzExtTreeItem");

@@ -13,2 +13,3 @@ class GenericTreeItem extends AzExtTreeItem_1.AzExtTreeItem {

super(parent);
this._isGenericTreeItem = true;
this.label = options.label;

@@ -27,2 +28,6 @@ this.contextValue = options.contextValue;

exports.GenericTreeItem = GenericTreeItem;
function isGenericTreeItem(item) {
return typeof item === 'object' && item._isGenericTreeItem;
}
exports.isGenericTreeItem = isGenericTreeItem;
//# sourceMappingURL=GenericTreeItem.js.map

@@ -45,4 +45,2 @@ "use strict";

* Creates a subscription context from an application subscription.
*
* TODO: expose these utils and remove duplicate code in resource groups + client extensions
*/

@@ -49,0 +47,0 @@ function createSubscriptionContext(subscription) {

{
"name": "@microsoft/vscode-azext-utils",
"author": "Microsoft Corporation",
"version": "0.4.1",
"version": "0.4.2",
"description": "Common UI tools for developing Azure extensions for VS Code",

@@ -6,0 +6,0 @@ "tags": [

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc