Socket
Socket
Sign inDemoInstall

@microsoft/vscode-azext-utils

Package Overview
Dependencies
Maintainers
10
Versions
86
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.2.5 to 0.3.0

out/src/tree/CollapsibleStateTracker.js

18

hostapi.d.ts

@@ -90,7 +90,14 @@ /*---------------------------------------------------------------------------------------------

export interface AppResourceFilter {
/**
* App resource type to filter the app resource picks
*/
type: string;
/**
* (Optional) App resource kind to filter the app resource picks
*/
kind?: string;
/**
* ARM tags that must be present on the resource. Resource must match all provided tags.
* (Optional) ARM tags that must be present on the resource. Resource must match all provided tags.
*/

@@ -110,2 +117,9 @@ tags?: Record<string, string>;

expectedChildContextValue?: string | RegExp | (string | RegExp)[];
/**
* Whether `AppResourceTreeItem`s should be resolved before displaying them as quick picks, or only once one has been selected
* If a client extension needs to change label/description/something visible on the quick pick via `resolve`, set to true,
* otherwise set to false. Default will be false.
*/
resolveQuickPicksBeforeDisplay?: boolean;
}

@@ -112,0 +126,0 @@

@@ -9,3 +9,3 @@ /*---------------------------------------------------------------------------------------------

import type { Environment } from '@azure/ms-rest-azure-env';
import { CancellationToken, CancellationTokenSource, Disposable, Event, ExtensionContext, FileChangeEvent, FileChangeType, FileStat, FileSystemProvider, FileType, InputBoxOptions, MarkdownString, MessageItem, MessageOptions, OpenDialogOptions, OutputChannel, Progress, QuickPickItem, QuickPickOptions, TextDocumentShowOptions, ThemeIcon, TreeDataProvider, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode';
import { CancellationToken, CancellationTokenSource, Disposable, Event, ExtensionContext, FileChangeEvent, FileChangeType, FileStat, FileSystemProvider, FileType, InputBoxOptions, MarkdownString, MessageItem, MessageOptions, OpenDialogOptions, OutputChannel, Progress, QuickPickItem, QuickPickOptions, TextDocumentShowOptions, ThemeIcon, TreeDataProvider, TreeItem, TreeItemCollapsibleState, TreeView, Uri } from 'vscode';
import { TargetPopulation } from 'vscode-tas-client';

@@ -23,2 +23,7 @@ import { AzureExtensionApi, AzureExtensionApiProvider } from './api';

/**
* Fired when a tree item is expanded, or the view is refreshed and that tree item is auto-expanded by VSCode. Note, this event cannot be accessed unless `trackTreeItemCollapsibleState` is called first!
*/
public onDidExpandOrRefreshExpandedTreeItem: Event<AzExtTreeItem>;
/**
* Azure Tree Data Provider

@@ -85,2 +90,8 @@ * @param rootTreeItem The root tree item. This item will not actually be displayed - just used to provide children.

public getParent(treeItem: AzExtTreeItem): Promise<AzExtTreeItem | undefined>;
/**
* Call to track the collapsible state of tree items in the tree view.
* @param treeView The tree view to watch the collapsible state for. This must be the tree view created from this `AzExtTreeDataProvider`.
*/
public trackTreeItemCollapsibleState(treeView: TreeView<AzExtTreeItem>): Disposable;
}

@@ -214,2 +225,8 @@

/**
* If the `AzExtTreeDataProvider.trackTreeItemCollapsibleState` has been called, this should return the true TreeItemCollapsibleState
* Otherwise, it will return whatever initial value is given
*/
readonly collapsibleState: TreeItemCollapsibleState | undefined;
/**
* Set to true if the label of this tree item does not need to be masked

@@ -254,3 +271,3 @@ */

collapsibleState?: TreeItemCollapsibleState;
initialCollapsibleState?: TreeItemCollapsibleState;

