Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch To Using ExtensionContext.globalState to Store Information Rather Than On User's Filesystem #48

Open
chrstinalin opened this issue May 28, 2024 · 4 comments
Labels
nice-to-have Functionality or features that would be nice to have in Assay.

Comments

@chrstinalin
Copy link
Contributor

chrstinalin commented May 28, 2024

I was curious when (if ever) the workspace arg would be undefined, so I started poking through some VSCode docs. While trying to look up information about vscode.ExtensionContext I found some docs that state (emphasis mine):

ExtensionContext.globalState: A global storage where you can write key/value pairs. VS Code manages the storage and will restore it for each extension activation. You can selectively synchronize key/value pairs in global storage by setting the keys for sync using setKeysForSync method on globalState.

On the surface this seems like it would be preferable to use this over manually reading/writing our own files on the user's filesystem.

Originally posted by @dotproto in #41 (comment)

@chrstinalin chrstinalin added the nice-to-have Functionality or features that would be nice to have in Assay. label Jun 11, 2024
@wagnerand
Copy link
Member

Comments have been removed.

@chrstinalin
Copy link
Contributor Author

Not necessarily redundant -- information (ex. some add-on metadata) is still stored using the filesystem rather than globalState when, ideally, it should be the latter.

@chrstinalin chrstinalin reopened this Oct 15, 2024
@chrstinalin chrstinalin changed the title Switch To Using ExtensionContext.globalState to Store Comments Rather Than On User's Filesystem Switch To Using ExtensionContext.globalState to Store Information Rather Than On User's Filesystem Oct 15, 2024
@wagnerand
Copy link
Member

Ah, sorry I had understood from the original title that it is about comments.

@chrstinalin
Copy link
Contributor Author

It technically was, since comments was the most relevant example (and what uncovered this in the first place), but its not the only application of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nice-to-have Functionality or features that would be nice to have in Assay.
Projects
None yet
Development

No branches or pull requests

2 participants