Open rubensa opened 1 year ago
@rubensa
The extension uses the Memento API of the ExtensionContext: https://github.com/egomobile/vscode-powertools/blob/04c3d42fd1eec2b949753c5456db49f13c48d10d/src/tools/proxies.ts#L138
To find out, where the storage path might be on your own system, you can create a button, which shows the path in a new info window at the right bottom corner of VSCode:
exports.execute = async (args) => {
// args => https://egomobile.github.io/vscode-powertools/api/interfaces/_contracts_.buttonactionscriptarguments.html
// s. https://code.visualstudio.com/api/references/vscode-api
const vscode = args.require('vscode');
// args.extension => https://code.visualstudio.com/api/references/vscode-api#ExtensionContext
vscode.window.showInformationMessage(
"globalStatePath: " + args.extension.globalStoragePath
);
};
On a Mac, this could be someting like: /Users/<USERNAME>/Library/Application Support/Code/User/globalStorage/egomobile.vscode-powertools
Hello @mkloubert Thanks for the answer. So... the tools config works differently from than the rest that can be configured by settings.xml Can't this be "unified" so any configuration goes to settings.xml and allow config per user or workspace?
@mkloubert Curious but, in my case, the reported path does not exists.
I'm using VSCode Dev Conteainer so my workspace is running inside a Docker container. When I click the button I get globalStatePath: /home/user/.vscode-server/data/User/globalStorage/egomobile.vscode-powertools /home/user is the $HOME of the user used under the Docker container and /home/user/.vscode-server/data/User/globalStorage/ exists but it does not contain a egomobile.vscode-powertools folder (despite I have a TCP proxy configured).
How this might be possible?
NOTE: Just in case I checked if /home/user/.vscode-server/data/User/globalStorage/egomobile.vscode-powertools existed in the host computer, but there is no such folder, and also checked in the host the path /home/rubensa/.config/Code/User/globalStorage/ (/home/rubensa is my $HOME in the host) but there is no egomobile.vscode-powertools folder there.
Ouch!! I think that I finally found where the data is persisted... and is a pain cause it can't be easily configured/modified.
Looking at the docs it appears that the extension.globalStoragePath (now deprecated and replaced by globalStorageUri) directory does not exists. It must be created by the extension if it needs it. It is supposed to be a "safe" place for the extension to save configuration (but must be done "manually"). Whatever you save using extension.globalState.update(key, value) (that is what proxies.ts is doing) is saved in a sqlite database file in ~/.config/Code/User/globalStorage/state.vscdb
Definitely it would be great if this configuration could be saved in settings.xml (like the rest of configurations for the extension).
I just created a new TCP proxy but I can't find where the configuration is saved.
I tried to find the config for the newly created proxy under
.vscode/settings.json
and~/.config/Code/User/settings.json
but no luck.