Merge from vscode 1b314ab317fbff7d799b21754326b7d849889ceb

This commit is contained in:
ADS Merger
2020-07-15 23:51:18 +00:00
parent aae013d498
commit 9d3f12d0b7
554 changed files with 15159 additions and 8223 deletions

View File

@@ -187,3 +187,11 @@ export interface IWindowConfiguration {
filesToOpenOrCreate?: IPath[];
filesToDiff?: IPath[];
}
/**
* According to Electron docs: `scale := 1.2 ^ level`.
* https://github.com/electron/electron/blob/master/docs/api/web-contents.md#contentssetzoomlevellevel
*/
export function zoomLevelToZoomFactor(zoomLevel = 0): number {
return Math.pow(1.2, zoomLevel);
}

View File

@@ -1009,7 +1009,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
const windowConfig = this.configurationService.getValue<IWindowSettings>('window');
restoreWindows = windowConfig?.restoreWindows || 'all'; // by default restore all windows
if (['all', 'folders', 'one', 'none'].indexOf(restoreWindows) === -1) {
if (!['all', 'folders', 'one', 'none'].includes(restoreWindows)) {
restoreWindows = 'all'; // by default restore all windows
}
}
@@ -1117,6 +1117,7 @@ export class WindowsMainService extends Disposable implements IWindowsMainServic
if (remoteAuthority) {
const first = anyPath.charCodeAt(0);
// make absolute
if (first !== CharCode.Slash) {
if (isWindowsDriveLetter(first) && anyPath.charCodeAt(anyPath.charCodeAt(1)) === CharCode.Colon) {

View File

@@ -0,0 +1,29 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { webFrame } from 'vs/base/parts/sandbox/electron-sandbox/globals';
import { zoomLevelToZoomFactor } from 'vs/platform/windows/common/windows';
import { setZoomFactor, setZoomLevel, getZoomLevel } from 'vs/base/browser/browser';
/**
* Apply a zoom level to the window. Also sets it in our in-memory
* browser helper so that it can be accessed in non-electron layers.
*/
export function applyZoom(zoomLevel: number): void {
webFrame.setZoomLevel(zoomLevel);
setZoomFactor(zoomLevelToZoomFactor(zoomLevel));
// Cannot be trusted because the webFrame might take some time
// until it really applies the new zoom level
// See https://github.com/Microsoft/vscode/issues/26151
setZoomLevel(zoomLevel, false /* isTrusted */);
}
export function zoomIn(): void {
applyZoom(getZoomLevel() + 1);
}
export function zoomOut(): void {
applyZoom(getZoomLevel() - 1);
}