问题
The context of a vscode extension provides access to globalState which is a Memento object with key/value pairs. My question is: does each extension get its own memento object, or is there one shared by all extensions? Just wondering whether I need to make my keys more specific (e.g., my.extension.foo
), or if I can keep the keys simple (e.g., foo
).
回答1:
It's scoped to your extension, so you can keep them simple:
However, when an extension uses storage, it will always get it's data stored under 1 key (the extension name + extension ID). We never allow to write directly into storage under a key that could conflict with other keys.
(source)
来源:https://stackoverflow.com/questions/62341372/scoping-of-keys-in-vscode-extension-global-scope