How to persist information for a vscode extension?

后端 未结 1 1014
隐瞒了意图╮
隐瞒了意图╮ 2020-12-11 18:37

I\'m planning to write a Visual Studio Code extension and it need to save some information for example a counter. The user can press a shortcut to increase or decrease the c

相关标签:
1条回答
  • 2020-12-11 18:57

    You're probably looking for the Memento API. The ExtensionContext has two different memento instances you can access:

    • workspaceState

      A memento object that stores state in the context of the currently opened workspace.

    • globalState

      A memento object that stores state independent of the current opened workspace.

    Both survive VSCode updates to my knowledge.

    0 讨论(0)
提交回复
热议问题