mirror of
https://github.com/coder/code-server.git
synced 2026-06-22 18:07:10 +02:00
chore(vscode): update to 1.54.2
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
import 'vs/css!./media/actions';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import * as nls from 'vs/nls';
|
||||
import { localize } from 'vs/nls';
|
||||
import { applyZoom } from 'vs/platform/windows/electron-sandbox/window';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { getZoomLevel } from 'vs/base/browser/browser';
|
||||
@@ -25,7 +25,7 @@ import { isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/pla
|
||||
export class CloseCurrentWindowAction extends Action {
|
||||
|
||||
static readonly ID = 'workbench.action.closeWindow';
|
||||
static readonly LABEL = nls.localize('closeWindow', "Close Window");
|
||||
static readonly LABEL = localize('closeWindow', "Close Window");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -71,7 +71,7 @@ export abstract class BaseZoomAction extends Action {
|
||||
export class ZoomInAction extends BaseZoomAction {
|
||||
|
||||
static readonly ID = 'workbench.action.zoomIn';
|
||||
static readonly LABEL = nls.localize('zoomIn', "Zoom In");
|
||||
static readonly LABEL = localize('zoomIn', "Zoom In");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -89,7 +89,7 @@ export class ZoomInAction extends BaseZoomAction {
|
||||
export class ZoomOutAction extends BaseZoomAction {
|
||||
|
||||
static readonly ID = 'workbench.action.zoomOut';
|
||||
static readonly LABEL = nls.localize('zoomOut', "Zoom Out");
|
||||
static readonly LABEL = localize('zoomOut', "Zoom Out");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -107,7 +107,7 @@ export class ZoomOutAction extends BaseZoomAction {
|
||||
export class ZoomResetAction extends BaseZoomAction {
|
||||
|
||||
static readonly ID = 'workbench.action.zoomReset';
|
||||
static readonly LABEL = nls.localize('zoomReset', "Reset Zoom");
|
||||
static readonly LABEL = localize('zoomReset', "Reset Zoom");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -126,12 +126,12 @@ export abstract class BaseSwitchWindow extends Action {
|
||||
|
||||
private readonly closeWindowAction: IQuickInputButton = {
|
||||
iconClass: Codicon.removeClose.classNames,
|
||||
tooltip: nls.localize('close', "Close Window")
|
||||
tooltip: localize('close', "Close Window")
|
||||
};
|
||||
|
||||
private readonly closeDirtyWindowAction: IQuickInputButton = {
|
||||
iconClass: 'dirty-window ' + Codicon.closeDirty,
|
||||
tooltip: nls.localize('close', "Close Window"),
|
||||
tooltip: localize('close', "Close Window"),
|
||||
alwaysVisible: true
|
||||
};
|
||||
|
||||
@@ -153,16 +153,16 @@ export abstract class BaseSwitchWindow extends Action {
|
||||
const currentWindowId = this.nativeHostService.windowId;
|
||||
|
||||
const windows = await this.nativeHostService.getWindows();
|
||||
const placeHolder = nls.localize('switchWindowPlaceHolder', "Select a window to switch to");
|
||||
const placeHolder = localize('switchWindowPlaceHolder', "Select a window to switch to");
|
||||
const picks = windows.map(window => {
|
||||
const resource = window.filename ? URI.file(window.filename) : isSingleFolderWorkspaceIdentifier(window.workspace) ? window.workspace.uri : isWorkspaceIdentifier(window.workspace) ? window.workspace.configPath : undefined;
|
||||
const fileKind = window.filename ? FileKind.FILE : isSingleFolderWorkspaceIdentifier(window.workspace) ? FileKind.FOLDER : isWorkspaceIdentifier(window.workspace) ? FileKind.ROOT_FOLDER : FileKind.FILE;
|
||||
return {
|
||||
payload: window.id,
|
||||
label: window.title,
|
||||
ariaLabel: window.dirty ? nls.localize('windowDirtyAriaLabel', "{0}, dirty window", window.title) : window.title,
|
||||
ariaLabel: window.dirty ? localize('windowDirtyAriaLabel', "{0}, dirty window", window.title) : window.title,
|
||||
iconClasses: getIconClasses(this.modelService, this.modeService, resource, fileKind),
|
||||
description: (currentWindowId === window.id) ? nls.localize('current', "Current Window") : undefined,
|
||||
description: (currentWindowId === window.id) ? localize('current', "Current Window") : undefined,
|
||||
buttons: currentWindowId !== window.id ? window.dirty ? [this.closeDirtyWindowAction] : [this.closeWindowAction] : undefined
|
||||
};
|
||||
});
|
||||
@@ -188,7 +188,7 @@ export abstract class BaseSwitchWindow extends Action {
|
||||
export class SwitchWindow extends BaseSwitchWindow {
|
||||
|
||||
static readonly ID = 'workbench.action.switchWindow';
|
||||
static readonly LABEL = nls.localize('switchWindow', "Switch Window...");
|
||||
static readonly LABEL = localize('switchWindow', "Switch Window...");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
@@ -210,7 +210,7 @@ export class SwitchWindow extends BaseSwitchWindow {
|
||||
export class QuickSwitchWindow extends BaseSwitchWindow {
|
||||
|
||||
static readonly ID = 'workbench.action.quickSwitchWindow';
|
||||
static readonly LABEL = nls.localize('quickSwitchWindow', "Quick Switch Window...");
|
||||
static readonly LABEL = localize('quickSwitchWindow', "Quick Switch Window...");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
|
||||
@@ -273,6 +273,12 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
'scope': ConfigurationScope.APPLICATION,
|
||||
'description': localize('window.clickThroughInactive', "If enabled, clicking on an inactive window will both activate the window and trigger the element under the mouse if it is clickable. If disabled, clicking anywhere on an inactive window will activate it only and a second click is required on the element."),
|
||||
'included': isMacintosh
|
||||
},
|
||||
'window.enableExperimentalMainProcessWorkspaceStorage': {
|
||||
'type': 'boolean',
|
||||
'default': false,
|
||||
'scope': ConfigurationScope.APPLICATION,
|
||||
'description': localize('window.localize', "Enables workspace storage access from the main process. Requires a restart to take effect."),
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,34 +9,41 @@ import { Workbench } from 'vs/workbench/browser/workbench';
|
||||
import { NativeWindow } from 'vs/workbench/electron-sandbox/window';
|
||||
import { setZoomLevel, setZoomFactor, setFullscreen } from 'vs/base/browser/browser';
|
||||
import { domContentLoaded } from 'vs/base/browser/dom';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { reviveIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, IWorkspaceInitializationPayload, reviveIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { ILoggerService, ILogService } from 'vs/platform/log/common/log';
|
||||
import { NativeStorageService2 } from 'vs/platform/storage/electron-sandbox/storageService2';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IWorkbenchConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IMainProcessService, ElectronIPCMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService';
|
||||
import { IMainProcessService } from 'vs/platform/ipc/electron-sandbox/services';
|
||||
import { RemoteAuthorityResolverService } from 'vs/platform/remote/electron-sandbox/remoteAuthorityResolverService';
|
||||
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { RemoteAgentService } from 'vs/workbench/services/remote/electron-sandbox/remoteAgentServiceImpl';
|
||||
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
|
||||
import { FileService } from 'vs/platform/files/common/fileService';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { RemoteFileSystemProvider } from 'vs/workbench/services/remote/common/remoteAgentFileSystemChannel';
|
||||
import { ISignService } from 'vs/platform/sign/common/sign';
|
||||
import { FileUserDataProvider } from 'vs/workbench/services/userData/common/fileUserDataProvider';
|
||||
import { basename } from 'vs/base/common/path';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
|
||||
import { NativeHostService } from 'vs/platform/native/electron-sandbox/nativeHostService';
|
||||
import { SimpleConfigurationService, simpleFileSystemProvider, SimpleLogService, SimpleSignService, SimpleStorageService, SimpleNativeWorkbenchEnvironmentService, SimpleWorkspaceService } from 'vs/workbench/electron-sandbox/sandbox.simpleservices';
|
||||
import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
|
||||
import { RemoteAuthorityResolverService } from 'vs/platform/remote/electron-sandbox/remoteAuthorityResolverService';
|
||||
import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentity';
|
||||
import { UriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentityService';
|
||||
import { KeyboardLayoutService } from 'vs/workbench/services/keybinding/electron-sandbox/nativeKeyboardLayout';
|
||||
import { IKeyboardLayoutService } from 'vs/platform/keyboardLayout/common/keyboardLayout';
|
||||
import { ElectronIPCMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService';
|
||||
import { SimpleConfigurationService, simpleFileSystemProvider, SimpleSignService, SimpleNativeWorkbenchEnvironmentService, SimpleWorkspaceService, SimpleLogService } from 'vs/workbench/electron-sandbox/sandbox.simpleservices';
|
||||
import { LoggerChannelClient } from 'vs/platform/log/common/logIpc';
|
||||
|
||||
class DesktopMain extends Disposable {
|
||||
|
||||
@@ -64,7 +71,10 @@ class DesktopMain extends Disposable {
|
||||
private reviveUris() {
|
||||
|
||||
// Workspace
|
||||
this.configuration.workspace = reviveIdentifier(this.configuration.workspace);
|
||||
const workspace = reviveIdentifier(this.configuration.workspace);
|
||||
if (isWorkspaceIdentifier(workspace) || isSingleFolderWorkspaceIdentifier(workspace)) {
|
||||
this.configuration.workspace = workspace;
|
||||
}
|
||||
|
||||
// Files
|
||||
const filesToWait = this.configuration.filesToWait;
|
||||
@@ -106,14 +116,14 @@ class DesktopMain extends Disposable {
|
||||
services.logService.trace('workbench configuration', JSON.stringify(this.configuration));
|
||||
}
|
||||
|
||||
private registerListeners(workbench: Workbench, storageService: SimpleStorageService): void {
|
||||
private registerListeners(workbench: Workbench, storageService: NativeStorageService2): void {
|
||||
|
||||
// Workbench Lifecycle
|
||||
this._register(workbench.onShutdown(() => this.dispose()));
|
||||
this._register(workbench.onWillShutdown(event => event.join(storageService.close(), 'join.closeStorage')));
|
||||
this._register(workbench.onShutdown(() => this.dispose()));
|
||||
}
|
||||
|
||||
private async initServices(): Promise<{ serviceCollection: ServiceCollection, logService: ILogService, storageService: SimpleStorageService }> {
|
||||
private async initServices(): Promise<{ serviceCollection: ServiceCollection, logService: ILogService, storageService: NativeStorageService2 }> {
|
||||
const serviceCollection = new ServiceCollection();
|
||||
|
||||
|
||||
@@ -141,7 +151,11 @@ class DesktopMain extends Disposable {
|
||||
// Product
|
||||
serviceCollection.set(IProductService, this.productService);
|
||||
|
||||
// Log
|
||||
// Logger
|
||||
const loggerService = new LoggerChannelClient(mainProcessService.getChannel('logger'));
|
||||
serviceCollection.set(ILoggerService, loggerService);
|
||||
|
||||
// Log (we can only use the real logger, once `IEnvironmentService#logFile` has a proper file:// based value (https://github.com/microsoft/vscode/issues/116829))
|
||||
const logService = new SimpleLogService();
|
||||
serviceCollection.set(ILogService, logService);
|
||||
|
||||
@@ -208,6 +222,8 @@ class DesktopMain extends Disposable {
|
||||
fileService.registerProvider(Schemas.vscodeRemote, remoteFileSystemProvider);
|
||||
}
|
||||
|
||||
const payload = this.resolveWorkspaceInitializationPayload();
|
||||
|
||||
const services = await Promise.all([
|
||||
this.createWorkspaceService().then(service => {
|
||||
|
||||
@@ -220,11 +236,19 @@ class DesktopMain extends Disposable {
|
||||
return service;
|
||||
}),
|
||||
|
||||
this.createStorageService().then(service => {
|
||||
this.createStorageService(payload, mainProcessService).then(service => {
|
||||
|
||||
// Storage
|
||||
serviceCollection.set(IStorageService, service);
|
||||
|
||||
return service;
|
||||
}),
|
||||
|
||||
this.createKeyboardLayoutService(mainProcessService).then(service => {
|
||||
|
||||
// KeyboardLayout
|
||||
serviceCollection.set(IKeyboardLayoutService, service);
|
||||
|
||||
return service;
|
||||
})
|
||||
]);
|
||||
@@ -246,12 +270,56 @@ class DesktopMain extends Disposable {
|
||||
return { serviceCollection, logService, storageService: services[1] };
|
||||
}
|
||||
|
||||
private resolveWorkspaceInitializationPayload(): IWorkspaceInitializationPayload {
|
||||
let workspaceInitializationPayload: IWorkspaceInitializationPayload | undefined = this.configuration.workspace;
|
||||
|
||||
// Fallback to empty workspace if we have no payload yet.
|
||||
if (!workspaceInitializationPayload) {
|
||||
let id: string;
|
||||
if (this.configuration.backupPath) {
|
||||
id = basename(this.configuration.backupPath); // we know the backupPath must be a unique path so we leverage its name as workspace ID
|
||||
} else if (this.environmentService.isExtensionDevelopment) {
|
||||
id = 'ext-dev'; // extension development window never stores backups and is a singleton
|
||||
} else {
|
||||
throw new Error('Unexpected window configuration without backupPath');
|
||||
}
|
||||
|
||||
workspaceInitializationPayload = { id };
|
||||
}
|
||||
|
||||
return workspaceInitializationPayload;
|
||||
}
|
||||
|
||||
private async createWorkspaceService(): Promise<IWorkspaceContextService> {
|
||||
return new SimpleWorkspaceService();
|
||||
}
|
||||
|
||||
private async createStorageService(): Promise<SimpleStorageService> {
|
||||
return new SimpleStorageService();
|
||||
private async createStorageService(payload: IWorkspaceInitializationPayload, mainProcessService: IMainProcessService): Promise<NativeStorageService2> {
|
||||
const storageService = new NativeStorageService2(payload, mainProcessService, this.environmentService);
|
||||
|
||||
try {
|
||||
await storageService.initialize();
|
||||
|
||||
return storageService;
|
||||
} catch (error) {
|
||||
onUnexpectedError(error);
|
||||
|
||||
return storageService;
|
||||
}
|
||||
}
|
||||
|
||||
private async createKeyboardLayoutService(mainProcessService: IMainProcessService): Promise<KeyboardLayoutService> {
|
||||
const keyboardLayoutService = new KeyboardLayoutService(mainProcessService);
|
||||
|
||||
try {
|
||||
await keyboardLayoutService.initialize();
|
||||
|
||||
return keyboardLayoutService;
|
||||
} catch (error) {
|
||||
onUnexpectedError(error);
|
||||
|
||||
return keyboardLayoutService;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { localize } from 'vs/nls';
|
||||
import { fromNow } from 'vs/base/common/date';
|
||||
import { mnemonicButtonLabel } from 'vs/base/common/labels';
|
||||
import { isLinux, isLinuxSnap, isWindows } from 'vs/base/common/platform';
|
||||
@@ -58,13 +58,13 @@ export class NativeDialogHandler implements IDialogHandler {
|
||||
if (confirmation.primaryButton) {
|
||||
buttons.push(confirmation.primaryButton);
|
||||
} else {
|
||||
buttons.push(nls.localize({ key: 'yesButton', comment: ['&& denotes a mnemonic'] }, "&&Yes"));
|
||||
buttons.push(localize({ key: 'yesButton', comment: ['&& denotes a mnemonic'] }, "&&Yes"));
|
||||
}
|
||||
|
||||
if (confirmation.secondaryButton) {
|
||||
buttons.push(confirmation.secondaryButton);
|
||||
} else if (typeof confirmation.secondaryButton === 'undefined') {
|
||||
buttons.push(nls.localize('cancelButton', "Cancel"));
|
||||
buttons.push(localize('cancelButton', "Cancel"));
|
||||
}
|
||||
|
||||
const opts: MessageBoxOptions = {
|
||||
@@ -99,8 +99,8 @@ export class NativeDialogHandler implements IDialogHandler {
|
||||
type: (severity === Severity.Info) ? 'question' : (severity === Severity.Error) ? 'error' : (severity === Severity.Warning) ? 'warning' : 'none',
|
||||
cancelId: dialogOptions ? dialogOptions.cancelId : undefined,
|
||||
detail: dialogOptions ? dialogOptions.detail : undefined,
|
||||
checkboxLabel: dialogOptions && dialogOptions.checkbox ? dialogOptions.checkbox.label : undefined,
|
||||
checkboxChecked: dialogOptions && dialogOptions.checkbox ? dialogOptions.checkbox.checked : undefined
|
||||
checkboxLabel: dialogOptions?.checkbox?.label ?? undefined,
|
||||
checkboxChecked: dialogOptions?.checkbox?.checked ?? undefined
|
||||
});
|
||||
|
||||
const result = await this.nativeHostService.showMessageBox(options);
|
||||
@@ -166,7 +166,7 @@ export class NativeDialogHandler implements IDialogHandler {
|
||||
const osProps = await this.nativeHostService.getOSProperties();
|
||||
|
||||
const detailString = (useAgo: boolean): string => {
|
||||
return nls.localize({ key: 'aboutDetail', comment: ['Electron, Chrome, Node.js and V8 are product names that need no translation'] },
|
||||
return localize({ key: 'aboutDetail', comment: ['Electron, Chrome, Node.js and V8 are product names that need no translation'] },
|
||||
"Version: {0}\nCommit: {1}\nDate: {2}\nElectron: {3}\nChrome: {4}\nNode.js: {5}\nV8: {6}\nOS: {7}",
|
||||
version,
|
||||
this.productService.commit || 'Unknown',
|
||||
@@ -182,8 +182,8 @@ export class NativeDialogHandler implements IDialogHandler {
|
||||
const detail = detailString(true);
|
||||
const detailToCopy = detailString(false);
|
||||
|
||||
const ok = nls.localize('okButton', "OK");
|
||||
const copy = mnemonicButtonLabel(nls.localize({ key: 'copy', comment: ['&& denotes a mnemonic'] }, "&&Copy"));
|
||||
const ok = localize('okButton', "OK");
|
||||
const copy = mnemonicButtonLabel(localize({ key: 'copy', comment: ['&& denotes a mnemonic'] }, "&&Copy"));
|
||||
let buttons: string[];
|
||||
if (isLinux) {
|
||||
buttons = [copy, ok];
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { getZoomFactor } from 'vs/base/browser/browser';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { $, addDisposableListener, append, Dimension, EventType, hide, prepend, runAtThisOrScheduleAtNextAnimationFrame, show } from 'vs/base/browser/dom';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
@@ -64,7 +64,7 @@ export class TitlebarPart extends BrowserTitleBarPart {
|
||||
super(contextMenuService, configurationService, editorService, environmentService, contextService, instantiationService, themeService, labelService, storageService, layoutService, menuService, contextKeyService, hostService, productService);
|
||||
}
|
||||
|
||||
private onUpdateAppIconDragBehavior() {
|
||||
private onUpdateAppIconDragBehavior(): void {
|
||||
const setting = this.configurationService.getValue('window.doubleClickIconToClose');
|
||||
if (setting && this.appIcon) {
|
||||
(this.appIcon.style as any)['-webkit-app-region'] = 'no-drag';
|
||||
@@ -73,7 +73,7 @@ export class TitlebarPart extends BrowserTitleBarPart {
|
||||
}
|
||||
}
|
||||
|
||||
private onDidChangeMaximized(maximized: boolean) {
|
||||
private onDidChangeWindowMaximized(maximized: boolean): void {
|
||||
if (this.maxRestoreControl) {
|
||||
if (maximized) {
|
||||
this.maxRestoreControl.classList.remove(...Codicon.chromeMaximize.classNamesArray);
|
||||
@@ -86,32 +86,32 @@ export class TitlebarPart extends BrowserTitleBarPart {
|
||||
|
||||
if (this.resizer) {
|
||||
if (maximized) {
|
||||
DOM.hide(this.resizer);
|
||||
hide(this.resizer);
|
||||
} else {
|
||||
DOM.show(this.resizer);
|
||||
show(this.resizer);
|
||||
}
|
||||
}
|
||||
|
||||
this.adjustTitleMarginToCenter();
|
||||
}
|
||||
|
||||
private onMenubarFocusChanged(focused: boolean) {
|
||||
private onMenubarFocusChanged(focused: boolean): void {
|
||||
if ((isWindows || isLinux) && this.currentMenubarVisibility !== 'compact' && this.dragRegion) {
|
||||
if (focused) {
|
||||
DOM.hide(this.dragRegion);
|
||||
hide(this.dragRegion);
|
||||
} else {
|
||||
DOM.show(this.dragRegion);
|
||||
show(this.dragRegion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected onMenubarVisibilityChanged(visible: boolean) {
|
||||
protected onMenubarVisibilityChanged(visible: boolean): void {
|
||||
// Hide title when toggling menu bar
|
||||
if ((isWindows || isLinux) && this.currentMenubarVisibility === 'toggle' && visible) {
|
||||
// Hack to fix issue #52522 with layered webkit-app-region elements appearing under cursor
|
||||
if (this.dragRegion) {
|
||||
DOM.hide(this.dragRegion);
|
||||
setTimeout(() => DOM.show(this.dragRegion!), 50);
|
||||
hide(this.dragRegion);
|
||||
setTimeout(() => show(this.dragRegion!), 50);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,27 +173,27 @@ export class TitlebarPart extends BrowserTitleBarPart {
|
||||
if (this.appIcon) {
|
||||
this.onUpdateAppIconDragBehavior();
|
||||
|
||||
this._register(DOM.addDisposableListener(this.appIcon, DOM.EventType.DBLCLICK, (e => {
|
||||
this._register(addDisposableListener(this.appIcon, EventType.DBLCLICK, (e => {
|
||||
this.nativeHostService.closeWindow();
|
||||
})));
|
||||
}
|
||||
|
||||
// Draggable region that we can manipulate for #52522
|
||||
this.dragRegion = DOM.prepend(this.element, DOM.$('div.titlebar-drag-region'));
|
||||
this.dragRegion = prepend(this.element, $('div.titlebar-drag-region'));
|
||||
|
||||
// Window Controls (Native Windows/Linux)
|
||||
if (!isMacintosh) {
|
||||
this.windowControls = DOM.append(this.element, DOM.$('div.window-controls-container'));
|
||||
this.windowControls = append(this.element, $('div.window-controls-container'));
|
||||
|
||||
// Minimize
|
||||
const minimizeIcon = DOM.append(this.windowControls, DOM.$('div.window-icon.window-minimize' + Codicon.chromeMinimize.cssSelector));
|
||||
this._register(DOM.addDisposableListener(minimizeIcon, DOM.EventType.CLICK, e => {
|
||||
const minimizeIcon = append(this.windowControls, $('div.window-icon.window-minimize' + Codicon.chromeMinimize.cssSelector));
|
||||
this._register(addDisposableListener(minimizeIcon, EventType.CLICK, e => {
|
||||
this.nativeHostService.minimizeWindow();
|
||||
}));
|
||||
|
||||
// Restore
|
||||
this.maxRestoreControl = DOM.append(this.windowControls, DOM.$('div.window-icon.window-max-restore'));
|
||||
this._register(DOM.addDisposableListener(this.maxRestoreControl, DOM.EventType.CLICK, async e => {
|
||||
this.maxRestoreControl = append(this.windowControls, $('div.window-icon.window-max-restore'));
|
||||
this._register(addDisposableListener(this.maxRestoreControl, EventType.CLICK, async e => {
|
||||
const maximized = await this.nativeHostService.isMaximized();
|
||||
if (maximized) {
|
||||
return this.nativeHostService.unmaximizeWindow();
|
||||
@@ -203,22 +203,22 @@ export class TitlebarPart extends BrowserTitleBarPart {
|
||||
}));
|
||||
|
||||
// Close
|
||||
const closeIcon = DOM.append(this.windowControls, DOM.$('div.window-icon.window-close' + Codicon.chromeClose.cssSelector));
|
||||
this._register(DOM.addDisposableListener(closeIcon, DOM.EventType.CLICK, e => {
|
||||
const closeIcon = append(this.windowControls, $('div.window-icon.window-close' + Codicon.chromeClose.cssSelector));
|
||||
this._register(addDisposableListener(closeIcon, EventType.CLICK, e => {
|
||||
this.nativeHostService.closeWindow();
|
||||
}));
|
||||
|
||||
// Resizer
|
||||
this.resizer = DOM.append(this.element, DOM.$('div.resizer'));
|
||||
this.resizer = append(this.element, $('div.resizer'));
|
||||
|
||||
this._register(this.layoutService.onMaximizeChange(maximized => this.onDidChangeMaximized(maximized)));
|
||||
this.onDidChangeMaximized(this.layoutService.isWindowMaximized());
|
||||
this._register(this.layoutService.onDidChangeWindowMaximized(maximized => this.onDidChangeWindowMaximized(maximized)));
|
||||
this.onDidChangeWindowMaximized(this.layoutService.isWindowMaximized());
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
updateLayout(dimension: DOM.Dimension): void {
|
||||
updateLayout(dimension: Dimension): void {
|
||||
this.lastLayoutDimensions = dimension;
|
||||
|
||||
if (getTitleBarStyle(this.configurationService) === 'custom') {
|
||||
@@ -247,10 +247,10 @@ export class TitlebarPart extends BrowserTitleBarPart {
|
||||
}
|
||||
}
|
||||
|
||||
DOM.runAtThisOrScheduleAtNextAnimationFrame(() => this.adjustTitleMarginToCenter());
|
||||
runAtThisOrScheduleAtNextAnimationFrame(() => this.adjustTitleMarginToCenter());
|
||||
|
||||
if (this.customMenubar) {
|
||||
const menubarDimension = new DOM.Dimension(0, dimension.height);
|
||||
const menubarDimension = new Dimension(0, dimension.height);
|
||||
this.customMenubar.layout(menubarDimension);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
/* eslint-disable code-no-standalone-editor */
|
||||
/* eslint-disable code-import-patterns */
|
||||
|
||||
import { ConsoleLogService } from 'vs/platform/log/common/log';
|
||||
import { ISignService } from 'vs/platform/sign/common/sign';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { InMemoryFileSystemProvider } from 'vs/platform/files/common/inMemoryFilesystemProvider';
|
||||
@@ -15,7 +14,6 @@ import { IAddressProvider } from 'vs/platform/remote/common/remoteAgentConnectio
|
||||
import { ITelemetryData, ITelemetryInfo, ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IExtension } from 'vs/platform/extensions/common/extensions';
|
||||
import { SimpleConfigurationService as BaseSimpleConfigurationService } from 'vs/editor/standalone/browser/simpleServices';
|
||||
import { InMemoryStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IBackupFileService, IResolvedBackup } from 'vs/workbench/services/backup/common/backup';
|
||||
import { ITextSnapshot } from 'vs/editor/common/model';
|
||||
@@ -53,6 +51,7 @@ import { BrowserKeyboardLayoutService } from 'vs/workbench/services/keybinding/b
|
||||
import { TerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminalInstanceService';
|
||||
import { ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
import { IWorkbenchConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
|
||||
import { ConsoleLogger, LogService } from 'vs/platform/log/common/log';
|
||||
|
||||
|
||||
//#region Environment
|
||||
@@ -116,8 +115,6 @@ export class SimpleNativeWorkbenchEnvironmentService implements INativeWorkbench
|
||||
|
||||
installSourcePath: string = undefined!;
|
||||
|
||||
sharedIPCHandle: string = undefined!;
|
||||
|
||||
extensionsPath: string = undefined!;
|
||||
extensionsDownloadPath: string = undefined!;
|
||||
builtinExtensionsPath: string = undefined!;
|
||||
@@ -181,13 +178,6 @@ export class SimpleWorkspaceService implements IWorkspaceContextService {
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region Configuration
|
||||
|
||||
export class SimpleStorageService extends InMemoryStorageService { }
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region Configuration
|
||||
|
||||
export class SimpleConfigurationService extends BaseSimpleConfigurationService implements IWorkbenchConfigurationService {
|
||||
@@ -197,9 +187,7 @@ export class SimpleConfigurationService extends BaseSimpleConfigurationService i
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region Logger
|
||||
|
||||
export class SimpleLogService extends ConsoleLogService { }
|
||||
//#region Signing
|
||||
|
||||
export class SimpleSignService implements ISignService {
|
||||
|
||||
@@ -210,6 +198,16 @@ export class SimpleSignService implements ISignService {
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Logger
|
||||
|
||||
export class SimpleLogService extends LogService {
|
||||
|
||||
constructor() {
|
||||
super(new ConsoleLogger());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//#region Files
|
||||
|
||||
@@ -463,7 +461,8 @@ class SimpleTelemetryService implements ITelemetryService {
|
||||
return {
|
||||
instanceId: 'someValue.instanceId',
|
||||
sessionId: 'someValue.sessionId',
|
||||
machineId: 'someValue.machineId'
|
||||
machineId: 'someValue.machineId',
|
||||
firstSessionDate: 'someValue.firstSessionDate'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ export class NativeWindow extends Disposable {
|
||||
private readonly addFoldersScheduler = this._register(new RunOnceScheduler(() => this.doAddFolders(), 100));
|
||||
private pendingFoldersToAdd: URI[] = [];
|
||||
|
||||
private readonly closeEmptyWindowScheduler = this._register(new RunOnceScheduler(() => this.onAllEditorsClosed(), 50));
|
||||
private readonly closeEmptyWindowScheduler = this._register(new RunOnceScheduler(() => this.onDidAllEditorsClose(), 50));
|
||||
|
||||
private isDocumentedEdited = false;
|
||||
|
||||
@@ -274,7 +274,7 @@ export class NativeWindow extends Disposable {
|
||||
}));
|
||||
|
||||
// Listen to visible editor changes
|
||||
this._register(this.editorService.onDidVisibleEditorsChange(() => this.onDidVisibleEditorsChange()));
|
||||
this._register(this.editorService.onDidVisibleEditorsChange(() => this.onDidChangeVisibleEditors()));
|
||||
|
||||
// Listen to editor closing (if we run with --wait)
|
||||
const filesToWait = this.environmentService.configuration.filesToWait;
|
||||
@@ -322,19 +322,19 @@ export class NativeWindow extends Disposable {
|
||||
this._register(Event.any(
|
||||
Event.map(Event.filter(this.nativeHostService.onDidMaximizeWindow, id => id === this.nativeHostService.windowId), () => true),
|
||||
Event.map(Event.filter(this.nativeHostService.onDidUnmaximizeWindow, id => id === this.nativeHostService.windowId), () => false)
|
||||
)(e => this.onDidChangeMaximized(e)));
|
||||
)(e => this.onDidChangeWindowMaximized(e)));
|
||||
|
||||
this.onDidChangeMaximized(this.environmentService.configuration.maximized ?? false);
|
||||
this.onDidChangeWindowMaximized(this.environmentService.configuration.maximized ?? false);
|
||||
|
||||
// Detect panel position to determine minimum width
|
||||
this._register(this.layoutService.onPanelPositionChange(pos => this.onDidPanelPositionChange(positionFromString(pos))));
|
||||
this.onDidPanelPositionChange(this.layoutService.getPanelPosition());
|
||||
this._register(this.layoutService.onDidChangePanelPosition(pos => this.onDidChangePanelPosition(positionFromString(pos))));
|
||||
this.onDidChangePanelPosition(this.layoutService.getPanelPosition());
|
||||
}
|
||||
|
||||
private onWindowResize(e: UIEvent, retry: boolean): void {
|
||||
if (e.target === window) {
|
||||
if (window.document && window.document.body && window.document.body.clientWidth === 0) {
|
||||
// TODO@bpasero this is an electron issue on macOS when simple fullscreen is enabled
|
||||
// TODO@electron this is an electron issue on macOS when simple fullscreen is enabled
|
||||
// where for some reason the window clientWidth is reported as 0 when switching
|
||||
// between simple fullscreen and normal screen. In that case we schedule the layout
|
||||
// call at the next animation frame once, in the hope that the dimensions are
|
||||
@@ -357,7 +357,7 @@ export class NativeWindow extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private onDidChangeMaximized(maximized: boolean): void {
|
||||
private onDidChangeWindowMaximized(maximized: boolean): void {
|
||||
this.layoutService.updateWindowMaximizedState(maximized);
|
||||
}
|
||||
|
||||
@@ -372,13 +372,13 @@ export class NativeWindow extends Disposable {
|
||||
return WindowMinimumSize.WIDTH;
|
||||
}
|
||||
|
||||
private onDidPanelPositionChange(pos: Position): void {
|
||||
private onDidChangePanelPosition(pos: Position): void {
|
||||
const minWidth = this.getWindowMinimumWidth(pos);
|
||||
|
||||
this.nativeHostService.setMinimumSize(minWidth, undefined);
|
||||
}
|
||||
|
||||
private onDidVisibleEditorsChange(): void {
|
||||
private onDidChangeVisibleEditors(): void {
|
||||
|
||||
// Close when empty: check if we should close the window based on the setting
|
||||
// Overruled by: window has a workspace opened or this window is for extension development
|
||||
@@ -392,7 +392,7 @@ export class NativeWindow extends Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private onAllEditorsClosed(): void {
|
||||
private onDidAllEditorsClose(): void {
|
||||
const visibleEditorPanes = this.editorService.visibleEditorPanes.length;
|
||||
if (visibleEditorPanes === 0) {
|
||||
this.nativeHostService.closeWindow();
|
||||
|
||||
Reference in New Issue
Block a user