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

@@ -6,9 +6,10 @@
import { Event } from 'vs/base/common/event';
import { URI } from 'vs/base/common/uri';
import { MessageBoxOptions, MessageBoxReturnValue, MouseInputEvent, OpenDevToolsOptions, OpenDialogOptions, OpenDialogReturnValue, SaveDialogOptions, SaveDialogReturnValue } from 'vs/base/parts/sandbox/common/electronTypes';
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
import { ISerializableCommandAction } from 'vs/platform/action/common/action';
import { INativeOpenDialogOptions } from 'vs/platform/dialogs/common/dialogs';
import { IColorScheme, IOpenedWindow, IOpenEmptyWindowOptions, IOpenWindowOptions, IPartsSplash, IWindowOpenable } from 'vs/platform/windows/common/windows';
import { IPartsSplash } from 'vs/platform/theme/common/themeService';
import { IColorScheme, IOpenedWindow, IOpenEmptyWindowOptions, IOpenWindowOptions, IWindowOpenable } from 'vs/platform/window/common/window';
export interface ICPUProperties {
model: string;
@@ -51,7 +52,7 @@ export interface ICommonNativeHostService {
readonly onDidChangeColorScheme: Event<IColorScheme>;
readonly onDidChangePassword: Event<{ service: string, account: string }>;
readonly onDidChangePassword: Event<{ service: string; account: string }>;
// Window
getWindows(): Promise<IOpenedWindow[]>;
@@ -70,6 +71,8 @@ export interface ICommonNativeHostService {
unmaximizeWindow(): Promise<void>;
minimizeWindow(): Promise<void>;
updateTitleBarOverlay(backgroundColor: string, foregroundColor: string): Promise<void>;
setMinimumSize(width: number | undefined, height: number | undefined): Promise<void>;
saveWindowSplash(splash: IPartsSplash): Promise<void>;
@@ -82,7 +85,7 @@ export interface ICommonNativeHostService {
* should only be used if it is necessary to steal focus from the current
* focused application which may not be VSCode.
*/
focusWindow(options?: { windowId?: number, force?: boolean }): Promise<void>;
focusWindow(options?: { windowId?: number; force?: boolean }): Promise<void>;
// Dialogs
showMessageBox(options: MessageBoxOptions): Promise<MessageBoxReturnValue>;
@@ -137,8 +140,8 @@ export interface ICommonNativeHostService {
uninstallShellCommand(): Promise<void>;
// Lifecycle
notifyReady(): Promise<void>
relaunch(options?: { addArgs?: string[], removeArgs?: string[] }): Promise<void>;
notifyReady(): Promise<void>;
relaunch(options?: { addArgs?: string[]; removeArgs?: string[] }): Promise<void>;
reload(options?: { disableExtensions?: boolean }): Promise<void>;
closeWindow(): Promise<void>;
closeWindowById(windowId: number): Promise<void>;
@@ -153,14 +156,8 @@ export interface ICommonNativeHostService {
// Connectivity
resolveProxy(url: string): Promise<string | undefined>;
findFreePort(startPort: number, giveUpAfter: number, timeout: number, stride?: number): Promise<number>;
// Registry (windows only)
windowsGetStringRegKey(hive: 'HKEY_CURRENT_USER' | 'HKEY_LOCAL_MACHINE' | 'HKEY_CLASSES_ROOT' | 'HKEY_USERS' | 'HKEY_CURRENT_CONFIG', path: string, name: string): Promise<string | undefined>;
// Credentials
getPassword(service: string, account: string): Promise<string | null>;
setPassword(service: string, account: string, password: string): Promise<void>;
deletePassword(service: string, account: string): Promise<boolean>;
findPassword(service: string): Promise<string | null>;
findCredentials(service: string): Promise<Array<{ account: string, password: string }>>
}

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { exec } from 'child_process';
import { app, BrowserWindow, clipboard, Display, Menu, MessageBoxOptions, MessageBoxReturnValue, nativeTheme, OpenDevToolsOptions, OpenDialogOptions, OpenDialogReturnValue, powerMonitor, SaveDialogOptions, SaveDialogReturnValue, screen, shell } from 'electron';
import { app, BrowserWindow, clipboard, Display, Menu, MessageBoxOptions, MessageBoxReturnValue, OpenDevToolsOptions, OpenDialogOptions, OpenDialogReturnValue, powerMonitor, SaveDialogOptions, SaveDialogReturnValue, screen, shell } from 'electron';
import { arch, cpus, freemem, loadavg, platform, release, totalmem, type } from 'os';
import { promisify } from 'util';
import { memoize } from 'vs/base/common/decorators';
@@ -19,9 +19,10 @@ import { URI } from 'vs/base/common/uri';
import { realpath } from 'vs/base/node/extpath';
import { virtualMachineHint } from 'vs/base/node/id';
import { Promises, SymlinkSupport } from 'vs/base/node/pfs';
import { findFreePort } from 'vs/base/node/ports';
import { MouseInputEvent } from 'vs/base/parts/sandbox/common/electronTypes';
import { localize } from 'vs/nls';
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
import { ISerializableCommandAction } from 'vs/platform/action/common/action';
import { INativeOpenDialogOptions } from 'vs/platform/dialogs/common/dialogs';
import { IDialogMainService } from 'vs/platform/dialogs/electron-main/dialogMainService';
import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService';
@@ -31,22 +32,18 @@ import { ILogService } from 'vs/platform/log/common/log';
import { ICommonNativeHostService, IOSProperties, IOSStatistics } from 'vs/platform/native/common/native';
import { IProductService } from 'vs/platform/product/common/productService';
import { ISharedProcess } from 'vs/platform/sharedProcess/node/sharedProcess';
import { ITelemetryData, ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IPartsSplash } from 'vs/platform/theme/common/themeService';
import { IThemeMainService } from 'vs/platform/theme/electron-main/themeMainService';
import { IColorScheme, IOpenedWindow, IOpenEmptyWindowOptions, IOpenWindowOptions, IPartsSplash, IWindowOpenable } from 'vs/platform/windows/common/windows';
import { ICodeWindow, IWindowsMainService, OpenContext } from 'vs/platform/windows/electron-main/windows';
import { isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
import { ICodeWindow } from 'vs/platform/window/electron-main/window';
import { IColorScheme, IOpenedWindow, IOpenEmptyWindowOptions, IOpenWindowOptions, IWindowOpenable } from 'vs/platform/window/common/window';
import { IWindowsMainService, OpenContext } from 'vs/platform/windows/electron-main/windows';
import { isWorkspaceIdentifier } from 'vs/platform/workspace/common/workspace';
import { IWorkspacesManagementMainService } from 'vs/platform/workspaces/electron-main/workspacesManagementMainService';
export interface INativeHostMainService extends AddFirstParameterToFunctions<ICommonNativeHostService, Promise<unknown> /* only methods, not events */, number | undefined /* window ID */> { }
export const INativeHostMainService = createDecorator<INativeHostMainService>('nativeHostMainService');
interface ChunkedPassword {
content: string;
hasNextChunk: boolean;
}
export class NativeHostMainService extends Disposable implements INativeHostMainService {
declare readonly _serviceBrand: undefined;
@@ -57,23 +54,12 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
@IDialogMainService private readonly dialogMainService: IDialogMainService,
@ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@ILogService private readonly logService: ILogService,
@IProductService private readonly productService: IProductService,
@IThemeMainService private readonly themeMainService: IThemeMainService,
@IWorkspacesManagementMainService private readonly workspacesManagementMainService: IWorkspacesManagementMainService
) {
super();
this.registerListeners();
}
private registerListeners(): void {
// Color Scheme changes
nativeTheme.on('updated', () => {
this._onDidChangeColorScheme.fire(this.osColorScheme);
});
}
@@ -99,10 +85,9 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
readonly onDidResumeOS = Event.fromNodeEventEmitter(powerMonitor, 'resume');
private readonly _onDidChangeColorScheme = this._register(new Emitter<IColorScheme>());
readonly onDidChangeColorScheme = this._onDidChangeColorScheme.event;
readonly onDidChangeColorScheme = this.themeMainService.onDidChangeColorScheme;
private readonly _onDidChangePassword = this._register(new Emitter<{ account: string, service: string }>());
private readonly _onDidChangePassword = this._register(new Emitter<{ account: string; service: string }>());
readonly onDidChangePassword = this._onDidChangePassword.event;
readonly onDidChangeDisplay = Event.debounce(Event.any(
@@ -227,7 +212,21 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
}
}
async focusWindow(windowId: number | undefined, options?: { windowId?: number; force?: boolean; }): Promise<void> {
async updateTitleBarOverlay(windowId: number | undefined, backgroundColor: string, foregroundColor: string): Promise<void> {
if (!isWindows) {
return; // Windows only
}
const window = this.windowById(windowId);
if (window?.win) {
window.win.setTitleBarOverlay({
color: backgroundColor,
symbolColor: foregroundColor
});
}
}
async focusWindow(windowId: number | undefined, options?: { windowId?: number; force?: boolean }): Promise<void> {
if (options && typeof options.windowId === 'number') {
windowId = options.windowId;
}
@@ -323,7 +322,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
await Promises.unlink(source);
} catch (error) {
switch (error.code) {
case 'EACCES':
case 'EACCES': {
const { response } = await this.showMessageBox(windowId, {
title: this.productService.nameLong,
type: 'info',
@@ -346,6 +345,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
}
}
break;
}
case 'ENOENT':
break; // ignore file not found
default:
@@ -354,7 +354,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
}
}
private async getShellCommandLink(): Promise<{ readonly source: string, readonly target: string }> {
private async getShellCommandLink(): Promise<{ readonly source: string; readonly target: string }> {
const target = resolve(this.environmentMainService.appRoot, 'bin', 'code');
const source = `/usr/local/bin/${this.productService.applicationName}`;
@@ -393,7 +393,6 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
async pickFileFolderAndOpen(windowId: number | undefined, options: INativeOpenDialogOptions): Promise<void> {
const paths = await this.dialogMainService.pickFileFolder(options);
if (paths) {
this.sendPickerTelemetry(paths, options.telemetryEventName || 'openFileFolder', options.telemetryExtraData);
this.doOpenPicked(await Promise.all(paths.map(async path => (await SymlinkSupport.existsDirectory(path)) ? { folderUri: URI.file(path) } : { fileUri: URI.file(path) })), options, windowId);
}
}
@@ -401,7 +400,6 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
async pickFolderAndOpen(windowId: number | undefined, options: INativeOpenDialogOptions): Promise<void> {
const paths = await this.dialogMainService.pickFolder(options);
if (paths) {
this.sendPickerTelemetry(paths, options.telemetryEventName || 'openFolder', options.telemetryExtraData);
this.doOpenPicked(paths.map(path => ({ folderUri: URI.file(path) })), options, windowId);
}
}
@@ -409,7 +407,6 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
async pickFileAndOpen(windowId: number | undefined, options: INativeOpenDialogOptions): Promise<void> {
const paths = await this.dialogMainService.pickFile(options);
if (paths) {
this.sendPickerTelemetry(paths, options.telemetryEventName || 'openFile', options.telemetryExtraData);
this.doOpenPicked(paths.map(path => ({ fileUri: URI.file(path) })), options, windowId);
}
}
@@ -417,7 +414,6 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
async pickWorkspaceAndOpen(windowId: number | undefined, options: INativeOpenDialogOptions): Promise<void> {
const paths = await this.dialogMainService.pickWorkspace(options);
if (paths) {
this.sendPickerTelemetry(paths, options.telemetryEventName || 'openWorkspace', options.telemetryExtraData);
this.doOpenPicked(paths.map(path => ({ workspaceUri: URI.file(path) })), options, windowId);
}
}
@@ -433,18 +429,6 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
});
}
private sendPickerTelemetry(paths: string[], telemetryEventName: string, telemetryExtraData?: ITelemetryData) {
const numberOfPaths = paths ? paths.length : 0;
// Telemetry
// __GDPR__TODO__ Dynamic event names and dynamic properties. Can not be registered statically.
this.telemetryService.publicLog(telemetryEventName, {
...telemetryExtraData,
outcome: numberOfPaths ? 'success' : 'canceled',
numberOfPaths
});
}
//#endregion
@@ -509,7 +493,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
}
async writeElevated(windowId: number | undefined, source: URI, target: URI, options?: { unlock?: boolean }): Promise<void> {
const sudoPrompt = await import('sudo-prompt');
const sudoPrompt = await import('@vscode/sudo-prompt');
return new Promise<void>((resolve, reject) => {
const sudoCommand: string[] = [`"${this.cliPath}"`];
@@ -593,15 +577,8 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
return virtualMachineHint.value();
}
private get osColorScheme(): IColorScheme {
return {
highContrast: nativeTheme.shouldUseInvertedColorScheme || nativeTheme.shouldUseHighContrastColors,
dark: nativeTheme.shouldUseDarkColors
};
}
public async getOSColorScheme(): Promise<IColorScheme> {
return this.osColorScheme;
return this.themeMainService.getColorScheme();
}
@@ -706,7 +683,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
}
}
async relaunch(windowId: number | undefined, options?: { addArgs?: string[], removeArgs?: string[] }): Promise<void> {
async relaunch(windowId: number | undefined, options?: { addArgs?: string[]; removeArgs?: string[] }): Promise<void> {
return this.lifecycleMainService.relaunch(options);
}
@@ -779,6 +756,10 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
}
}
findFreePort(windowId: number | undefined, startPort: number, giveUpAfter: number, timeout: number, stride = 1): Promise<number> {
return findFreePort(startPort, giveUpAfter, timeout, stride);
}
//#endregion
@@ -820,7 +801,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
return undefined;
}
const Registry = await import('vscode-windows-registry');
const Registry = await import('@vscode/windows-registry');
try {
return Registry.GetStringRegKey(hive, path, name);
} catch {
@@ -830,123 +811,6 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
//#endregion
//#region Credentials
private static readonly MAX_PASSWORD_LENGTH = 2500;
private static readonly PASSWORD_CHUNK_SIZE = NativeHostMainService.MAX_PASSWORD_LENGTH - 100;
async getPassword(windowId: number | undefined, service: string, account: string): Promise<string | null> {
const keytar = await this.withKeytar();
const password = await keytar.getPassword(service, account);
if (password) {
try {
let { content, hasNextChunk }: ChunkedPassword = JSON.parse(password);
if (!content || !hasNextChunk) {
return password;
}
let index = 1;
while (hasNextChunk) {
const nextChunk = await keytar.getPassword(service, `${account}-${index}`);
const result: ChunkedPassword = JSON.parse(nextChunk!);
content += result.content;
hasNextChunk = result.hasNextChunk;
index++;
}
return content;
} catch {
return password;
}
}
return password;
}
async setPassword(windowId: number | undefined, service: string, account: string, password: string): Promise<void> {
const keytar = await this.withKeytar();
const MAX_SET_ATTEMPTS = 3;
// Sometimes Keytar has a problem talking to the keychain on the OS. To be more resilient, we retry a few times.
const setPasswordWithRetry = async (service: string, account: string, password: string) => {
let attempts = 0;
let error: any;
while (attempts < MAX_SET_ATTEMPTS) {
try {
await keytar.setPassword(service, account, password);
return;
} catch (e) {
error = e;
this.logService.warn('Error attempting to set a password: ', e);
attempts++;
await new Promise(resolve => setTimeout(resolve, 200));
}
}
// throw last error
throw error;
};
if (isWindows && password.length > NativeHostMainService.MAX_PASSWORD_LENGTH) {
let index = 0;
let chunk = 0;
let hasNextChunk = true;
while (hasNextChunk) {
const passwordChunk = password.substring(index, index + NativeHostMainService.PASSWORD_CHUNK_SIZE);
index += NativeHostMainService.PASSWORD_CHUNK_SIZE;
hasNextChunk = password.length - index > 0;
const content: ChunkedPassword = {
content: passwordChunk,
hasNextChunk: hasNextChunk
};
await setPasswordWithRetry(service, chunk ? `${account}-${chunk}` : account, JSON.stringify(content));
chunk++;
}
} else {
await setPasswordWithRetry(service, account, password);
}
this._onDidChangePassword.fire({ service, account });
}
async deletePassword(windowId: number | undefined, service: string, account: string): Promise<boolean> {
const keytar = await this.withKeytar();
const didDelete = await keytar.deletePassword(service, account);
if (didDelete) {
this._onDidChangePassword.fire({ service, account });
}
return didDelete;
}
async findPassword(windowId: number | undefined, service: string): Promise<string | null> {
const keytar = await this.withKeytar();
return keytar.findPassword(service);
}
async findCredentials(windowId: number | undefined, service: string): Promise<Array<{ account: string, password: string }>> {
const keytar = await this.withKeytar();
return keytar.findCredentials(service);
}
private async withKeytar(): Promise<typeof import('keytar')> {
if (this.environmentMainService.disableKeytar) {
throw new Error('keytar has been disabled via --disable-keytar option');
}
return await import('keytar');
}
//#endregion
private windowById(windowId: number | undefined): ICodeWindow | undefined {
if (typeof windowId !== 'number') {
return undefined;