-
Notifications
You must be signed in to change notification settings - Fork 98
Using Zowe Explorer Local Storage
In Zowe Explorer v3.1.0 and newer, extenders can access and modify keys in Zowe Explorer's local storage. To do so, use the Zowe Explorer extender API through Zowe Explorer's exports, and call the getLocalStorage
function.
const zeApi = vscode.extensions.getExtension("Zowe.vscode-extension-for-zowe")?.exports;
const localStorage = zeApi.getExplorerExtenderApi().getLocalStorage();
// From here, you can get or set values using `localStorage.getValue` and `localStorage.setValue`
Not all keys are accessible by extenders. In addition, some keys are read-only and cannot be modified by an extender.
zowe.cliLoggerSetting.presented
zowe.settings.localStorageMigrated
zowe.settings.oldSettingsMigrated
zowe.commands.history
zowe.ds.history
zowe.encodingHistory
zowe.uss.history
zowe.jobs.history
Only keys listed above are accessible through Zowe Explorer local storage. If there is a key missing from this list that you would like to access, please file an issue with the desired keys and the squad will evaluate exposing them.
/**
* Retrieve the value from local storage for the given key.
* @param key A readable key
* @returns The value if it exists in local storage, or `undefined` otherwise
* @throws If the extender does not have appropriate read permissions for the given key
*/
getValue<T>(key: string): T;
Call the getValue
function and provide the desired key. If the key is readable, the value is returned. Otherwise, an "insufficient read permissions" error is returned.
/**
* Set a value in local storage for the given key.
* @param key A writable key
* @param value The new value for the given key to set in local storage
* @throws If the extender does not have appropriate write permissions for the given key
*/
setValue<T>(key: string, value: T): Thenable<void>;
Call the setValue
function and provide the desired key and new value. If the key is writable, the value is updated in local storage. Otherwise, an "insufficient write permissions" error is returned.
zowe/vscode-extension-for-zowe
Welcome
Using Zowe Explorer
Roadmaps
Development Process
Testing process
Release Process
Backlog Grooming Process
How to Extend Zowe Explorer
- Extending Zowe Explorer
- Using Zowe Explorer Local Storage
- Error Handling for Extenders
- Secure Credentials for Extenders
- Sample Extender Repositories
Conformance Criteria
v3 Features and Information