Scoping of keys in vscode extension global scope

给你一囗甜甜゛ 提交于 2021-01-28 05:33:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!