mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-29 18:09:01 +01:00
Implement --transient CLI option for stateless VS Code sessions (#254223)
This commit is contained in:
@@ -242,6 +242,21 @@ export async function main(argv: string[]): Promise<any> {
|
||||
});
|
||||
}
|
||||
|
||||
// Handle --transient option
|
||||
if (args['transient']) {
|
||||
const tempParentDir = randomPath(tmpdir(), 'vscode');
|
||||
const tempUserDataDir = join(tempParentDir, 'data');
|
||||
const tempExtensionsDir = join(tempParentDir, 'extensions');
|
||||
|
||||
addArg(argv, '--user-data-dir', tempUserDataDir);
|
||||
addArg(argv, '--extensions-dir', tempExtensionsDir);
|
||||
addArg(argv, '--disable-updates');
|
||||
|
||||
if (args.verbose) {
|
||||
console.log(`Warning: state is temporarily stored in: "${tempParentDir}"`);
|
||||
}
|
||||
}
|
||||
|
||||
const hasReadStdinArg = args._.some(arg => arg === '-') || args.chat?._.some(arg => arg === '-');
|
||||
if (hasReadStdinArg) {
|
||||
// remove the "-" argument when we read from stdin
|
||||
|
||||
@@ -107,6 +107,7 @@ export interface NativeParsedArgs {
|
||||
'install-source'?: string;
|
||||
'add-mcp'?: string[];
|
||||
'disable-updates'?: boolean;
|
||||
'transient'?: boolean;
|
||||
'use-inmemory-secretstorage'?: boolean;
|
||||
'password-store'?: string;
|
||||
'disable-workspace-trust'?: boolean;
|
||||
|
||||
@@ -168,6 +168,7 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
|
||||
'skip-welcome': { type: 'boolean' },
|
||||
'disable-telemetry': { type: 'boolean' },
|
||||
'disable-updates': { type: 'boolean' },
|
||||
'transient': { type: 'boolean' },
|
||||
'use-inmemory-secretstorage': { type: 'boolean', deprecates: ['disable-keytar'] },
|
||||
'password-store': { type: 'string' },
|
||||
'disable-workspace-trust': { type: 'boolean' },
|
||||
|
||||
Reference in New Issue
Block a user