From 43c9f2a97c7dec6b7285993cb6f0bae38e1e78d7 Mon Sep 17 00:00:00 2001 From: zFernand0 <37381190+zFernand0@users.noreply.github.com> Date: Thu, 25 Jul 2024 10:53:03 -0400 Subject: [PATCH] types: Add missing return types, see #2952 Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com> --- .../zowe-explorer-api/__mocks__/vscode.ts | 78 +++++------ .../src/extend/IApiExplorerExtender.ts | 4 +- .../zowe-explorer-api/src/tree/IZoweTree.ts | 122 ++++++++++++------ .../__tests__/__mocks__/DatasetTree.ts | 6 +- .../__tests__/__mocks__/USSTree.ts | 24 ++-- .../src/trees/dataset/DatasetActions.ts | 2 +- .../src/trees/dataset/DatasetTree.ts | 4 +- .../zowe-explorer/src/trees/job/JobTree.ts | 5 +- .../src/trees/shared/SharedInit.ts | 4 +- .../zowe-explorer/src/trees/uss/USSTree.ts | 3 +- 10 files changed, 144 insertions(+), 108 deletions(-) diff --git a/packages/zowe-explorer-api/__mocks__/vscode.ts b/packages/zowe-explorer-api/__mocks__/vscode.ts index 009aa42aeb..7a86f4bb85 100644 --- a/packages/zowe-explorer-api/__mocks__/vscode.ts +++ b/packages/zowe-explorer-api/__mocks__/vscode.ts @@ -136,7 +136,7 @@ export class CancellationTokenSource { } export namespace extensions { - export function getExtension(identifier: string) { + export function getExtension(_identifier: string): { packageJSON: { version: string } } { return { packageJSON: { version: "2.0.0", @@ -289,32 +289,32 @@ export namespace window { * @param items A set of items that will be rendered as actions in the message. * @return A thenable that resolves to the selected item or `undefined` when being dismissed. */ - export function showInformationMessage(message: string, ...items: string[]): Thenable { + export function showInformationMessage(_message: string, ..._items: string[]): Thenable { return Promise.resolve(""); } - export function showErrorMessage(message: string, ...items: string[]): undefined { + export function showErrorMessage(_message: string, ..._items: string[]): undefined { return undefined; } - export function showWarningMessage(message: string, ...items: string[]): undefined { + export function showWarningMessage(_message: string, ..._items: string[]): undefined { return undefined; } - export function setStatusBarMessage(message: string, ...items: string[]): undefined { + export function setStatusBarMessage(_message: string, ..._items: string[]): undefined { return undefined; } - export function createQuickPick(): QuickPick { + export function createQuickPick(): QuickPick | undefined { return undefined; } export function showQuickPick( - items: readonly T[] | Thenable, - options?: QuickPickOptions & { canPickMany: true }, - token?: CancellationToken + _items: readonly T[] | Thenable, + _options?: QuickPickOptions & { canPickMany: true }, + _token?: CancellationToken ): Thenable { - return undefined; + return Promise.resolve(undefined); } /** @@ -360,11 +360,11 @@ export namespace commands { * @param thisArg The `this` context used when invoking the handler function. * @return Disposable which unregisters this command on disposal. */ - export function registerCommand(command: string, callback: (...args: any[]) => any, thisArg?: any): Disposable { + export function registerCommand(_command: string, callback: (...args: any[]) => any, _thisArg?: any): Disposable | undefined { return undefined; } - export function executeCommand(command: string): undefined { + export function executeCommand(_command: string): undefined { return undefined; } } @@ -377,7 +377,7 @@ export class Disposable { constructor() {} } -export function RelativePattern(base: string, pattern: string) { +export function RelativePattern(_base: string, _pattern: string): {} { return {}; } @@ -430,7 +430,7 @@ export class Uri { public static file(path: string): Uri { return Uri.parse(path); } - public static parse(value: string, strict?: boolean): Uri { + public static parse(value: string, _strict?: boolean): Uri { const newUri = new Uri(); newUri.path = value; @@ -722,7 +722,7 @@ export class EventEmitter { * * @param data The event object. */ - fire(data?: T): void {} + fire(_data?: T): void {} /** * Dispose this object and free resources. @@ -827,7 +827,7 @@ export class FileSystemError extends Error { * Create an error to signal that a file or folder wasn't found. * @param messageOrUri Message or uri. */ - static FileNotFound(messageOrUri?: string | Uri): FileSystemError { + static FileNotFound(_messageOrUri?: string | Uri): FileSystemError { return new FileSystemError("file not found"); } @@ -836,7 +836,7 @@ export class FileSystemError extends Error { * creating but not overwriting a file. * @param messageOrUri Message or uri. */ - static FileExists(messageOrUri?: string | Uri): FileSystemError { + static FileExists(_messageOrUri?: string | Uri): FileSystemError { return new FileSystemError("file exists"); } @@ -844,7 +844,7 @@ export class FileSystemError extends Error { * Create an error to signal that a file is not a folder. * @param messageOrUri Message or uri. */ - static FileNotADirectory(messageOrUri?: string | Uri): FileSystemError { + static FileNotADirectory(_messageOrUri?: string | Uri): FileSystemError { return new FileSystemError("file not a directory"); } @@ -852,7 +852,7 @@ export class FileSystemError extends Error { * Create an error to signal that a file is a folder. * @param messageOrUri Message or uri. */ - static FileIsADirectory(messageOrUri?: string | Uri): FileSystemError { + static FileIsADirectory(_messageOrUri?: string | Uri): FileSystemError { return new FileSystemError("file is a directory"); } @@ -860,7 +860,7 @@ export class FileSystemError extends Error { * Create an error to signal that an operation lacks required permissions. * @param messageOrUri Message or uri. */ - static NoPermissions(messageOrUri?: string | Uri): FileSystemError { + static NoPermissions(_messageOrUri?: string | Uri): FileSystemError { return new FileSystemError("no permissions"); } @@ -869,7 +869,7 @@ export class FileSystemError extends Error { * complete a request. * @param messageOrUri Message or uri. */ - static Unavailable(messageOrUri?: string | Uri): FileSystemError { + static Unavailable(_messageOrUri?: string | Uri): FileSystemError { return new FileSystemError("unavailable"); } @@ -902,7 +902,7 @@ export class FileSystemError extends Error { */ export namespace workspace { export const textDocuments: TextDocument[] = []; - export function getConfiguration(configuration: string) { + export function getConfiguration(_configuration: string): { update: () => void; inspect: () => void } { return { update: () => { return; @@ -913,7 +913,7 @@ export namespace workspace { }; } - export function createFileSystemWatcher() { + export function createFileSystemWatcher(): { onDidCreate: () => void; onDidChange: () => void; onDidDelete: () => void } { return { onDidCreate: () => {}, onDidChange: () => {}, @@ -921,11 +921,11 @@ export namespace workspace { }; } - export function onDidCloseTextDocument(event) { + export function onDidCloseTextDocument(_event): Disposable { return Disposable; } - export function onWillSaveTextDocument(event) { + export function onWillSaveTextDocument(_event): Disposable { return Disposable; } @@ -966,7 +966,7 @@ export namespace workspace { * @returns The file metadata about the file. * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when `uri` doesn't exist. */ - export function stat(uri: Uri): FileStat | Thenable { + export function stat(_uri: Uri): FileStat | Thenable { return {} as FileStat; } @@ -977,7 +977,7 @@ export namespace workspace { * @returns An array of name/type-tuples or a thenable that resolves to such. * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when `uri` doesn't exist. */ - export function readDirectory(uri: Uri): Array<[string, FileType]> | Thenable> { + export function readDirectory(_uri: Uri): Array<[string, FileType]> | Thenable> { return []; } @@ -989,7 +989,7 @@ export namespace workspace { * @throws {@linkcode FileSystemError.FileExists FileExists} when `uri` already exists. * @throws {@linkcode FileSystemError.NoPermissions NoPermissions} when permissions aren't sufficient. */ - export function createDirectory(uri: Uri): void | Thenable { + export function createDirectory(_uri: Uri): void | Thenable { return; } @@ -1000,7 +1000,7 @@ export namespace workspace { * @returns An array of bytes or a thenable that resolves to such. * @throws {@linkcode FileSystemError.FileNotFound FileNotFound} when `uri` doesn't exist. */ - export function readFile(uri: Uri): Uint8Array | Thenable { + export function readFile(_uri: Uri): Uint8Array | Thenable { return new Uint8Array(); } @@ -1016,9 +1016,9 @@ export namespace workspace { * @throws {@linkcode FileSystemError.NoPermissions NoPermissions} when permissions aren't sufficient. */ export function writeFile( - uri: Uri, - content: Uint8Array, - options: { + _uri: Uri, + _content: Uint8Array, + _options: { /** * Create the file if it does not exist already. */ @@ -1044,9 +1044,9 @@ export namespace workspace { * @throws {@linkcode FileSystemError.NoPermissions NoPermissions} when permissions aren't sufficient. */ export function rename( - oldUri: Uri, - newUri: Uri, - options: { + _oldUri: Uri, + _newUri: Uri, + _options: { /** * Overwrite the file if it does exist. */ @@ -1069,9 +1069,9 @@ export namespace workspace { * @throws {@linkcode FileSystemError.NoPermissions NoPermissions} when permissions aren't sufficient. */ export function copy( - source: Uri, - destination: Uri, - options: { + _source: Uri, + _destination: Uri, + _options: { /** * Overwrite the file if it does exist. */ @@ -1120,7 +1120,7 @@ export namespace env { * The system clipboard. */ export const clipboard: Clipboard = { - writeText() { + writeText(): Thenable { return Promise.resolve(); }, }; diff --git a/packages/zowe-explorer-api/src/extend/IApiExplorerExtender.ts b/packages/zowe-explorer-api/src/extend/IApiExplorerExtender.ts index 6270fb17f7..89e660262f 100644 --- a/packages/zowe-explorer-api/src/extend/IApiExplorerExtender.ts +++ b/packages/zowe-explorer-api/src/extend/IApiExplorerExtender.ts @@ -37,12 +37,12 @@ export interface IApiExplorerExtender { * to make them automatically appears in the Explorer drop- * down dialogs. */ - reloadProfiles(profileType?: string): Promise; + reloadProfiles(profileType?: string): void | Promise; /** * After an extenders registered all its API extensions it * might want to check for an existing profile folder with meta-file * or to create them automatically if it is non-existant. */ - initForZowe(type: string, profileTypeConfigurations: imperative.ICommandProfileTypeConfiguration[]): Promise; + initForZowe(type: string, profileTypeConfigurations: imperative.ICommandProfileTypeConfiguration[]): void | Promise; } diff --git a/packages/zowe-explorer-api/src/tree/IZoweTree.ts b/packages/zowe-explorer-api/src/tree/IZoweTree.ts index ca996d96f6..1ac9e3f434 100644 --- a/packages/zowe-explorer-api/src/tree/IZoweTree.ts +++ b/packages/zowe-explorer-api/src/tree/IZoweTree.ts @@ -29,10 +29,12 @@ export interface IZoweTree extends vscode.TreeDataProvider, Partial extends vscode.TreeDataProvider, Partial; + addSession(opts?: Types.AddSessionOpts): void | Promise; /** * Adds a single session to the tree * @param profile the profile to add to the tree */ - addSingleSession(profile: imperative.IProfileLoaded): Promise; + addSingleSession(profile: imperative.IProfileLoaded): void | Promise; /** * Edit a session to the container * @param node This parameter identifies the node that needs to be called */ - editSession(node: IZoweTreeNode): Promise; + editSession(node: IZoweTreeNode): void | Promise; /** * Get sessions from persistent object of provider @@ -83,149 +85,176 @@ export interface IZoweTree extends vscode.TreeDataProvider, Partial): Promise; + createZoweSession(zoweFileProvider: IZoweTree): void | Promise; /** * Create a brand new Schema * @param zoweFileProvider The tree from which the schema will be created */ - createZoweSchema(zoweFileProvider: IZoweTree): Promise; + createZoweSchema(zoweFileProvider: IZoweTree): void | Promise; /** * Adds a favorite node * @param favorite Adds a favorite node */ - checkCurrentProfile(node: IZoweTreeNode); + checkCurrentProfile(node: IZoweTreeNode): void | Promise; /** * Log in to authentication service * @param node This parameter identifies the node that needs to be called */ - ssoLogin(node: IZoweTreeNode): Promise; + ssoLogin(node: IZoweTreeNode): void | Promise; /** * Log out from authentication service * @param node This parameter identifies the node that needs to be called */ - ssoLogout(node: IZoweTreeNode): Promise; + ssoLogout(node: IZoweTreeNode): void | Promise; /** * Adds a favorite node * @param favorite Adds a favorite node */ - addFavorite(favorite: IZoweTreeNode): Promise; + addFavorite(favorite: IZoweTreeNode): void | Promise; + /** * Removes a favorite node * @param favorite Adds a favorite node */ - removeFavorite(node: IZoweTreeNode): Promise; + removeFavorite(node: IZoweTreeNode): void | Promise; + /** * Removes profile node from Favorites section * @param profileName */ - removeFavProfile(profileName: string, userSelected: boolean): Promise; + removeFavProfile(profileName: string, userSelected: boolean): void | Promise; + /** * Refreshes the tree */ refresh(): void; + /** * Refreshes an element of the tree * @param favorite Node to refresh */ refreshElement(node: IZoweTreeNode): void; + /** * Signals that node data has changed in the tree view * @param element to pass to event listener callback */ nodeDataChanged?(node: IZoweTreeNode): void; + /** * Event Emitters used to notify subscribers that the refresh event has fired */ - onDidChangeConfiguration(e: vscode.ConfigurationChangeEvent); + onDidChangeConfiguration(e: vscode.ConfigurationChangeEvent): void | Promise; + /** * Change the state of an expandable node * @param element the node being flipped * @param isOpen the intended state of the the tree view provider, true or false */ - flipState(element: IZoweTreeNode, isOpen: boolean); + flipState(element: IZoweTreeNode, isOpen: boolean): void; /** * Rename the node. Begins a dialog. * @param the node to be renamed */ - rename(node: IZoweTreeNode); + rename(node: IZoweTreeNode): void | Promise; + /** * Opens the node. Begins a dialog. * @param node: the node to be opened * @param preview: open in preview of edit mode */ - open(node: IZoweTreeNode, preview: boolean); + open(node: IZoweTreeNode, preview: boolean): void | Promise; + /** * Begins a copy operation on the node. * @param node: the node to be copied */ - copy(node: IZoweTreeNode); + copy(node: IZoweTreeNode): void | Promise; + /** * Concludes a copy/paste operation on the node. * @param node: the node to be pasted */ - paste(node: IZoweTreeNode); + paste(node: IZoweTreeNode): void | Promise; + /** * Deletes a node. * @param node: the node to be deleted */ - delete(node: IZoweTreeNode); + delete(node: IZoweTreeNode): void | Promise; + /** * Reveals and selects a node within the tree. * @param treeView: the vscode tree container * @param node: the node to be selected */ - setItem(treeView: vscode.TreeView, node: IZoweTreeNode); + setItem(treeView: vscode.TreeView, node: IZoweTreeNode): void; + /** * Saves the currently employed filter as a favorite. * @param node: A root node representing a session */ - saveSearch(node: IZoweTreeNode); + saveSearch(node: IZoweTreeNode): void | Promise; + /** * Saves an edited file. * @param node: the node to be saved */ - saveFile(document: vscode.TextDocument); + saveFile(document: vscode.TextDocument): void | Promise; - refreshPS(node: IZoweTreeNode); + /** + * Refresh the given node with current mainframe data. + * @param node: the node to be refreshed + */ + refreshPS(node: IZoweTreeNode): void | Promise; - uploadDialog(node: IZoweTreeNode); + /** + * Confirmation dialog to upload/save the given node. + * @param node: the node to be uploaded/saved + */ + uploadDialog(node: IZoweTreeNode): void | Promise; /** * Begins a filter/search operation on a node. * @param node: the root node to be searched from */ - filterPrompt(node: IZoweTreeNode); + filterPrompt(node: IZoweTreeNode): void | Promise; /** * Adds a search history element to persisted settings. * @param node: the root node representing the operation */ - addSearchHistory(element: string); + addSearchHistory(element: string): void; + /** * Retrieves search history elements from persisted settings. */ - getSearchHistory(); + getSearchHistory(): string[]; + /** * Returns the type of the tree provider. * @returns {PersistenceSchemaEnum} the type of tree: Dataset, USS, or Job */ getTreeType(): PersistenceSchemaEnum; + /** * Deletes a root node from the tree. * @param node: A root node representing a session * @param hideFromAllTrees: whether to hide from all trees or just the single tree */ - deleteSession(node: IZoweTreeNode, hideFromAllTrees?: boolean); + deleteSession(node: IZoweTreeNode, hideFromAllTrees?: boolean): void; + /** * Lets the user open a dataset by filtering the currently-loaded list */ - getAllLoadedItems?(): Promise; + getAllLoadedItems?(): IZoweTreeNode[] | Promise; + /** * Retrieves the vscode tree container */ @@ -237,91 +266,106 @@ export interface IZoweTree extends vscode.TreeDataProvider, Partial; + /** * Renames a node from the favorites list * * @param {IZoweTreeNode} node */ - renameFavorite(node: IZoweTreeNode, newLabel: string); + renameFavorite(node: IZoweTreeNode, newLabel: string): void | Promise; + /** * Renames a node based on the profile and it's label * * @param {string} criteria the member name to add */ - addFileHistory?(criteria: string); + addFileHistory?(criteria: string): void; + /** * Returns the array of recently-opened member names * * @returns {string[]} the array of recently-opened member names */ - getFileHistory?(); + getFileHistory?(): string[]; + /** * Removes a member name from the recently-opened members array * * @param {string} name the member to remove */ - removeFileHistory?(name: string); + removeFileHistory?(name: string): void; + /** * Removes session from the session array * @param {string} name the sessions to remove */ removeSession?(name: string): void; + /** * Returns a new dataset filter string, from an old filter and a new string * * @param {string} newFilter the new filter to add * @param {IZoweTreeNode} node the node with the old filter */ - createFilterString?(newFilter: string, node: IZoweTreeNode); + createFilterString?(newFilter: string, node: IZoweTreeNode): string; + /** * @param {string} profileLabel * @param {string} beforeLabel * @param {string} afterLabel */ - renameNode(profile: string, beforeDataSetName: string, afterDataSetName: string); + renameNode(profile: string, beforeDataSetName: string, afterDataSetName: string): void | Promise; + /** * Opens an item & reveals it in the tree * * @param {string} path the path of the item * @param {IZoweTreeNode} sessionNode the session to use */ - openItemFromPath?(path: string, sessionNode: IZoweTreeNode); + openItemFromPath?(path: string, sessionNode: IZoweTreeNode): void | Promise; + /** * Adds template for data set creation attributes * * @param {any} criteria the member name to add */ - addDsTemplate?(criteria: Types.DataSetAllocTemplate): Promise; + addDsTemplate?(criteria: Types.DataSetAllocTemplate): void | Promise; + /** * Returns the array of saved templates for data set creation attributes * * @returns {DataSetAllocTemplate[]} the array of recently-opened member names */ getDsTemplates?(): Types.DataSetAllocTemplate[]; + /* Initializes polling (refresh w/ configurable interval) for the provided node. * * @param {IZoweTreeNode} node the node to poll data for */ - pollData?(node: IZoweTreeNode): any; + pollData?(node: IZoweTreeNode): void | Promise; + /** * Opens resource for the provided node using encoding specified by user. * @param {IZoweTreeNode} node * @param {ZosEncoding} encoding File encoding, user will be prompted if undefined */ - openWithEncoding?(node: IZoweTreeNode, encoding?: ZosEncoding): Promise; + openWithEncoding?(node: IZoweTreeNode, encoding?: ZosEncoding): void | Promise; } diff --git a/packages/zowe-explorer/__tests__/__mocks__/DatasetTree.ts b/packages/zowe-explorer/__tests__/__mocks__/DatasetTree.ts index 4a08b81d64..c9d58b4132 100644 --- a/packages/zowe-explorer/__tests__/__mocks__/DatasetTree.ts +++ b/packages/zowe-explorer/__tests__/__mocks__/DatasetTree.ts @@ -83,11 +83,7 @@ export class DatasetTree implements vscode.TreeDataProvider { } @MockMethod() - public async deleteSession(_node?: ZoweDatasetNode): Promise { - return new Promise((resolve) => { - return resolve(); - }); - } + public deleteSession(_node?: ZoweDatasetNode): void {} @MockMethod() public async removeFavorite(_node: ZoweDatasetNode) { diff --git a/packages/zowe-explorer/__tests__/__mocks__/USSTree.ts b/packages/zowe-explorer/__tests__/__mocks__/USSTree.ts index 96aab92912..82b62fbe70 100644 --- a/packages/zowe-explorer/__tests__/__mocks__/USSTree.ts +++ b/packages/zowe-explorer/__tests__/__mocks__/USSTree.ts @@ -36,7 +36,7 @@ export class USSTree implements vscode.TreeDataProvider { * @memberof USSTree */ @MockMethod() - public addFavorite(_node: IZoweUSSTreeNode) {} + public addFavorite(_node: IZoweUSSTreeNode): void | Promise {} /** * @param {string} itemPath @@ -44,14 +44,14 @@ export class USSTree implements vscode.TreeDataProvider { * @memberof USSTree */ @MockMethod() - public async openItemFromPath(_itemPath: string, _sessionNode: IZoweUSSTreeNode) {} + public openItemFromPath(_itemPath: string, _sessionNode: IZoweUSSTreeNode): void | Promise {} /** * @param {IZoweUSSTreeNode} node * @memberof USSTree */ @MockMethod() - public removeFavorite(_node: IZoweUSSTreeNode) {} + public removeFavorite(_node: IZoweUSSTreeNode): void | Promise {} /** * @returns {IZoweUSSTreeNode[]} @@ -77,42 +77,42 @@ export class USSTree implements vscode.TreeDataProvider { * @memberof USSTree */ @MockMethod() - public setItem(_treeView: vscode.TreeView, _item: IZoweTreeNode) {} + public setItem(_treeView: vscode.TreeView, _item: IZoweTreeNode): void {} /** * @param {string} criteria * @memberof USSTree */ @MockMethod() - public addSearchHistory(_criteria: string) {} + public addSearchHistory(_criteria: string): void {} /** * @param {IZoweDatasetTreeNode} element * @memberof USSTree */ @MockMethod() - public refreshElement(_element: IZoweDatasetTreeNode) {} + public refreshElement(_element: IZoweDatasetTreeNode): void {} /** * @param {IZoweUSSTreeNode} node * @memberof USSTree */ @MockMethod() - public checkCurrentProfile(_node: IZoweUSSTreeNode) {} + public async checkCurrentProfile(_node: IZoweUSSTreeNode): Promise {} /** * @param {string} name - The name to remove from the file history array * @memberof USSTree */ @MockMethod() - public removeFileHistory(_name: string) {} + public removeFileHistory(_name: string): void {} /** * @param {string} criteria - The name to add to the file history array * @memberof USSTree */ @MockMethod() - public addFileHistory(_criteria: string) {} + public addFileHistory(_criteria: string): void {} /** * @returns {string[]} @@ -179,9 +179,5 @@ export class USSTree implements vscode.TreeDataProvider { } @MockMethod() - public async deleteSession(_node?: ZoweUSSNode): Promise { - return new Promise((resolve) => { - return resolve(); - }); - } + public deleteSession(_node?: ZoweUSSNode): void {} } diff --git a/packages/zowe-explorer/src/trees/dataset/DatasetActions.ts b/packages/zowe-explorer/src/trees/dataset/DatasetActions.ts index c8c589dadb..a5e0b8cf3f 100644 --- a/packages/zowe-explorer/src/trees/dataset/DatasetActions.ts +++ b/packages/zowe-explorer/src/trees/dataset/DatasetActions.ts @@ -746,7 +746,7 @@ export class DatasetActions { * @param datasetProvider - the tree which contains the nodes */ public static async createFile(node: IZoweDatasetTreeNode, datasetProvider: Types.IZoweDatasetTreeType): Promise { - datasetProvider.checkCurrentProfile(node); + await datasetProvider.checkCurrentProfile(node); if (Profiles.getInstance().validProfile === Validation.ValidationType.INVALID) { return; } diff --git a/packages/zowe-explorer/src/trees/dataset/DatasetTree.ts b/packages/zowe-explorer/src/trees/dataset/DatasetTree.ts index a3f0b23b15..c9e219524c 100644 --- a/packages/zowe-explorer/src/trees/dataset/DatasetTree.ts +++ b/packages/zowe-explorer/src/trees/dataset/DatasetTree.ts @@ -114,9 +114,9 @@ export class DatasetTree extends ZoweTreeProvider implemen public delete(_node: IZoweDatasetTreeNode): void { throw new Error("Method not implemented."); } - public saveSearch(node: IZoweDatasetTreeNode): Promise { + public async saveSearch(node: IZoweDatasetTreeNode): Promise { ZoweLogger.trace("DatasetTree.saveSearch called."); - return this.addFavorite(node); + await this.addFavorite(node); } public saveFile(_document: vscode.TextDocument): void { throw new Error("Method not implemented."); diff --git a/packages/zowe-explorer/src/trees/job/JobTree.ts b/packages/zowe-explorer/src/trees/job/JobTree.ts index ebc2c06bd5..abd4051dfc 100644 --- a/packages/zowe-explorer/src/trees/job/JobTree.ts +++ b/packages/zowe-explorer/src/trees/job/JobTree.ts @@ -138,9 +138,10 @@ export class JobTree extends ZoweTreeProvider implements Types * * @param {IZoweJobTreeNode} node */ - public saveSearch(node: IZoweJobTreeNode): void { + public async saveSearch(node: IZoweJobTreeNode): Promise { ZoweLogger.trace("ZosJobsProvider.saveSearch called."); node.contextValue = SharedContext.asFavorite(node); + return Promise.resolve(); } public saveFile(_document: vscode.TextDocument): void { throw new Error("Method not implemented."); @@ -511,7 +512,7 @@ export class JobTree extends ZoweTreeProvider implements Types job: node.job, }); favJob.command = { command: "zowe.jobs.search", title: "", arguments: [favJob] }; - this.saveSearch(favJob); + await this.saveSearch(favJob); } else { // Favorite a job favJob = new ZoweJobNode({ diff --git a/packages/zowe-explorer/src/trees/shared/SharedInit.ts b/packages/zowe-explorer/src/trees/shared/SharedInit.ts index bd47500f7c..77eac5c882 100644 --- a/packages/zowe-explorer/src/trees/shared/SharedInit.ts +++ b/packages/zowe-explorer/src/trees/shared/SharedInit.ts @@ -199,8 +199,8 @@ export class SharedInit { ) ); context.subscriptions.push( - vscode.commands.registerCommand("zowe.saveSearch", (node: IZoweTreeNode) => { - SharedTreeProviders.getProviderForNode(node).saveSearch(node); + vscode.commands.registerCommand("zowe.saveSearch", async (node: IZoweTreeNode) => { + await SharedTreeProviders.getProviderForNode(node).saveSearch(node); }) ); context.subscriptions.push( diff --git a/packages/zowe-explorer/src/trees/uss/USSTree.ts b/packages/zowe-explorer/src/trees/uss/USSTree.ts index a7d9d3e7ef..16c44186e2 100644 --- a/packages/zowe-explorer/src/trees/uss/USSTree.ts +++ b/packages/zowe-explorer/src/trees/uss/USSTree.ts @@ -589,13 +589,12 @@ export class USSTree extends ZoweTreeProvider implements Types * * @param {IZoweUSSTreeNode} node */ - public async saveSearch(node: IZoweUSSTreeNode): Promise { + public async saveSearch(node: IZoweUSSTreeNode): Promise { ZoweLogger.trace("USSTree.saveSearch called."); const fullPathLabel = node.fullPath; node.label = node.tooltip = fullPathLabel; node.contextValue = Constants.USS_SESSION_CONTEXT + Constants.FAV_SUFFIX; await this.checkCurrentProfile(node); - return node; } /**