3

I am creating an extension, in which I need to get a string from user and store it, so that in future I will give a suggestion through quickdropbox. Now, which is the genuine way to store the user input data? I seen the Project manager extension source. There the user input project name is stored in project.json which is located in %APPDATA%\Code\User folder. Is this right way to store? sorry for my poor English.

1 Answer 1

10

If you don't want the user to see this string after you store (like in User Settings, you should use context.globalState. I made another extension that does something like your scenario, it's called Tagged Comment.

This is how it stores the value:

context.globalState.update('lastTagged', str);

This is how it loads the value:

let lastTagged = context.globalState.get('lastTagged', '');
5
  • I don't want user to see these values. I will try it and let you know. I am pretty new to this. Thank you very much for the answer.
    – Sathish V
    Apr 24, 2017 at 19:28
  • Great! If you need more help, maybe share your extension's repo (if you can) Apr 24, 2017 at 20:09
  • Sure. I am still working on the project locally. It is not in github yet. It will be soon. Thanks for the support.
    – Sathish V
    Apr 27, 2017 at 8:53
  • Where is the location in that the extension stores those information?
    – aviit
    Jun 5, 2019 at 7:18
  • It used to be stored in LocalStorage (Chrome internals), but it is now stored in the file system, inside the %appdata/Code/User/globalStorage/publisher.extensionName folder Jun 5, 2019 at 23:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.