Add ephemeral storage for extensions#12636
Open
lionel- wants to merge 8 commits intofeature/shiny-sessionfrom
Open
Add ephemeral storage for extensions#12636lionel- wants to merge 8 commits intofeature/shiny-sessionfrom
lionel- wants to merge 8 commits intofeature/shiny-sessionfrom
Conversation
|
E2E Tests 🚀 |
fbfc2fc to
7b17b52
Compare
57afcc0 to
1ad24e8
Compare
To avoid exposing RPCs to extensions
jmcphers
previously approved these changes
Mar 20, 2026
Collaborator
jmcphers
left a comment
There was a problem hiding this comment.
Thank you for doing this, I've been meaning to do so for months!
Two small requests:
- Update the comment re: workspace corruption; it is my understanding that workspace state is appropriate for per-window operations because you can't open the same workspace in two windows at once.
- Putting an API in
vscode.d.tsmakes it difficult/impossible for third party extensions to use, because, unlikepositron.d.ts, we do not publish our modified copy of these types anywhere. What do you think about moving this topositron.d.ts? Realize then it can't be part ofExtensionContext, but we get the extension ID as part of every API call so it could just live on e.g.namespace window.
jmcphers
approved these changes
Mar 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Branched from #12545 (base branch still set to main so CI runs tests)
Experimental addition of a new kind of persistent storage
context.ephemeralStatethat is:This storage matches exactly the scope/lifetime of console sessions, and is thus an ideal place for extensions to store metadata about console sessions.
The positron-run-app extension now uses this storage to keep track of sessions (see #12545). This has these advantages:
Extension state written to workspace storage could be invalidated / corrupted when multiple windows with the same workspace are opened (e.g. via "Duplicate as workspace in new window" command). The ephemeral storage prevents this sort of races by design.Edit: As pointed out by Jonathan, this is not true. There is a file-lock mechanism for workspace storage and the duplicate as workspace command creates a new, separate workspace with its own storage.
Not taking up disk space for state that is only relevant in the context of a running instance and that could easily be leaked forever. For the app runner, we still prune console sessions when we look them up to avoid unbounded growth while the instance is running. If it didn't prune though, the ephemeral storage guarantees the state is cleaned up on shutdown, rather than leaked on disk.
New Features
Bug Fixes
QA Notes