Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions .eslint-allowed-bracket-notation-files
Original file line number Diff line number Diff line change
Expand Up @@ -296,49 +296,6 @@ scripts/code-web.js
scripts/sync-agent-host-protocol.ts
scripts/test-agent-host-e2e.ts

# Application bootstrap, server, and environment (41 files)
src/bootstrap-cli.ts
src/bootstrap-esm.ts
src/bootstrap-fork.ts
src/bootstrap-meta.ts
src/bootstrap-node.ts
src/bootstrap-server.ts
src/cli.ts
src/main.ts
src/server-cli.ts
src/server-main.ts
src/vs/code/electron-browser/workbench/workbench.ts
src/vs/code/electron-main/app.ts
src/vs/code/electron-main/main.ts
src/vs/code/node/cli.ts
src/vs/code/node/cliProcessMain.ts
src/vs/code/test/node/bootstrapESM.test.ts
src/vs/platform/diagnostics/node/diagnosticsService.ts
src/vs/platform/dialogs/electron-browser/dialog.ts
src/vs/platform/environment/common/environmentService.ts
src/vs/platform/environment/electron-main/environmentMainService.ts
src/vs/platform/environment/node/argvHelper.ts
src/vs/platform/environment/node/userDataPath.ts
src/vs/platform/environment/test/electron-main/environmentMainService.test.ts
src/vs/platform/environment/test/node/userDataPath.test.ts
src/vs/platform/launch/electron-main/launchMainService.ts
src/vs/platform/native/electron-main/auth.ts
src/vs/platform/product/common/product.ts
src/vs/platform/shell/node/shellEnv.ts
src/vs/platform/utilityProcess/electron-main/utilityProcess.ts
src/vs/platform/windows/electron-main/windowImpl.ts
src/vs/platform/windows/electron-main/windowsMainService.ts
src/vs/server/node/remoteAgentEnvironmentImpl.ts
src/vs/server/node/remoteExtensionHostAgentCli.ts
src/vs/server/node/remoteExtensionHostAgentServer.ts
src/vs/server/node/remoteExtensionsScanner.ts
src/vs/server/node/remoteTerminalChannel.ts
src/vs/server/node/server.cli.ts
src/vs/server/node/server.cliAgent.ts
src/vs/server/node/server.main.ts
src/vs/server/node/serverEnvironmentService.ts
src/vs/server/node/webClientServer.ts

