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

Introduce transient profiles #158695

Merged
merged 3 commits into from Aug 22, 2022
Merged

Introduce transient profiles #158695

merged 3 commits into from Aug 22, 2022

Conversation

sandy081
Copy link
Member

@sandy081 sandy081 commented Aug 21, 2022

Introduce transient profiles. These profiles are deleted automatically once the last window which uses it is closed.

You can create and associate a transient profile from

  • CLI by passing --profile-transient flag. Eg: code <folder-uri> --profile-transient
  • UI from Command Palette using command Create Transient Settings Profile

These will create a transient settings profile and associate it to the workspace. Once the workspace is closed (or uses different profile) this profile is deleted.

Fixes #154460

CC @bpasero

@sandy081 sandy081 self-assigned this Aug 21, 2022
@sandy081 sandy081 requested a review from bpasero August 21, 2022 11:39
@VSCodeTriageBot VSCodeTriageBot added this to the August 2022 milestone Aug 21, 2022
Copy link
Member

@joaomoreno joaomoreno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • removeProfile shall be renamed to removeProfileIfNotAssociated instead of adding a flag
  • rename --transient to --profile-transient

@sandy081 sandy081 removed the request for review from bpasero August 22, 2022 12:17
@sandy081 sandy081 merged commit ac6a9ce into main Aug 22, 2022
@sandy081 sandy081 deleted the sandy081/yearling-otter branch August 22, 2022 12:20
@bpasero
Copy link
Member

bpasero commented Aug 25, 2022

Are we thinking this is going to be used a lot from CLI over --profile? I am asking because we are a bit sensitive to what we put top level when you run code-insiders --help to not confuse the user with too many options. If we think this is only used in e.g. debug launch configs then maybe it should not be top level advertised?

image

@sandy081
Copy link
Member Author

Agreed. I assume --profile will be most commonly used from CLI than --profile-temp. I would move the latter into non-help args section.

@@ -27,6 +27,7 @@ export interface ICodeWindow extends IDisposable {
readonly win: BrowserWindow | null; /* `null` after being disposed */
readonly config: INativeWindowConfiguration | undefined;

readonly previousWorkspace?: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bpasero I have added this property so that I can read the previous workspace and the profile associated and remove the profile if it is transient. Please take a look and let me know if there is a better way to do this.

Copy link
Member

@bpasero bpasero Aug 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not clear to me why this has to go into the window.ts, can you not associate workspaces and windows (by their numerical ID for example) by listening to window events in your code and do this? I would only have such a property if it is used in more places tbh.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I could do that. But getting this from ICodeWindow is more elegant.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not super clear to me, just reading the code what the lifecycle is though. Someone else using this could think this is stored and restored across restarts?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok! Created this debt item #159189 to move it to the place where I use it.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Profiles: Support transient profiles
4 participants