Merge vscode 1.67 (#20883)

* Fix initial build breaks from 1.67 merge (#2514)

* Update yarn lock files

* Update build scripts

* Fix tsconfig

* Build breaks

* WIP

* Update yarn lock files

* Misc breaks

* Updates to package.json

* Breaks

* Update yarn

* Fix breaks

* Breaks

* Build breaks

* Breaks

* Breaks

* Breaks

* Breaks

* Breaks

* Missing file

* Breaks

* Breaks

* Breaks

* Breaks

* Breaks

* Fix several runtime breaks (#2515)

* Missing files

* Runtime breaks

* Fix proxy ordering issue

* Remove commented code

* Fix breaks with opening query editor

* Fix post merge break

* Updates related to setup build and other breaks (#2516)

* Fix bundle build issues

* Update distro

* Fix distro merge and update build JS files

* Disable pipeline steps

* Remove stats call

* Update license name

* Make new RPM dependencies a warning

* Fix extension manager version checks

* Update JS file

* Fix a few runtime breaks

* Fixes

* Fix runtime issues

* Fix build breaks

* Update notebook tests (part 1)

* Fix broken tests

* Linting errors

* Fix hygiene

* Disable lint rules

* Bump distro

* Turn off smoke tests

* Disable integration tests

* Remove failing "activate" test

* Remove failed test assertion

* Disable other broken test

* Disable query history tests

* Disable extension unit tests

* Disable failing tasks
This commit is contained in:
Karl Burtram
2022-10-19 19:13:18 -07:00
committed by GitHub
parent 33c6daaea1
commit 8a3d08f0de
3738 changed files with 192313 additions and 107208 deletions

View File

@@ -20,9 +20,10 @@ const helpCategories = {
export interface Option<OptionType> {
type: OptionType;
alias?: string;
deprecates?: string; // old deprecated id
deprecates?: string[]; // old deprecated ids
args?: string | string[];
description?: string;
deprecationMessage?: string;
cat?: keyof typeof helpCategories;
}
@@ -49,15 +50,16 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
'user-data-dir': { type: 'string', cat: 'o', args: 'dir', description: localize('userDataDir', "Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code.") },
'help': { type: 'boolean', cat: 'o', alias: 'h', description: localize('help', "Print usage.") },
'extensions-dir': { type: 'string', deprecates: 'extensionHomePath', cat: 'e', args: 'dir', description: localize('extensionHomePath', "Set the root path for extensions.") },
'extensions-dir': { type: 'string', deprecates: ['extensionHomePath'], cat: 'e', args: 'dir', description: localize('extensionHomePath', "Set the root path for extensions.") },
'extensions-download-dir': { type: 'string' },
'builtin-extensions-dir': { type: 'string' },
'list-extensions': { type: 'boolean', cat: 'e', description: localize('listExtensions', "List the installed extensions.") },
'show-versions': { type: 'boolean', cat: 'e', description: localize('showVersions', "Show versions of installed extensions, when using --list-extensions.") },
'category': { type: 'string', cat: 'e', description: localize('category', "Filters installed extensions by provided category, when using --list-extensions."), args: 'category' },
'install-extension': { type: 'string[]', cat: 'e', args: 'extension-id[@version] | path-to-vsix', description: localize('installExtension', "Installs or updates the extension. The identifier of an extension is always `${publisher}.${name}`. Use `--force` argument to update to latest version. To install a specific version provide `@${version}`. For example: 'vscode.csharp@1.2.3'.") },
'uninstall-extension': { type: 'string[]', cat: 'e', args: 'extension-id', description: localize('uninstallExtension', "Uninstalls an extension.") },
'enable-proposed-api': { type: 'string[]', cat: 'e', args: 'extension-id', description: localize('experimentalApis', "Enables proposed API features for extensions. Can receive one or more extension IDs to enable individually.") },
'install-extension': { type: 'string[]', cat: 'e', args: 'ext-id | path', description: localize('installExtension', "Installs or updates an extension. The argument is either an extension id or a path to a VSIX. The identifier of an extension is '${publisher}.${name}'. Use '--force' argument to update to latest version. To install a specific version provide '@${version}'. For example: 'vscode.csharp@1.2.3'.") },
'pre-release': { type: 'boolean', cat: 'e', description: localize('install prerelease', "Installs the pre-release version of the extension, when using --install-extension") },
'uninstall-extension': { type: 'string[]', cat: 'e', args: 'ext-id', description: localize('uninstallExtension', "Uninstalls an extension.") },
'enable-proposed-api': { type: 'string[]', cat: 'e', args: 'ext-id', description: localize('experimentalApis', "Enables proposed API features for extensions. Can receive one or more extension IDs to enable individually.") },
'version': { type: 'boolean', cat: 't', alias: 'v', description: localize('version', "Print version.") },
'verbose': { type: 'boolean', cat: 't', description: localize('verbose', "Print verbose output (implies --wait).") },
@@ -68,13 +70,14 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
'no-cached-data': { type: 'boolean' },
'prof-startup-prefix': { type: 'string' },
'prof-v8-extensions': { type: 'boolean' },
'disable-extensions': { type: 'boolean', deprecates: 'disableExtensions', cat: 't', description: localize('disableExtensions', "Disable all installed extensions.") },
'disable-extension': { type: 'string[]', cat: 't', args: 'extension-id', description: localize('disableExtension', "Disable an extension.") },
'sync': { type: 'string', cat: 't', description: localize('turn sync', "Turn sync on or off."), args: ['on', 'off'] },
'disable-extensions': { type: 'boolean', deprecates: ['disableExtensions'], cat: 't', description: localize('disableExtensions', "Disable all installed extensions.") },
'disable-extension': { type: 'string[]', cat: 't', args: 'ext-id', description: localize('disableExtension', "Disable an extension.") },
'sync': { type: 'string', cat: 't', description: localize('turn sync', "Turn sync on or off."), args: ['on | off'] },
'inspect-extensions': { type: 'string', deprecates: 'debugPluginHost', args: 'port', cat: 't', description: localize('inspect-extensions', "Allow debugging and profiling of extensions. Check the developer tools for the connection URI.") },
'inspect-brk-extensions': { type: 'string', deprecates: 'debugBrkPluginHost', args: 'port', cat: 't', description: localize('inspect-brk-extensions', "Allow debugging and profiling of extensions with the extension host being paused after start. Check the developer tools for the connection URI.") },
'inspect-extensions': { type: 'string', deprecates: ['debugPluginHost'], args: 'port', cat: 't', description: localize('inspect-extensions', "Allow debugging and profiling of extensions. Check the developer tools for the connection URI.") },
'inspect-brk-extensions': { type: 'string', deprecates: ['debugBrkPluginHost'], args: 'port', cat: 't', description: localize('inspect-brk-extensions', "Allow debugging and profiling of extensions with the extension host being paused after start. Check the developer tools for the connection URI.") },
'disable-gpu': { type: 'boolean', cat: 't', description: localize('disableGPU', "Disable GPU hardware acceleration.") },
'ms-enable-electron-run-as-node': { type: 'boolean' },
'max-memory': { type: 'string', cat: 't', description: localize('maxMemory', "Max memory size for a window (in Mbytes)."), args: 'memory' },
'telemetry': { type: 'boolean', cat: 't', description: localize('telemetry', "Shows all telemetry events which VS code collects.") },
@@ -91,11 +94,11 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
'debugRenderer': { type: 'boolean' },
'inspect-ptyhost': { type: 'string' },
'inspect-brk-ptyhost': { type: 'string' },
'inspect-search': { type: 'string', deprecates: 'debugSearch' },
'inspect-brk-search': { type: 'string', deprecates: 'debugBrkSearch' },
'inspect-search': { type: 'string', deprecates: ['debugSearch'] },
'inspect-brk-search': { type: 'string', deprecates: ['debugBrkSearch'] },
'export-default-configuration': { type: 'string' },
'install-source': { type: 'string' },
'driver': { type: 'string' },
'enable-smoke-test-driver': { type: 'boolean' },
'logExtensionHostCommunication': { type: 'boolean' },
'skip-release-notes': { type: 'boolean' },
'skip-welcome': { type: 'boolean' },
@@ -111,7 +114,6 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
'open-url': { type: 'boolean' },
'file-write': { type: 'boolean' },
'file-chmod': { type: 'boolean' },
'driver-verbose': { type: 'boolean' },
'install-builtin-extension': { type: 'string[]' },
'force': { type: 'boolean' },
'do-not-sync': { type: 'boolean' },
@@ -155,6 +157,7 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
'log-net-log': { type: 'string' },
'vmodule': { type: 'string' },
'_urls': { type: 'string[]' },
'disable-dev-shm-usage': { type: 'boolean' },
_: { type: 'string[]' } // main arguments
};
@@ -162,16 +165,18 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
export interface ErrorReporter {
onUnknownOption(id: string): void;
onMultipleValues(id: string, usedValue: string): void;
onDeprecatedOption(deprecatedId: string, message: string): void;
}
const ignoringReporter: ErrorReporter = {
onUnknownOption: () => { },
onMultipleValues: () => { }
onMultipleValues: () => { },
onDeprecatedOption: () => { }
};
export function parseArgs<T>(args: string[], options: OptionDescriptions<T>, errorReporter: ErrorReporter = ignoringReporter): T {
const alias: { [key: string]: string } = {};
const string: string[] = [];
const string: string[] = ['_'];
const boolean: string[] = [];
for (let optionId in options) {
const o = options[optionId];
@@ -182,12 +187,12 @@ export function parseArgs<T>(args: string[], options: OptionDescriptions<T>, err
if (o.type === 'string' || o.type === 'string[]') {
string.push(optionId);
if (o.deprecates) {
string.push(o.deprecates);
string.push(...o.deprecates);
}
} else if (o.type === 'boolean') {
boolean.push(optionId);
if (o.deprecates) {
boolean.push(o.deprecates);
boolean.push(...o.deprecates);
}
}
}
@@ -209,11 +214,18 @@ export function parseArgs<T>(args: string[], options: OptionDescriptions<T>, err
}
let val = remainingArgs[optionId];
if (o.deprecates && remainingArgs.hasOwnProperty(o.deprecates)) {
if (!val) {
val = remainingArgs[o.deprecates];
if (o.deprecates) {
for (const deprecatedId of o.deprecates) {
if (remainingArgs.hasOwnProperty(deprecatedId)) {
if (!val) {
val = remainingArgs[deprecatedId];
if (val) {
errorReporter.onDeprecatedOption(deprecatedId, o.deprecationMessage || localize('deprecated.useInstead', 'Use {0} instead.', optionId));
}
}
delete remainingArgs[deprecatedId];
}
}
delete remainingArgs[o.deprecates];
}
if (typeof val !== 'undefined') {
@@ -228,6 +240,10 @@ export function parseArgs<T>(args: string[], options: OptionDescriptions<T>, err
}
}
cleanedArgs[optionId] = val;
if (o.deprecationMessage) {
errorReporter.onDeprecatedOption(optionId, o.deprecationMessage);
}
}
delete remainingArgs[optionId];
}
@@ -298,14 +314,15 @@ function wrapText(text: string, columns: number): string[] {
return lines;
}
export function buildHelpMessage(productName: string, executableName: string, version: string, options: OptionDescriptions<any>, isPipeSupported = true): string {
export function buildHelpMessage(productName: string, executableName: string, version: string, options: OptionDescriptions<any>, capabilities?: { noPipe?: boolean; noInputFiles: boolean }): string {
const columns = (process.stdout).isTTY && (process.stdout).columns || 80;
const inputFiles = capabilities?.noInputFiles !== true ? `[${localize('paths', 'paths')}...]` : '';
let help = [`${productName} ${version}`];
const help = [`${productName} ${version}`];
help.push('');
help.push(`${localize('usage', "Usage")}: ${executableName} [${localize('options', "options")}][${localize('paths', 'paths')}...]`);
help.push(`${localize('usage', "Usage")}: ${executableName} [${localize('options', "options")}]${inputFiles}`);
help.push('');
if (isPipeSupported) {
if (capabilities?.noPipe !== true) {
if (isWindows) {
help.push(localize('stdinWindows', "To read output from another program, append '-' (e.g. 'echo Hello World | {0} -')", executableName));
} else {

View File

@@ -8,7 +8,8 @@ import { IProcessEnvironment } from 'vs/base/common/platform';
import { localize } from 'vs/nls';
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
import { ErrorReporter, OPTIONS, parseArgs } from 'vs/platform/environment/node/argv';
import { MIN_MAX_MEMORY_SIZE_MB } from 'vs/platform/files/common/files';
const MIN_MAX_MEMORY_SIZE_MB = 2048;
function parseAndValidate(cmdLineArgs: string[], reportWarnings: boolean): NativeParsedArgs {
const errorReporter: ErrorReporter = {
@@ -16,7 +17,10 @@ function parseAndValidate(cmdLineArgs: string[], reportWarnings: boolean): Nativ
console.warn(localize('unknownOption', "Warning: '{0}' is not in the list of known options, but still passed to Electron/Chromium.", id));
},
onMultipleValues: (id, val) => {
console.warn(localize('multipleValues', "Option '{0}' is defined more than once. Using value '{1}.'", id, val));
console.warn(localize('multipleValues', "Option '{0}' is defined more than once. Using value '{1}'.", id, val));
},
onDeprecatedOption: (deprecatedOption: string, message: string) => {
console.warn(localize('deprecatedArgument', "Option '{0}' is deprecated: {1}", deprecatedOption, message));
}
};

View File

@@ -1,212 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { spawn } from 'child_process';
import { basename } from 'vs/base/common/path';
import { localize } from 'vs/nls';
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { canceled, isPromiseCanceledError } from 'vs/base/common/errors';
import { IProcessEnvironment, isWindows, OS } from 'vs/base/common/platform';
import { generateUuid } from 'vs/base/common/uuid';
import { getSystemShell } from 'vs/base/node/shell';
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
import { isLaunchedFromCli } from 'vs/platform/environment/node/argvHelper';
import { ILogService } from 'vs/platform/log/common/log';
import { Promises } from 'vs/base/common/async';
/**
* The maximum of time we accept to wait on resolving the shell
* environment before giving up. This ensures we are not blocking
* other tasks from running for a too long time period.
*/
const MAX_SHELL_RESOLVE_TIME = 10000;
let unixShellEnvPromise: Promise<typeof process.env> | undefined = undefined;
/**
* We need to get the environment from a user's shell.
* This should only be done when Code itself is not launched
* from within a shell.
*
* Will throw an error if:
* - we hit a timeout of `MAX_SHELL_RESOLVE_TIME`
* - any other error from spawning a shell to figure out the environment
*/
export async function resolveShellEnv(logService: ILogService, args: NativeParsedArgs, env: IProcessEnvironment): Promise<typeof process.env> {
// Skip if --force-disable-user-env
if (args['force-disable-user-env']) {
logService.trace('resolveShellEnv(): skipped (--force-disable-user-env)');
return {};
}
// Skip on windows
else if (isWindows) {
logService.trace('resolveShellEnv(): skipped (Windows)');
return {};
}
// Skip if running from CLI already
else if (isLaunchedFromCli(env) && !args['force-user-env']) {
logService.trace('resolveShellEnv(): skipped (VSCODE_CLI is set)');
return {};
}
// Otherwise resolve (macOS, Linux)
else {
if (isLaunchedFromCli(env)) {
logService.trace('resolveShellEnv(): running (--force-user-env)');
} else {
logService.trace('resolveShellEnv(): running (macOS/Linux)');
}
// Call this only once and cache the promise for
// subsequent calls since this operation can be
// expensive (spawns a process).
if (!unixShellEnvPromise) {
unixShellEnvPromise = Promises.withAsyncBody<NodeJS.ProcessEnv>(async (resolve, reject) => {
const cts = new CancellationTokenSource();
// Give up resolving shell env after some time
const timeout = setTimeout(() => {
cts.dispose(true);
reject(new Error(localize('resolveShellEnvTimeout', "Unable to resolve your shell environment in a reasonable time. Please review your shell configuration.")));
}, MAX_SHELL_RESOLVE_TIME);
// Resolve shell env and handle errors
try {
resolve(await doResolveUnixShellEnv(logService, cts.token));
} catch (error) {
if (!isPromiseCanceledError(error) && !cts.token.isCancellationRequested) {
reject(new Error(localize('resolveShellEnvError', "Unable to resolve your shell environment: {0}", toErrorMessage(error))));
} else {
resolve({});
}
} finally {
clearTimeout(timeout);
cts.dispose();
}
});
}
return unixShellEnvPromise;
}
}
async function doResolveUnixShellEnv(logService: ILogService, token: CancellationToken): Promise<typeof process.env> {
const runAsNode = process.env['ELECTRON_RUN_AS_NODE'];
logService.trace('getUnixShellEnvironment#runAsNode', runAsNode);
const noAttach = process.env['ELECTRON_NO_ATTACH_CONSOLE'];
logService.trace('getUnixShellEnvironment#noAttach', noAttach);
const mark = generateUuid().replace(/-/g, '').substr(0, 12);
const regex = new RegExp(mark + '(.*)' + mark);
const env = {
...process.env,
ELECTRON_RUN_AS_NODE: '1',
ELECTRON_NO_ATTACH_CONSOLE: '1'
};
logService.trace('getUnixShellEnvironment#env', env);
const systemShellUnix = await getSystemShell(OS, env);
logService.trace('getUnixShellEnvironment#shell', systemShellUnix);
return new Promise<typeof process.env>((resolve, reject) => {
if (token.isCancellationRequested) {
return reject(canceled());
}
// handle popular non-POSIX shells
const name = basename(systemShellUnix);
let command: string, shellArgs: Array<string>;
if (/^pwsh(-preview)?$/.test(name)) {
// Older versions of PowerShell removes double quotes sometimes so we use "double single quotes" which is how
// you escape single quotes inside of a single quoted string.
command = `& '${process.execPath}' -p '''${mark}'' + JSON.stringify(process.env) + ''${mark}'''`;
shellArgs = ['-Login', '-Command'];
} else {
command = `'${process.execPath}' -p '"${mark}" + JSON.stringify(process.env) + "${mark}"'`;
if (name === 'tcsh') {
shellArgs = ['-ic'];
} else {
shellArgs = ['-ilc'];
}
}
logService.trace('getUnixShellEnvironment#spawn', JSON.stringify(shellArgs), command);
const child = spawn(systemShellUnix, [...shellArgs, command], {
detached: true,
stdio: ['ignore', 'pipe', 'pipe'],
env
});
token.onCancellationRequested(() => {
child.kill();
return reject(canceled());
});
child.on('error', err => {
logService.error('getUnixShellEnvironment#errorChildProcess', toErrorMessage(err));
reject(err);
});
const buffers: Buffer[] = [];
child.stdout.on('data', b => buffers.push(b));
const stderr: Buffer[] = [];
child.stderr.on('data', b => stderr.push(b));
child.on('close', (code, signal) => {
const raw = Buffer.concat(buffers).toString('utf8');
logService.trace('getUnixShellEnvironment#raw', raw);
const stderrStr = Buffer.concat(stderr).toString('utf8');
if (stderrStr.trim()) {
logService.trace('getUnixShellEnvironment#stderr', stderrStr);
}
if (code || signal) {
return reject(new Error(localize('resolveShellEnvExitError', "Unexpected exit code from spawned shell (code {0}, signal {1})", code, signal)));
}
const match = regex.exec(raw);
const rawStripped = match ? match[1] : '{}';
try {
const env = JSON.parse(rawStripped);
if (runAsNode) {
env['ELECTRON_RUN_AS_NODE'] = runAsNode;
} else {
delete env['ELECTRON_RUN_AS_NODE'];
}
if (noAttach) {
env['ELECTRON_NO_ATTACH_CONSOLE'] = noAttach;
} else {
delete env['ELECTRON_NO_ATTACH_CONSOLE'];
}
// https://github.com/microsoft/vscode/issues/22593#issuecomment-336050758
delete env['XDG_RUNTIME_DIR'];
logService.trace('getUnixShellEnvironment#result', env);
resolve(env);
} catch (err) {
logService.error('getUnixShellEnvironment#errorCaught', toErrorMessage(err));
reject(err);
}
});
});
}

View File

@@ -2,12 +2,10 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/**
* This code is also used by standalone cli's. Avoid adding dependencies to keep the size of the cli small.
*/
import * as fs from 'fs';
import * as os from 'os';
import * as paths from 'vs/base/common/path';
import { createWriteStream } from 'fs';
import { tmpdir } from 'os';
import { randomPath } from 'vs/base/common/extpath';
import { resolveTerminalEncoding } from 'vs/base/node/terminalEncoding';
export function hasStdinWithoutTty() {
@@ -36,17 +34,17 @@ export function stdinDataListener(durationinMs: number): Promise<boolean> {
}
export function getStdinFilePath(): string {
return paths.join(os.tmpdir(), `code-stdin-${Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 3)}`);
return randomPath(tmpdir(), 'code-stdin', 3);
}
export async function readFromStdin(targetPath: string, verbose: boolean): Promise<void> {
// open tmp file for writing
const stdinFileStream = fs.createWriteStream(targetPath);
const stdinFileStream = createWriteStream(targetPath);
let encoding = await resolveTerminalEncoding(verbose);
const iconv = await import('iconv-lite-umd');
const iconv = await import('@vscode/iconv-lite-umd');
if (!iconv.encodingExists(encoding)) {
console.log(`Unsupported terminal encoding: ${encoding}, falling back to UTF-8.`);
encoding = 'utf8';

View File

@@ -3,15 +3,15 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as fs from 'fs';
import { writeFileSync } from 'fs';
import { tmpdir } from 'os';
import { join } from 'vs/base/common/path';
import { randomPath } from 'vs/base/common/extpath';
export function createWaitMarkerFile(verbose?: boolean): string | undefined {
const randomWaitMarkerPath = join(tmpdir(), Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10));
const randomWaitMarkerPath = randomPath(tmpdir());
try {
fs.writeFileSync(randomWaitMarkerPath, ''); // use built-in fs to avoid dragging in more dependencies
writeFileSync(randomWaitMarkerPath, ''); // use built-in fs to avoid dragging in more dependencies
if (verbose) {
console.log(`Marker file for --wait created: ${randomWaitMarkerPath}`);
}