@@ -367,2 +384,4 @@ /**

public get collapsibleState(): TreeItemCollapsibleState | undefined;
/**

@@ -526,2 +545,7 @@ * The arguments to pass in when executing `commandId`. If not specified, this tree item will be used.

/**
* Sets the initial collapsible state.
*/
public readonly initialCollapsibleState: TreeItemCollapsibleState | undefined;
//#region Methods implemented by base class

@@ -920,2 +944,7 @@ /**

/**
* Specifies the sort priority of a quick pick item
*/
export type AzureQuickPickItemPriority = 'highest' | 'normal'; // 'highest' items come before the recently used item
/**
* Provides additional options for QuickPickItems used in Azure Extensions

@@ -951,3 +980,3 @@ */

*/
priority?: 'highest' | 'normal'; // 'highest' items come before the recently used item
priority?: AzureQuickPickItemPriority;
}

@@ -954,0 +983,0 @@

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

//#endregion
this.collapsibleState = vscode_1.TreeItemCollapsibleState.Collapsed;
this.initialCollapsibleState = vscode_1.TreeItemCollapsibleState.Collapsed;
this._isAzExtParentTreeItem = true;

@@ -231,2 +231,3 @@ this._cachedChildren = [];

loadMoreChildrenInternal(context) {
var _a;
return __awaiter(this, void 0, void 0, function* () {

@@ -247,2 +248,5 @@ try {

}
if (this.collapsibleState === vscode_1.TreeItemCollapsibleState.Expanded) {
(_a = this.treeDataProvider.collapsibleStateTracker) === null || _a === void 0 ? void 0 : _a.onDidExpandOrRefreshExpandedEmitter.fire(this);
}
const newTreeItems = yield this.loadMoreChildrenImpl(this._clearCache, context);

@@ -249,0 +253,0 @@ this._cachedChildren = this._cachedChildren.concat(newTreeItems).sort((ti1, ti2) => this.compareChildrenImpl(ti1, ti2));

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

const AzExtParentTreeItem_1 = require("./AzExtParentTreeItem");
const CollapsibleStateTracker_1 = require("./CollapsibleStateTracker");
const GenericTreeItem_1 = require("./GenericTreeItem");

@@ -44,2 +45,14 @@ const InternalInterfaces_1 = require("./InternalInterfaces");

}
get onDidExpandOrRefreshExpandedTreeItem() {
if (!this.collapsibleStateTracker) {
throw new Error('To use the `onDidExpandOrRefreshExpandedTreeItem`, first call `trackTreeItemCollapsibleState`.');
}
return this.collapsibleStateTracker.onDidExpandOrRefreshExpandedEmitter.event;
}
get collapsibleStateTracker() {
return this._collapsibleStateTracker;
}
trackTreeItemCollapsibleState(treeView) {
return (this._collapsibleStateTracker = new CollapsibleStateTracker_1.CollapsibleStateTracker(treeView));
}
getTreeItem(treeItem) {

@@ -49,3 +62,3 @@ return {

description: treeItem.effectiveDescription,
id: treeItem.fullIdWithContext || treeItem.fullId,
id: treeItem.effectiveId,
collapsibleState: treeItem.collapsibleState,

@@ -52,0 +65,0 @@ contextValue: treeItem.contextValue,

@@ -27,2 +27,12 @@ "use strict";

}
get collapsibleState() {
if (!(0, InternalInterfaces_1.isAzExtParentTreeItem)(this)) {
// If it's not a AzExtParentTreeItem, we can always return undefined (which is what the default was before)
return undefined;
}
if (this.treeDataProvider.collapsibleStateTracker) {
return this.treeDataProvider.collapsibleStateTracker.getCollapsibleState(this);
}
return this.initialCollapsibleState;
}
get effectiveDescription() {

@@ -53,2 +63,5 @@ return this._temporaryDescription || this.description;

}
get effectiveId() {
return this.fullIdWithContext || this.fullId;
}
set iconPath(iconPath) {

@@ -55,0 +68,0 @@ this._iconPath = iconPath;

22

out/src/userInput/showQuickPick.js

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.createQuickPick = exports.showQuickPick = void 0;
exports.createQuickPickItems = exports.createQuickPick = exports.showQuickPick = void 0;
const vscode_1 = require("vscode");

@@ -26,2 +26,3 @@ const constants_1 = require("../constants");

const randomUtils_1 = require("../utils/randomUtils");
// Picks are shown in given order, except higher priority items and recently used are moved to the top, and items are grouped if requiested
function showQuickPick(context, picks, options) {

@@ -83,3 +84,3 @@ return __awaiter(this, void 0, void 0, function* () {

try {
quickPick.items = yield initializePicks(picks, options, groups, recentlyUsedKey);
quickPick.items = yield createQuickPickItems(picks, options, groups, recentlyUsedKey);
if (shouldDisplayGroups(groups)) {

@@ -153,8 +154,8 @@ // If grouping is enabled, make the first actual pick active by default, rather than the group label pick

}
function initializePicks(picks, options, groups, recentlyUsedKey) {
// Exported for testing. globalState should be undefined except for testing.
function createQuickPickItems(picks, options, groups, recentlyUsedKey, globalState = undefined) {
return __awaiter(this, void 0, void 0, function* () {
picks = yield picks;
if (recentlyUsedKey && !options.suppressPersistence) {
bumpRecentlyUsedPick(picks, recentlyUsedKey);
}
globalState !== null && globalState !== void 0 ? globalState : (globalState = extensionVariables_1.ext.context.globalState);
picks = bumpHighPriorityAndRecentlyUsed(picks, globalState, !!options.suppressPersistence, recentlyUsedKey);
if (picks.length === 0) {

@@ -187,4 +188,5 @@ if (options.noPicksMessage) {

}
function bumpRecentlyUsedPick(picks, recentlyUsedKey) {
const recentlyUsedValue = extensionVariables_1.ext.context.globalState.get(recentlyUsedKey);
exports.createQuickPickItems = createQuickPickItems;
function bumpHighPriorityAndRecentlyUsed(picks, globalState, suppressPersistance, recentlyUsedKey) {
const recentlyUsedValue = (suppressPersistance || !recentlyUsedKey) ? undefined : globalState.get(recentlyUsedKey);
let recentlyUsedIndex = -1;

@@ -210,3 +212,3 @@ if (recentlyUsedValue) {

}
picks = stableSortPicks(picks, recentlyUsedIndex);
return stableSortPicks(picks, recentlyUsedIndex);
}

@@ -226,3 +228,3 @@ function stableSortPicks(picks, recentlyUsedIndex) {

// Note that since ES10, Array.sort is stable
sortableFacade.sort((a, b) => b[1] - a[1]);
sortableFacade.sort((a, b) => a[1] - b[1]);
// Reconstitute array by pulling out items by index

@@ -229,0 +231,0 @@ const sortedPicks = sortableFacade.map(item => picks[item[0]]);

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

@@ -35,10 +35,10 @@ "tags": [

"dependencies": {
"@vscode/extension-telemetry": "^0.4.7",
"dayjs": "^1.9.3",
"@vscode/extension-telemetry": "^0.5.1",
"dayjs": "^1.11.2",
"escape-string-regexp": "^2.0.0",
"html-to-text": "^5.1.1",
"open": "^8.0.4",
"semver": "^5.7.1",
"vscode-nls": "^4.1.1",
"vscode-tas-client": "^0.1.22"
"semver": "^7.3.7",
"vscode-nls": "^5.0.1",
"vscode-tas-client": "^0.1.47"
},

@@ -48,9 +48,7 @@ "devDependencies": {

"@microsoft/eslint-config-azuretools": "^0.1.0",
"@microsoft/vscode-azext-dev": "^0.1.1",
"@types/fs-extra": "^8.1.0",
"@microsoft/vscode-azext-dev": "^0.1.3",
"@types/html-to-text": "^1.4.31",
"@types/mocha": "^7.0.2",
"@types/node": "^14.0.0",
"@types/semver": "^5.5.0",
"@types/uuid": "^8.3.1",
"@types/semver": "^7.3.9",
"@types/vscode": "1.57.0",

@@ -57,0 +55,0 @@ "@typescript-eslint/eslint-plugin": "^4.28.3",

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