chore(vscode): update to 1.55.2

This commit is contained in:
Akash Satheesan
2021-04-09 11:32:27 +05:30
1102 changed files with 39988 additions and 23544 deletions

View File

@@ -45,6 +45,8 @@ export interface ICommonNativeHostService {
readonly onDidFocusWindow: Event<number>;
readonly onDidBlurWindow: Event<number>;
readonly onDidChangeDisplay: Event<void>;
readonly onDidResumeOS: Event<unknown>;
readonly onDidChangeColorScheme: Event<IColorScheme>;
@@ -98,7 +100,7 @@ export interface ICommonNativeHostService {
moveItemToTrash(fullPath: string, deleteOnFail?: boolean): Promise<boolean>;
isAdmin(): Promise<boolean>;
writeElevated(source: URI, target: URI, options?: { overwriteReadonly?: boolean }): Promise<void>;
writeElevated(source: URI, target: URI, options?: { unlock?: boolean }): Promise<void>;
getOSProperties(): Promise<IOSProperties>;
getOSStatistics(): Promise<IOSStatistics>;

View File

@@ -5,7 +5,7 @@
import { Emitter, Event } from 'vs/base/common/event';
import { IWindowsMainService, ICodeWindow, OpenContext } from 'vs/platform/windows/electron-main/windows';
import { MessageBoxOptions, MessageBoxReturnValue, shell, OpenDevToolsOptions, SaveDialogOptions, SaveDialogReturnValue, OpenDialogOptions, OpenDialogReturnValue, Menu, BrowserWindow, app, clipboard, powerMonitor, nativeTheme } from 'electron';
import { MessageBoxOptions, MessageBoxReturnValue, shell, OpenDevToolsOptions, SaveDialogOptions, SaveDialogReturnValue, OpenDialogOptions, OpenDialogReturnValue, Menu, BrowserWindow, app, clipboard, powerMonitor, nativeTheme, screen, Display } from 'electron';
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
import { IOpenedWindow, IOpenWindowOptions, IWindowOpenable, IOpenEmptyWindowOptions, IColorScheme } from 'vs/platform/windows/common/windows';
import { INativeOpenDialogOptions } from 'vs/platform/dialogs/common/dialogs';
@@ -24,7 +24,7 @@ import { arch, totalmem, release, platform, type, loadavg, freemem, cpus } from
import { virtualMachineHint } from 'vs/base/node/id';
import { ILogService } from 'vs/platform/log/common/log';
import { dirname, join } from 'vs/base/common/path';
import product from 'vs/platform/product/common/product';
import { IProductService } from 'vs/platform/product/common/productService';
import { memoize } from 'vs/base/common/decorators';
import { Disposable } from 'vs/base/common/lifecycle';
import { ISharedProcess } from 'vs/platform/sharedProcess/node/sharedProcess';
@@ -49,7 +49,8 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
@ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
@IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@ILogService private readonly logService: ILogService
@ILogService private readonly logService: ILogService,
@IProductService private readonly productService: IProductService
) {
super();
@@ -74,6 +75,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
//#endregion
//#region Events
readonly onDidOpenWindow = Event.map(this.windowsMainService.onDidOpenWindow, window => window.id);
@@ -95,8 +97,20 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
private readonly _onDidChangePassword = this._register(new Emitter<{ account: string, service: string }>());
readonly onDidChangePassword = this._onDidChangePassword.event;
readonly onDidChangeDisplay = Event.debounce(Event.any(
Event.filter(Event.fromNodeEventEmitter(screen, 'display-metrics-changed', (event: Electron.Event, display: Display, changedMetrics?: string[]) => changedMetrics), changedMetrics => {
// Electron will emit 'display-metrics-changed' events even when actually
// going fullscreen, because the dock hides. However, we do not want to
// react on this event as there is no change in display bounds.
return !(Array.isArray(changedMetrics) && changedMetrics.length === 1 && changedMetrics[0] === 'workArea');
}),
Event.fromNodeEventEmitter(screen, 'display-added'),
Event.fromNodeEventEmitter(screen, 'display-removed')
), () => { }, 100);
//#endregion
//#region Window
async getWindows(): Promise<IOpenedWindow[]> {
@@ -148,7 +162,8 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
addMode: options.addMode,
gotoLineMode: options.gotoLineMode,
noRecentEntry: options.noRecentEntry,
waitMarkerFileURI: options.waitMarkerFileURI
waitMarkerFileURI: options.waitMarkerFileURI,
remoteAuthority: options.remoteAuthority || undefined
});
}
}
@@ -234,6 +249,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
//#endregion
//#region Dialog
async showMessageBox(windowId: number | undefined, options: MessageBoxOptions): Promise<MessageBoxReturnValue> {
@@ -295,7 +311,8 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
contextWindowId: windowId,
cli: this.environmentMainService.args,
urisToOpen: openable,
forceNewWindow: options.forceNewWindow
forceNewWindow: options.forceNewWindow,
/* remoteAuthority will be determined based on openable */
});
}
@@ -313,6 +330,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
//#endregion
//#region OS
async showItemInFolder(windowId: number | undefined, path: string): Promise<void> {
@@ -373,20 +391,20 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
return isAdmin;
}
async writeElevated(windowId: number | undefined, source: URI, target: URI, options?: { overwriteReadonly?: boolean }): Promise<void> {
async writeElevated(windowId: number | undefined, source: URI, target: URI, options?: { unlock?: boolean }): Promise<void> {
const sudoPrompt = await import('sudo-prompt');
return new Promise<void>((resolve, reject) => {
const sudoCommand: string[] = [`"${this.cliPath}"`];
if (options?.overwriteReadonly) {
if (options?.unlock) {
sudoCommand.push('--file-chmod');
}
sudoCommand.push('--file-write', `"${source.fsPath}"`, `"${target.fsPath}"`);
const promptOptions = {
name: product.nameLong.replace('-', ''),
icns: (isMacintosh && this.environmentMainService.isBuilt) ? join(dirname(this.environmentMainService.appRoot), `${product.nameShort}.icns`) : undefined
name: this.productService.nameLong.replace('-', ''),
icns: (isMacintosh && this.environmentMainService.isBuilt) ? join(dirname(this.environmentMainService.appRoot), `${this.productService.nameShort}.icns`) : undefined
};
sudoPrompt.exec(sudoCommand.join(' '), promptOptions, (error: string, stdout: string, stderr: string) => {
@@ -413,7 +431,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
// Windows
if (isWindows) {
if (this.environmentMainService.isBuilt) {
return join(dirname(process.execPath), 'bin', `${product.applicationName}.cmd`);
return join(dirname(process.execPath), 'bin', `${this.productService.applicationName}.cmd`);
}
return join(this.environmentMainService.appRoot, 'scripts', 'code-cli.bat');
@@ -422,7 +440,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
// Linux
if (isLinux) {
if (this.environmentMainService.isBuilt) {
return join(dirname(process.execPath), 'bin', `${product.applicationName}`);
return join(dirname(process.execPath), 'bin', `${this.productService.applicationName}`);
}
return join(this.environmentMainService.appRoot, 'scripts', 'code-cli.sh');
@@ -502,10 +520,11 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
//#endregion
//#region macOS Touchbar
async newWindowTab(): Promise<void> {
this.windowsMainService.open({ context: OpenContext.API, cli: this.environmentMainService.args, forceNewTabbedWindow: true, forceEmpty: true });
this.windowsMainService.open({ context: OpenContext.API, cli: this.environmentMainService.args, forceNewTabbedWindow: true, forceEmpty: true, remoteAuthority: this.environmentMainService.args.remote || undefined });
}
async showPreviousWindowTab(): Promise<void> {
@@ -537,6 +556,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
//#endregion
//#region Lifecycle
async notifyReady(windowId: number | undefined): Promise<void> {
@@ -591,6 +611,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
//#endregion
//#region Connectivity
async resolveProxy(windowId: number | undefined, url: string): Promise<string | undefined> {
@@ -605,6 +626,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
//#endregion
//#region Development
async openDevTools(windowId: number | undefined, options?: OpenDevToolsOptions): Promise<void> {
@@ -635,6 +657,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
//#endregion
//#region Registry (windows)
async windowsGetStringRegKey(windowId: number | undefined, hive: 'HKEY_CURRENT_USER' | 'HKEY_LOCAL_MACHINE' | 'HKEY_CLASSES_ROOT' | 'HKEY_USERS' | 'HKEY_CURRENT_CONFIG', path: string, name: string): Promise<string | undefined> {
@@ -652,6 +675,7 @@ export class NativeHostMainService extends Disposable implements INativeHostMain
//#endregion
//#region Credentials
private static readonly MAX_PASSWORD_LENGTH = 2500;