# Base and editor (27 files)
src/vs/base/browser/dom.ts
src/vs/base/browser/markdownRenderer.ts
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
// current working directory due to our variable
// somehow escaping to the parent shell
// (https://github.com/microsoft/vscode/issues/126399)
delete process.env['VSCODE_CWD'];
delete process.env.VSCODE_CWD;
12 changes: 6 additions & 6 deletions src/bootstrap-esm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ globalThis._VSCODE_FILE_ROOT = import.meta.dirname;
// `node_modules` — exactly as it would without the archive. Only when the
// default resolution finds nothing do we consult the archive.
function enableASARSupport(): void {
if (!process.env['ELECTRON_RUN_AS_NODE'] && !process.versions['electron']) {
if (!process.env.ELECTRON_RUN_AS_NODE && !process.versions.electron) {
return; // only on Electron / Electron-as-node
}

let trace: ((message: string) => void) | undefined;
const traceSink = process.env['VSCODE_ASAR_TRACE'] || undefined;
const traceSink = process.env.VSCODE_ASAR_TRACE || undefined;
if (traceSink) {
// Known truthy values trace to stderr; any other value is a file path.
const prefix = '[asar-resolve] ';
Expand Down Expand Up @@ -86,7 +86,7 @@ function enableASARSupport(): void {
};

const appRoot = dirname(import.meta.dirname);
const resourcesPath = process.env['VSCODE_DEV'] ? undefined : normalizeDriveLetter(appRoot);
const resourcesPath = process.env.VSCODE_DEV ? undefined : normalizeDriveLetter(appRoot);
// Root require.resolve() inside the archive; the leading './' below avoids a node_modules walk.
const asarRequire = resourcesPath ? createRequire(join(appRoot, 'node_modules.asar', 'x.js')) : undefined;
trace?.(`tracing enabled (node ${process.versions.node}); resourcesPath=${resourcesPath}`);
Expand Down Expand Up @@ -214,9 +214,9 @@ async function doSetupNLS(): Promise<INLSConfiguration | undefined> {
let nlsConfig: INLSConfiguration | undefined = undefined;

let messagesFile: string | undefined;
if (process.env['VSCODE_NLS_CONFIG']) {
if (process.env.VSCODE_NLS_CONFIG) {
try {
nlsConfig = JSON.parse(process.env['VSCODE_NLS_CONFIG']);
nlsConfig = JSON.parse(process.env.VSCODE_NLS_CONFIG);
if (nlsConfig?.languagePack?.messagesFile) {
messagesFile = nlsConfig.languagePack.messagesFile;
} else if (nlsConfig?.defaultMessagesFile) {
Expand All @@ -230,7 +230,7 @@ async function doSetupNLS(): Promise<INLSConfiguration | undefined> {
}

if (
process.env['VSCODE_DEV'] || // no NLS support in dev mode
process.env.VSCODE_DEV || // no NLS support in dev mode
!messagesFile // no NLS messages file
) {
return undefined;
Expand Down
22 changes: 11 additions & 11 deletions src/bootstrap-fork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function pipeLoggingToParent(): void {
}

// Pass console logging to the outside so that we have it in the main side if told so
if (process.env['VSCODE_VERBOSE_LOGGING'] === 'true') {
if (process.env.VSCODE_VERBOSE_LOGGING === 'true') {
wrapConsoleMethod('info', 'log');
wrapConsoleMethod('log', 'log');
wrapConsoleMethod('warn', 'warn');
Expand Down Expand Up @@ -167,7 +167,7 @@ function handleExceptions(): void {
}

function terminateWhenParentTerminates(): void {
const parentPid = Number(process.env['VSCODE_PARENT_PID']);
const parentPid = Number(process.env.VSCODE_PARENT_PID);

if (typeof parentPid === 'number' && !isNaN(parentPid)) {
setInterval(function () {
Expand All @@ -181,13 +181,13 @@ function terminateWhenParentTerminates(): void {
}

function configureCrashReporter(): void {
const crashReporterProcessType = process.env['VSCODE_CRASH_REPORTER_PROCESS_TYPE'];
const crashReporterProcessType = process.env.VSCODE_CRASH_REPORTER_PROCESS_TYPE;
if (crashReporterProcessType) {
try {
//@ts-expect-error
if (process['crashReporter'] && typeof process['crashReporter'].addExtraParameter === 'function' /* Electron only */) {
if (process.crashReporter && typeof process.crashReporter.addExtraParameter === 'function' /* Electron only */) {
//@ts-expect-error
process['crashReporter'].addExtraParameter('processType', crashReporterProcessType);
process.crashReporter.addExtraParameter('processType', crashReporterProcessType);
}
} catch (error) {
console.error(error);
Expand All @@ -203,27 +203,27 @@ configureCrashReporter();
// Remove global paths from the node module lookup (node.js only)
removeGlobalNodeJsModuleLookupPaths();

if (process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH']) {
devInjectNodeModuleLookupPath(process.env['VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH']);
if (process.env.VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH) {
devInjectNodeModuleLookupPath(process.env.VSCODE_DEV_INJECT_NODE_MODULE_LOOKUP_PATH);
}

// Configure: pipe logging to parent process
if (!!process.send && process.env['VSCODE_PIPE_LOGGING'] === 'true') {
if (!!process.send && process.env.VSCODE_PIPE_LOGGING === 'true') {
pipeLoggingToParent();
}

// Handle Exceptions
if (!process.env['VSCODE_HANDLES_UNCAUGHT_ERRORS']) {
if (!process.env.VSCODE_HANDLES_UNCAUGHT_ERRORS) {
handleExceptions();
}

// Terminate when parent terminates
if (process.env['VSCODE_PARENT_PID']) {
if (process.env.VSCODE_PARENT_PID) {
terminateWhenParentTerminates();
}

// Bootstrap ESM
await bootstrapESM();

// Load ESM entry point
await import([`./${process.env['VSCODE_ESM_ENTRYPOINT']}.js`].join('/') /* workaround: esbuild prints some strange warnings when trying to inline? */);
await import([`./${process.env.VSCODE_ESM_ENTRYPOINT}.js`].join('/') /* workaround: esbuild prints some strange warnings when trying to inline? */);
6 changes: 3 additions & 3 deletions src/bootstrap-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ import type { IProductConfiguration } from './vs/base/common/product.js';
const require = createRequire(import.meta.url);

let productObj: Partial<IProductConfiguration> & { BUILD_INSERT_PRODUCT_CONFIGURATION?: string } = { BUILD_INSERT_PRODUCT_CONFIGURATION: 'BUILD_INSERT_PRODUCT_CONFIGURATION' }; // DO NOT MODIFY, PATCHED DURING BUILD
if (productObj['BUILD_INSERT_PRODUCT_CONFIGURATION']) {
if (productObj.BUILD_INSERT_PRODUCT_CONFIGURATION) {
productObj = require('../product.json'); // Running out of sources
}

let pkgObj = { BUILD_INSERT_PACKAGE_CONFIGURATION: 'BUILD_INSERT_PACKAGE_CONFIGURATION' }; // DO NOT MODIFY, PATCHED DURING BUILD
if (pkgObj['BUILD_INSERT_PACKAGE_CONFIGURATION']) {
if (pkgObj.BUILD_INSERT_PACKAGE_CONFIGURATION) {
pkgObj = require('../package.json'); // Running out of sources
}

let productOverridesObj = {};
if (process.env['VSCODE_DEV']) {
if (process.env.VSCODE_DEV) {
try {
productOverridesObj = require('../product.overrides.json');
productObj = Object.assign(productObj, productOverridesObj);
Expand Down
28 changes: 14 additions & 14 deletions src/bootstrap-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if (process.platform === 'linux') {
// increase number of stack frames(from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
Error.stackTraceLimit = 100;

if (!process.env['VSCODE_HANDLES_SIGPIPE']) {
if (!process.env.VSCODE_HANDLES_SIGPIPE) {
// Workaround for Electron not installing a handler to ignore SIGPIPE
// (https://github.com/electron/electron/issues/13254)
let didLogAboutSIGPIPE = false;
Expand All @@ -45,8 +45,8 @@ function setupCurrentWorkingDirectory(): void {
// for consistent lookups, but make sure to only
// do this once unless defined already from e.g.
// a parent process.
if (typeof process.env['VSCODE_CWD'] !== 'string') {
process.env['VSCODE_CWD'] = process.cwd();
if (typeof process.env.VSCODE_CWD !== 'string') {
process.env.VSCODE_CWD = process.cwd();
}

// Windows: always set application folder as current working dir
Expand Down Expand Up @@ -77,11 +77,11 @@ setupCurrentWorkingDirectory();
* `ELECTRON_RUN_AS_NODE` forks), never when running out of sources.
*/
function enableASARSupport(): void {
if (!process.env['ELECTRON_RUN_AS_NODE'] && !process.versions['electron']) {
if (!process.env.ELECTRON_RUN_AS_NODE && !process.versions.electron) {
return; // only on Electron / Electron-as-node
}

if (process.env['VSCODE_DEV']) {
if (process.env.VSCODE_DEV) {
return; // no ASAR when running out of sources
}

Expand Down Expand Up @@ -132,7 +132,7 @@ enableASARSupport();
* Note: only applies when running out of sources.
*/
export function devInjectNodeModuleLookupPath(injectPath: string): void {
if (!process.env['VSCODE_DEV']) {
if (!process.env.VSCODE_DEV) {
return; // only applies running out of sources
}

Expand Down Expand Up @@ -206,7 +206,7 @@ export function configurePortable(product: Partial<IProductConfiguration>): { po
const appRoot = path.dirname(import.meta.dirname);

function getApplicationPath(): string {
if (process.env['VSCODE_DEV']) {
if (process.env.VSCODE_DEV) {
return appRoot;
}

Expand All @@ -223,8 +223,8 @@ export function configurePortable(product: Partial<IProductConfiguration>): { po
}

function getPortableDataPath(): string {
if (process.env['VSCODE_PORTABLE']) {
return process.env['VSCODE_PORTABLE'];
if (process.env.VSCODE_PORTABLE) {
return process.env.VSCODE_PORTABLE;
}

if (process.platform === 'win32' || process.platform === 'linux') {
Expand All @@ -241,17 +241,17 @@ export function configurePortable(product: Partial<IProductConfiguration>): { po
const isTempPortable = isPortable && fs.existsSync(portableTempPath);

if (isPortable) {
process.env['VSCODE_PORTABLE'] = portableDataPath;
process.env.VSCODE_PORTABLE = portableDataPath;
} else {
delete process.env['VSCODE_PORTABLE'];
delete process.env.VSCODE_PORTABLE;
}

if (isTempPortable) {
if (process.platform === 'win32') {
process.env['TMP'] = portableTempPath;
process.env['TEMP'] = portableTempPath;
process.env.TMP = portableTempPath;
process.env.TEMP = portableTempPath;
} else {
process.env['TMPDIR'] = portableTempPath;
process.env.TMPDIR = portableTempPath;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
*--------------------------------------------------------------------------------------------*/

// Keep bootstrap-esm.js from redefining 'fs'.
delete process.env['ELECTRON_RUN_AS_NODE'];
delete process.env.ELECTRON_RUN_AS_NODE;
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import { product } from './bootstrap-meta.js';

// NLS
const nlsConfiguration = await resolveNLSConfiguration({ userLocale: 'en', osLocale: 'en', commit: product.commit, userDataPath: '', nlsMetadataPath: import.meta.dirname });
process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfiguration); // required for `bootstrap-esm` to pick up NLS messages
process.env.VSCODE_NLS_CONFIG = JSON.stringify(nlsConfiguration); // required for `bootstrap-esm` to pick up NLS messages

// Enable portable support
configurePortable(product);

// Signal processes that we got launched as CLI
process.env['VSCODE_CLI'] = '1';
process.env.VSCODE_CLI = '1';

// Bootstrap ESM
await bootstrapESM();
Expand Down
22 changes: 11 additions & 11 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const argvConfig = configureCommandlineSwitchesSync(args);
// 1) disabled via command line using either
// `--no-sandbox` or `--disable-chromium-sandbox` argument.
// 2) argv.json contains `disable-chromium-sandbox: true`.
if (args['sandbox'] &&
if (args.sandbox &&
!args['disable-chromium-sandbox'] &&
!argvConfig['disable-chromium-sandbox']) {
app.enableSandbox();
Expand Down Expand Up @@ -153,7 +153,7 @@ if (process.platform === 'win32' || process.platform === 'linux') {

// Load our code once ready
app.once('ready', function () {
if (args['trace']) {
if (args.trace) {
let traceOptions: Electron.TraceConfig | Electron.TraceCategoriesAndOptions;
if (args['trace-memory-infra']) {
const customCategories = args['trace-category-filter']?.split(',') || [];
Expand Down Expand Up @@ -209,8 +209,8 @@ async function onReady() {
* Main startup routine
*/
async function startup(codeCachePath: string | undefined, nlsConfig: INLSConfiguration): Promise<void> {
process.env['VSCODE_NLS_CONFIG'] = JSON.stringify(nlsConfig);
process.env['VSCODE_CODE_CACHE_PATH'] = codeCachePath || '';
process.env.VSCODE_NLS_CONFIG = JSON.stringify(nlsConfig);
process.env.VSCODE_CODE_CACHE_PATH = codeCachePath || '';

// Bootstrap ESM
await bootstrapESM();
Expand Down Expand Up @@ -442,13 +442,13 @@ function createDefaultArgvConfigSync(argvConfigPath: string): void {
}

function getArgvConfigPath(): string {
const vscodePortable = process.env['VSCODE_PORTABLE'];
const vscodePortable = process.env.VSCODE_PORTABLE;
if (vscodePortable) {
return path.join(vscodePortable, 'argv.json');
}

let dataFolderName = product.dataFolderName;
if (process.env['VSCODE_DEV']) {
if (process.env.VSCODE_DEV) {
dataFolderName = `${dataFolderName}-dev`;
}

Expand Down Expand Up @@ -506,7 +506,7 @@ function configureCrashReporter(): void {
} else {
switch (process.arch) {
case 'x64':
submitURL = appCenter['darwin'];
submitURL = appCenter.darwin;
break;
case 'arm64':
submitURL = appCenter['darwin-arm64'];
Expand Down Expand Up @@ -536,10 +536,10 @@ function configureCrashReporter(): void {
// Start crash reporter for all processes
const productName = (product.crashReporter ? product.crashReporter.productName : undefined) || product.nameShort;
const companyName = (product.crashReporter ? product.crashReporter.companyName : undefined) || 'Microsoft';
const uploadToServer = Boolean(!process.env['VSCODE_DEV'] && submitURL && !crashReporterDirectory);
const uploadToServer = Boolean(!process.env.VSCODE_DEV && submitURL && !crashReporterDirectory);
crashReporter.start({
companyName,
productName: process.env['VSCODE_DEV'] ? `${productName} Dev` : productName,
productName: process.env.VSCODE_DEV ? `${productName} Dev` : productName,
submitURL,
uploadToServer,
compress: true,
Expand Down Expand Up @@ -625,7 +625,7 @@ function getCodeCachePath(): string | undefined {
}

// running out of sources
if (process.env['VSCODE_DEV']) {
if (process.env.VSCODE_DEV) {
return undefined;
}

Expand Down Expand Up @@ -727,7 +727,7 @@ async function resolveNlsConfiguration(): Promise<INLSConfiguration> {
* the locale we receive from the user or OS.
*/
function getUserDefinedLocale(argvConfig: IArgvConfig): string | undefined {
const locale = args['locale'];
const locale = args.locale;
if (locale) {
return locale.toLowerCase(); // a directly provided --locale always wins
}
Expand Down
Loading