Support --enable-proposed-api through argv.json (#99908)
* Support --enabled-proposed-api thorugh argv.json Closes #99775 * Fix typos. * Apply suggestions from code review Co-authored-by: Benjamin Pasero <benjpas@microsoft.com> Co-authored-by: Benjamin Pasero <benjpas@microsoft.com>
This commit is contained in:
parent
2e2bdd5090
commit
3023198b7e
45
src/main.js
45
src/main.js
|
@ -201,30 +201,45 @@ function configureCommandlineSwitchesSync(cliArgs) {
|
|||
SUPPORTED_ELECTRON_SWITCHES.push('force-renderer-accessibility');
|
||||
}
|
||||
|
||||
const SUPPORTED_MAIN_PROCESS_SWITCHES = [
|
||||
|
||||
// Persistently enable proposed api via argv.json: https://github.com/microsoft/vscode/issues/99775
|
||||
'enable-proposed-api'
|
||||
];
|
||||
|
||||
// Read argv config
|
||||
const argvConfig = readArgvConfigSync();
|
||||
|
||||
// Append each flag to Electron
|
||||
Object.keys(argvConfig).forEach(argvKey => {
|
||||
if (SUPPORTED_ELECTRON_SWITCHES.indexOf(argvKey) === -1) {
|
||||
return; // unsupported argv key
|
||||
}
|
||||
|
||||
const argvValue = argvConfig[argvKey];
|
||||
|
||||
// Color profile
|
||||
if (argvKey === 'force-color-profile') {
|
||||
if (argvValue) {
|
||||
app.commandLine.appendSwitch(argvKey, argvValue);
|
||||
// Append Electron flags to Electron
|
||||
if (SUPPORTED_ELECTRON_SWITCHES.indexOf(argvKey) !== -1) {
|
||||
// Color profile
|
||||
if (argvKey === 'force-color-profile') {
|
||||
if (argvValue) {
|
||||
app.commandLine.appendSwitch(argvKey, argvValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Others
|
||||
else if (argvValue === true || argvValue === 'true') {
|
||||
if (argvKey === 'disable-hardware-acceleration') {
|
||||
app.disableHardwareAcceleration(); // needs to be called explicitly
|
||||
} else {
|
||||
app.commandLine.appendSwitch(argvKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Others
|
||||
else if (argvValue === true || argvValue === 'true') {
|
||||
if (argvKey === 'disable-hardware-acceleration') {
|
||||
app.disableHardwareAcceleration(); // needs to be called explicitly
|
||||
} else {
|
||||
app.commandLine.appendSwitch(argvKey);
|
||||
// Append main process flags to process.argv
|
||||
else if (SUPPORTED_MAIN_PROCESS_SWITCHES.indexOf(argvKey) !== -1) {
|
||||
if (argvKey === 'enable-proposed-api') {
|
||||
if (Array.isArray(argvValue)) {
|
||||
argvValue.forEach(id => id && typeof id === 'string' && process.argv.push('--enable-proposed-api', id));
|
||||
} else {
|
||||
console.error(`Unexpected value for \`enable-proposed-api\` in argv.json. Expected array of extension ids.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -343,6 +343,13 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
|||
'force-color-profile': {
|
||||
type: 'string',
|
||||
markdownDescription: nls.localize('argv.forceColorProfile', 'Allows to override the color profile to use. If you experience colors appear badly, try to set this to `srgb` and restart.')
|
||||
},
|
||||
'enable-proposed-api': {
|
||||
type: 'array',
|
||||
description: nls.localize('argv.enebleProposedApi', "Enable proposed APIs for a list of extension ids (such as \`vscode.git\`). Proposed APIs are unstable and subject to breaking without warning at any time. This should only be set for extension development and testing purposes."),
|
||||
items: {
|
||||
type: 'string'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue