mirror of
https://github.com/coder/code-server.git
synced 2026-05-09 05:47:26 +02:00
Update to VS Code 1.52.1
This commit is contained in:
@@ -42,6 +42,9 @@ export class ConfigureRuntimeArgumentsAction extends Action {
|
||||
}
|
||||
|
||||
async run(): Promise<void> {
|
||||
await this.editorService.openEditor({ resource: this.environmentService.argvResource });
|
||||
await this.editorService.openEditor({
|
||||
resource: this.environmentService.argvResource,
|
||||
options: { pinned: true }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,16 +211,17 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
},
|
||||
'window.restoreWindows': {
|
||||
'type': 'string',
|
||||
'enum': ['all', 'folders', 'one', 'none'],
|
||||
'enum': ['preserve', 'all', 'folders', 'one', 'none'],
|
||||
'enumDescriptions': [
|
||||
nls.localize('window.reopenFolders.all', "Reopen all windows."),
|
||||
nls.localize('window.reopenFolders.folders', "Reopen all folders. Empty workspaces will not be restored."),
|
||||
nls.localize('window.reopenFolders.one', "Reopen the last active window."),
|
||||
nls.localize('window.reopenFolders.none', "Never reopen a window. Always start with an empty one.")
|
||||
nls.localize('window.reopenFolders.preserve', "Always reopen all windows. If a folder or workspace is opened (e.g. from the command line) it opens as a new window unless it was opened before. If files are opened they will open in one of the restored windows."),
|
||||
nls.localize('window.reopenFolders.all', "Reopen all windows unless a folder, workspace or file is opened (e.g. from the command line)."),
|
||||
nls.localize('window.reopenFolders.folders', "Reopen all windows that had folders or workspaces opened unless a folder, workspace or file is opened (e.g. from the command line)."),
|
||||
nls.localize('window.reopenFolders.one', "Reopen the last active window unless a folder, workspace or file is opened (e.g. from the command line)."),
|
||||
nls.localize('window.reopenFolders.none', "Never reopen a window. Unless a folder or workspace is opened (e.g. from the command line), an empty window will appear.")
|
||||
],
|
||||
'default': 'all',
|
||||
'scope': ConfigurationScope.APPLICATION,
|
||||
'description': nls.localize('restoreWindows', "Controls how windows are being reopened after a restart.")
|
||||
'description': nls.localize('restoreWindows', "Controls how windows are being reopened after starting for the first time. This setting has no effect when the application is already running.")
|
||||
},
|
||||
'window.restoreFullscreen': {
|
||||
'type': 'boolean',
|
||||
@@ -295,7 +296,7 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
||||
},
|
||||
'window.enableExperimentalProxyLoginDialog': {
|
||||
'type': 'boolean',
|
||||
'default': false,
|
||||
'default': true,
|
||||
'scope': ConfigurationScope.APPLICATION,
|
||||
'description': nls.localize('window.enableExperimentalProxyLoginDialog', "Enables a new login dialog for proxy authentication. Requires a restart to take effect."),
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ import { NativeHostService } from 'vs/platform/native/electron-sandbox/nativeHos
|
||||
import { SimpleConfigurationService, simpleFileSystemProvider, SimpleLogService, SimpleRemoteAgentService, 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';
|
||||
|
||||
class DesktopMain extends Disposable {
|
||||
|
||||
@@ -205,7 +207,11 @@ class DesktopMain extends Disposable {
|
||||
fileService.registerProvider(Schemas.file, simpleFileSystemProvider);
|
||||
|
||||
// User Data Provider
|
||||
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(URI.file('user-home'), undefined, simpleFileSystemProvider, this.environmentService, logService));
|
||||
fileService.registerProvider(Schemas.userData, new FileUserDataProvider(Schemas.file, simpleFileSystemProvider, Schemas.userData, logService));
|
||||
|
||||
// Uri Identity
|
||||
const uriIdentityService = new UriIdentityService(fileService);
|
||||
serviceCollection.set(IUriIdentityService, uriIdentityService);
|
||||
|
||||
const connection = remoteAgentService.getConnection();
|
||||
if (connection) {
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IDialogHandler, IDialogResult, IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { IDialogsModel, IDialogViewItem } from 'vs/workbench/common/dialogs';
|
||||
import { BrowserDialogHandler } from 'vs/workbench/browser/parts/dialogs/dialogHandler';
|
||||
import { NativeDialogHandler } from 'vs/workbench/electron-sandbox/parts/dialogs/dialogHandler';
|
||||
import { DialogService } from 'vs/workbench/services/dialogs/common/dialogService';
|
||||
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export class DialogHandlerContribution extends Disposable implements IWorkbenchContribution {
|
||||
private nativeImpl: IDialogHandler;
|
||||
private browserImpl: IDialogHandler;
|
||||
|
||||
private model: IDialogsModel;
|
||||
private currentDialog: IDialogViewItem | undefined;
|
||||
|
||||
constructor(
|
||||
@IConfigurationService private configurationService: IConfigurationService,
|
||||
@IDialogService private dialogService: IDialogService,
|
||||
@ILogService logService: ILogService,
|
||||
@ILayoutService layoutService: ILayoutService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IKeybindingService keybindingService: IKeybindingService,
|
||||
@IProductService productService: IProductService,
|
||||
@IClipboardService clipboardService: IClipboardService,
|
||||
@INativeHostService nativeHostService: INativeHostService
|
||||
) {
|
||||
super();
|
||||
|
||||
this.browserImpl = new BrowserDialogHandler(logService, layoutService, themeService, keybindingService, productService, clipboardService);
|
||||
this.nativeImpl = new NativeDialogHandler(logService, nativeHostService, productService, clipboardService);
|
||||
|
||||
this.model = (this.dialogService as DialogService).model;
|
||||
|
||||
this._register(this.model.onDidShowDialog(() => {
|
||||
if (!this.currentDialog) {
|
||||
this.processDialogs();
|
||||
}
|
||||
}));
|
||||
|
||||
this.processDialogs();
|
||||
}
|
||||
|
||||
private async processDialogs(): Promise<void> {
|
||||
while (this.model.dialogs.length) {
|
||||
this.currentDialog = this.model.dialogs[0];
|
||||
|
||||
let result: IDialogResult | undefined = undefined;
|
||||
|
||||
// Confirm
|
||||
if (this.currentDialog.args.confirmArgs) {
|
||||
const args = this.currentDialog.args.confirmArgs;
|
||||
result = this.useCustomDialog ? await this.browserImpl.confirm(args.confirmation) : await this.nativeImpl.confirm(args.confirmation);
|
||||
}
|
||||
|
||||
// Input (custom only)
|
||||
else if (this.currentDialog.args.inputArgs) {
|
||||
const args = this.currentDialog.args.inputArgs;
|
||||
result = await this.browserImpl.input(args.severity, args.message, args.buttons, args.inputs, args.options);
|
||||
}
|
||||
|
||||
// Message
|
||||
else if (this.currentDialog.args.showArgs) {
|
||||
const args = this.currentDialog.args.showArgs;
|
||||
result = this.useCustomDialog ?
|
||||
await this.browserImpl.show(args.severity, args.message, args.buttons, args.options) :
|
||||
await this.nativeImpl.show(args.severity, args.message, args.buttons, args.options);
|
||||
}
|
||||
|
||||
// About
|
||||
else {
|
||||
await this.nativeImpl.about();
|
||||
}
|
||||
|
||||
this.currentDialog.close(result);
|
||||
this.currentDialog = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
private get useCustomDialog(): boolean {
|
||||
return this.configurationService.getValue('window.dialogStyle') === 'custom';
|
||||
}
|
||||
}
|
||||
|
||||
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
||||
workbenchRegistry.registerWorkbenchContribution(DialogHandlerContribution, LifecyclePhase.Starting);
|
||||
@@ -0,0 +1,209 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import { fromNow } from 'vs/base/common/date';
|
||||
import { mnemonicButtonLabel } from 'vs/base/common/labels';
|
||||
import { isLinux, isWindows } from 'vs/base/common/platform';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { MessageBoxOptions } from 'vs/base/parts/sandbox/common/electronTypes';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { IConfirmation, IConfirmationResult, IDialogHandler, IDialogOptions, IShowResult } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { INativeHostService } from 'vs/platform/native/electron-sandbox/native';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { process } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
|
||||
interface IMassagedMessageBoxOptions {
|
||||
|
||||
/**
|
||||
* OS massaged message box options.
|
||||
*/
|
||||
options: MessageBoxOptions;
|
||||
|
||||
/**
|
||||
* Since the massaged result of the message box options potentially
|
||||
* changes the order of buttons, we have to keep a map of these
|
||||
* changes so that we can still return the correct index to the caller.
|
||||
*/
|
||||
buttonIndexMap: number[];
|
||||
}
|
||||
|
||||
export class NativeDialogHandler implements IDialogHandler {
|
||||
|
||||
constructor(
|
||||
@ILogService private readonly logService: ILogService,
|
||||
@INativeHostService private readonly nativeHostService: INativeHostService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@IClipboardService private readonly clipboardService: IClipboardService
|
||||
) {
|
||||
}
|
||||
|
||||
async confirm(confirmation: IConfirmation): Promise<IConfirmationResult> {
|
||||
this.logService.trace('DialogService#confirm', confirmation.message);
|
||||
|
||||
const { options, buttonIndexMap } = this.massageMessageBoxOptions(this.getConfirmOptions(confirmation));
|
||||
|
||||
const result = await this.nativeHostService.showMessageBox(options);
|
||||
return {
|
||||
confirmed: buttonIndexMap[result.response] === 0 ? true : false,
|
||||
checkboxChecked: result.checkboxChecked
|
||||
};
|
||||
}
|
||||
|
||||
private getConfirmOptions(confirmation: IConfirmation): MessageBoxOptions {
|
||||
const buttons: string[] = [];
|
||||
if (confirmation.primaryButton) {
|
||||
buttons.push(confirmation.primaryButton);
|
||||
} else {
|
||||
buttons.push(nls.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"));
|
||||
}
|
||||
|
||||
const opts: MessageBoxOptions = {
|
||||
title: confirmation.title,
|
||||
message: confirmation.message,
|
||||
buttons,
|
||||
cancelId: 1
|
||||
};
|
||||
|
||||
if (confirmation.detail) {
|
||||
opts.detail = confirmation.detail;
|
||||
}
|
||||
|
||||
if (confirmation.type) {
|
||||
opts.type = confirmation.type;
|
||||
}
|
||||
|
||||
if (confirmation.checkbox) {
|
||||
opts.checkboxLabel = confirmation.checkbox.label;
|
||||
opts.checkboxChecked = confirmation.checkbox.checked;
|
||||
}
|
||||
|
||||
return opts;
|
||||
}
|
||||
|
||||
async show(severity: Severity, message: string, buttons: string[], dialogOptions?: IDialogOptions): Promise<IShowResult> {
|
||||
this.logService.trace('DialogService#show', message);
|
||||
|
||||
const { options, buttonIndexMap } = this.massageMessageBoxOptions({
|
||||
message,
|
||||
buttons,
|
||||
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
|
||||
});
|
||||
|
||||
const result = await this.nativeHostService.showMessageBox(options);
|
||||
return { choice: buttonIndexMap[result.response], checkboxChecked: result.checkboxChecked };
|
||||
}
|
||||
|
||||
private massageMessageBoxOptions(options: MessageBoxOptions): IMassagedMessageBoxOptions {
|
||||
let buttonIndexMap = (options.buttons || []).map((button, index) => index);
|
||||
let buttons = (options.buttons || []).map(button => mnemonicButtonLabel(button));
|
||||
let cancelId = options.cancelId;
|
||||
|
||||
// Linux: order of buttons is reverse
|
||||
// macOS: also reverse, but the OS handles this for us!
|
||||
if (isLinux) {
|
||||
buttons = buttons.reverse();
|
||||
buttonIndexMap = buttonIndexMap.reverse();
|
||||
}
|
||||
|
||||
// Default Button (always first one)
|
||||
options.defaultId = buttonIndexMap[0];
|
||||
|
||||
// Cancel Button
|
||||
if (typeof cancelId === 'number') {
|
||||
|
||||
// Ensure the cancelId is the correct one from our mapping
|
||||
cancelId = buttonIndexMap[cancelId];
|
||||
|
||||
// macOS/Linux: the cancel button should always be to the left of the primary action
|
||||
// if we see more than 2 buttons, move the cancel one to the left of the primary
|
||||
if (!isWindows && buttons.length > 2 && cancelId !== 1) {
|
||||
const cancelButton = buttons[cancelId];
|
||||
buttons.splice(cancelId, 1);
|
||||
buttons.splice(1, 0, cancelButton);
|
||||
|
||||
const cancelButtonIndex = buttonIndexMap[cancelId];
|
||||
buttonIndexMap.splice(cancelId, 1);
|
||||
buttonIndexMap.splice(1, 0, cancelButtonIndex);
|
||||
|
||||
cancelId = 1;
|
||||
}
|
||||
}
|
||||
|
||||
options.buttons = buttons;
|
||||
options.cancelId = cancelId;
|
||||
options.noLink = true;
|
||||
options.title = options.title || this.productService.nameLong;
|
||||
|
||||
return { options, buttonIndexMap };
|
||||
}
|
||||
|
||||
input(): never {
|
||||
throw new Error('Unsupported'); // we have no native API for password dialogs in Electron
|
||||
}
|
||||
|
||||
async about(): Promise<void> {
|
||||
let version = this.productService.version;
|
||||
if (this.productService.target) {
|
||||
version = `${version} (${this.productService.target} setup)`;
|
||||
}
|
||||
|
||||
const isSnap = process.platform === 'linux' && process.env.SNAP && process.env.SNAP_REVISION;
|
||||
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'] },
|
||||
"Version: {0}\nCommit: {1}\nDate: {2}\nElectron: {3}\nChrome: {4}\nNode.js: {5}\nV8: {6}\nOS: {7}",
|
||||
version,
|
||||
this.productService.commit || 'Unknown',
|
||||
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown',
|
||||
process.versions['electron'],
|
||||
process.versions['chrome'],
|
||||
process.versions['node'],
|
||||
process.versions['v8'],
|
||||
`${osProps.type} ${osProps.arch} ${osProps.release}${isSnap ? ' snap' : ''}`
|
||||
);
|
||||
};
|
||||
|
||||
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"));
|
||||
let buttons: string[];
|
||||
if (isLinux) {
|
||||
buttons = [copy, ok];
|
||||
} else {
|
||||
buttons = [ok, copy];
|
||||
}
|
||||
|
||||
const result = await this.nativeHostService.showMessageBox({
|
||||
title: this.productService.nameLong,
|
||||
type: 'info',
|
||||
message: this.productService.nameLong,
|
||||
detail: `\n${detail}`,
|
||||
buttons,
|
||||
noLink: true,
|
||||
defaultId: buttons.indexOf(ok),
|
||||
cancelId: buttons.indexOf(ok)
|
||||
});
|
||||
|
||||
if (buttons[result.response] === copy) {
|
||||
this.clipboardService.writeText(detailToCopy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ 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';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { isMacintosh, isWindows, isLinux } from 'vs/base/common/platform';
|
||||
import { IMenuService } from 'vs/platform/actions/common/actions';
|
||||
@@ -32,11 +32,23 @@ export class TitlebarPart extends BrowserTitleBarPart {
|
||||
private dragRegion: HTMLElement | undefined;
|
||||
private resizer: HTMLElement | undefined;
|
||||
|
||||
private getMacTitlebarSize() {
|
||||
const osVersion = this.environmentService.os.release;
|
||||
if (parseFloat(osVersion) >= 20) { // Big Sur increases title bar height
|
||||
return 28;
|
||||
}
|
||||
|
||||
return 22;
|
||||
}
|
||||
|
||||
get minimumHeight(): number { return isMacintosh ? this.getMacTitlebarSize() / getZoomFactor() : super.minimumHeight; }
|
||||
get maximumHeight(): number { return this.minimumHeight; }
|
||||
|
||||
constructor(
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@IConfigurationService protected readonly configurationService: IConfigurationService,
|
||||
@IEditorService editorService: IEditorService,
|
||||
@IWorkbenchEnvironmentService protected readonly environmentService: IWorkbenchEnvironmentService,
|
||||
@INativeWorkbenchEnvironmentService protected readonly environmentService: INativeWorkbenchEnvironmentService,
|
||||
@IWorkspaceContextService contextService: IWorkspaceContextService,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@@ -206,7 +218,7 @@ export class TitlebarPart extends BrowserTitleBarPart {
|
||||
updateLayout(dimension: DOM.Dimension): void {
|
||||
this.lastLayoutDimensions = dimension;
|
||||
|
||||
if (getTitleBarStyle(this.configurationService, this.environmentService) === 'custom') {
|
||||
if (getTitleBarStyle(this.configurationService) === 'custom') {
|
||||
// Only prevent zooming behavior on macOS or when the menubar is not visible
|
||||
if (isMacintosh || this.currentMenubarVisibility === 'hidden') {
|
||||
this.title.style.zoom = `${1 / getZoomFactor()}`;
|
||||
|
||||
@@ -25,14 +25,8 @@ import { IBackupFileService, IResolvedBackup } from 'vs/workbench/services/backu
|
||||
import { ITextSnapshot } from 'vs/editor/common/model';
|
||||
import { IExtensionService, NullExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ClassifiedEvent, GDPRClassification, StrictPropertyChecker } from 'vs/platform/telemetry/common/gdprTypings';
|
||||
import { IKeyboardLayoutInfo, IKeymapService, ILinuxKeyboardLayoutInfo, ILinuxKeyboardMapping, IMacKeyboardLayoutInfo, IMacKeyboardMapping, IWindowsKeyboardLayoutInfo, IWindowsKeyboardMapping } from 'vs/workbench/services/keybinding/common/keymapInfo';
|
||||
import { IKeyboardEvent } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { DispatchConfig } from 'vs/workbench/services/keybinding/common/dispatchConfig';
|
||||
import { IKeyboardMapper } from 'vs/workbench/services/keybinding/common/keyboardMapper';
|
||||
import { ChordKeybinding, ResolvedKeybinding, SimpleKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { ScanCodeBinding } from 'vs/base/common/scanCode';
|
||||
import { USLayoutResolvedKeybinding } from 'vs/platform/keybinding/common/usLayoutResolvedKeybinding';
|
||||
import { isWindows, OS } from 'vs/base/common/platform';
|
||||
import { IKeyboardLayoutService } from 'vs/platform/keyboardLayout/common/keyboardLayout';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { IWebviewService, WebviewContentOptions, WebviewElement, WebviewExtensionDescription, WebviewIcons, WebviewOptions, WebviewOverlay } from 'vs/workbench/contrib/webview/browser/webview';
|
||||
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { AbstractTextFileService } from 'vs/workbench/services/textfile/browser/textFileService';
|
||||
@@ -50,7 +44,7 @@ import { CustomTask, ContributedTask, InMemoryTask, TaskRunSource, ConfiguringTa
|
||||
import { TaskSystemInfo } from 'vs/workbench/contrib/tasks/common/taskSystem';
|
||||
import { IExtensionTipsService, IConfigBasedExtensionTip, IExecutableBasedExtensionTip, IWorkspaceTips } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { IWorkspaceTagsService, Tags } from 'vs/workbench/contrib/tags/common/workspaceTags';
|
||||
import { AsbtractOutputChannelModelService, IOutputChannelModelService } from 'vs/workbench/services/output/common/outputChannelModel';
|
||||
import { AbstractOutputChannelModelService, IOutputChannelModelService } from 'vs/workbench/contrib/output/common/outputChannelModel';
|
||||
import { joinPath } from 'vs/base/common/resources';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { IIntegrityService, IntegrityTestResult } from 'vs/workbench/services/integrity/common/integrity';
|
||||
@@ -59,7 +53,9 @@ import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
import { IExtensionHostDebugParams } from 'vs/platform/environment/common/environment';
|
||||
import type { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common/storageKeys';
|
||||
import { BrowserKeyboardLayoutService } from 'vs/workbench/services/keybinding/browser/keyboardLayoutService';
|
||||
import { TerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminalInstanceService';
|
||||
import { ITerminalInstanceService } from 'vs/workbench/contrib/terminal/browser/terminal';
|
||||
|
||||
|
||||
//#region Environment
|
||||
@@ -87,12 +83,10 @@ export class SimpleNativeWorkbenchEnvironmentService implements INativeWorkbench
|
||||
get tmpDir(): URI { return joinPath(this.userRoamingDataHome, 'tmp'); }
|
||||
get logsPath(): string { return joinPath(this.userRoamingDataHome, 'logs').path; }
|
||||
|
||||
get backupWorkspaceHome(): URI { return joinPath(this.userRoamingDataHome, 'Backups', 'workspace'); }
|
||||
updateBackupPath(newPath: string | undefined): void { }
|
||||
|
||||
sessionId = this.configuration.sessionId;
|
||||
machineId = this.configuration.machineId;
|
||||
remoteAuthority = this.configuration.remoteAuthority;
|
||||
os = { release: 'unknown' };
|
||||
|
||||
options?: IWorkbenchConstructionOptions | undefined;
|
||||
logExtensionHostCommunication?: boolean | undefined;
|
||||
@@ -127,7 +121,7 @@ export class SimpleNativeWorkbenchEnvironmentService implements INativeWorkbench
|
||||
|
||||
sharedIPCHandle: string = undefined!;
|
||||
|
||||
extensionsPath?: string | undefined;
|
||||
extensionsPath: string = undefined!;
|
||||
extensionsDownloadPath: string = undefined!;
|
||||
builtinExtensionsPath: string = undefined!;
|
||||
extraExtensionPaths: string[] = undefined!;
|
||||
@@ -435,6 +429,7 @@ export class SimpleRemoteAgentService implements IRemoteAgentService {
|
||||
async getRawEnvironment(): Promise<IRemoteAgentEnvironment | null> { return null; }
|
||||
async scanExtensions(skipExtensions?: ExtensionIdentifier[]): Promise<IExtensionDescription[]> { return []; }
|
||||
async scanSingleExtension(extensionLocation: URI, isBuiltin: boolean): Promise<IExtensionDescription | null> { return null; }
|
||||
async whenExtensionsReady(): Promise<void> { }
|
||||
}
|
||||
|
||||
//#endregion
|
||||
@@ -501,37 +496,11 @@ registerSingleton(ITelemetryService, SimpleTelemetryService);
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region Keymap Service
|
||||
//#region Keymap Service (borrowed from browser for now to enable keyboard access)
|
||||
|
||||
class SimpleKeyboardMapper implements IKeyboardMapper {
|
||||
dumpDebugInfo(): string { return ''; }
|
||||
resolveKeybinding(keybinding: ChordKeybinding): ResolvedKeybinding[] { return []; }
|
||||
resolveKeyboardEvent(keyboardEvent: IKeyboardEvent): ResolvedKeybinding {
|
||||
let keybinding = new SimpleKeybinding(
|
||||
keyboardEvent.ctrlKey,
|
||||
keyboardEvent.shiftKey,
|
||||
keyboardEvent.altKey,
|
||||
keyboardEvent.metaKey,
|
||||
keyboardEvent.keyCode
|
||||
).toChord();
|
||||
return new USLayoutResolvedKeybinding(keybinding, OS);
|
||||
}
|
||||
resolveUserBinding(firstPart: (SimpleKeybinding | ScanCodeBinding)[]): ResolvedKeybinding[] { return []; }
|
||||
}
|
||||
class SimpleKeyboardLayoutService extends BrowserKeyboardLayoutService { }
|
||||
|
||||
class SimpleKeymapService implements IKeymapService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
onDidChangeKeyboardMapper = Event.None;
|
||||
getKeyboardMapper(dispatchConfig: DispatchConfig): IKeyboardMapper { return new SimpleKeyboardMapper(); }
|
||||
getCurrentKeyboardLayout(): (IWindowsKeyboardLayoutInfo & { isUserKeyboardLayout?: boolean | undefined; isUSStandard?: true | undefined; }) | (ILinuxKeyboardLayoutInfo & { isUserKeyboardLayout?: boolean | undefined; isUSStandard?: true | undefined; }) | (IMacKeyboardLayoutInfo & { isUserKeyboardLayout?: boolean | undefined; isUSStandard?: true | undefined; }) | null { return null; }
|
||||
getAllKeyboardLayouts(): IKeyboardLayoutInfo[] { return []; }
|
||||
getRawKeyboardMapping(): IWindowsKeyboardMapping | ILinuxKeyboardMapping | IMacKeyboardMapping | null { return null; }
|
||||
validateCurrentKeyboardMapping(keyboardEvent: IKeyboardEvent): void { }
|
||||
}
|
||||
|
||||
registerSingleton(IKeymapService, SimpleKeymapService);
|
||||
registerSingleton(IKeyboardLayoutService, SimpleKeyboardLayoutService);
|
||||
|
||||
//#endregion
|
||||
|
||||
@@ -685,7 +654,7 @@ registerSingleton(IUserDataAutoSyncService, SimpleUserDataAutoSyncAccountService
|
||||
|
||||
//#region User Data Sync Store Management
|
||||
|
||||
class SimpleIUserDataSyncStoreManagementService implements IUserDataSyncStoreManagementService {
|
||||
class SimpleUserDataSyncStoreManagementService implements IUserDataSyncStoreManagementService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
@@ -698,36 +667,10 @@ class SimpleIUserDataSyncStoreManagementService implements IUserDataSyncStoreMan
|
||||
async getPreviousUserDataSyncStore(): Promise<IUserDataSyncStore | undefined> { return undefined; }
|
||||
}
|
||||
|
||||
registerSingleton(IUserDataSyncStoreManagementService, SimpleIUserDataSyncStoreManagementService);
|
||||
registerSingleton(IUserDataSyncStoreManagementService, SimpleUserDataSyncStoreManagementService);
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region IStorageKeysSyncRegistryService
|
||||
|
||||
class SimpleIStorageKeysSyncRegistryService implements IStorageKeysSyncRegistryService {
|
||||
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
onDidChangeStorageKeys = Event.None;
|
||||
|
||||
storageKeys = [];
|
||||
|
||||
registerStorageKey(): void { }
|
||||
|
||||
onDidChangeExtensionStorageKeys = Event.None;
|
||||
|
||||
extensionsStorageKeys = [];
|
||||
|
||||
getExtensioStorageKeys() { return undefined; }
|
||||
|
||||
registerExtensionStorageKeys(): void { }
|
||||
}
|
||||
|
||||
registerSingleton(IStorageKeysSyncRegistryService, SimpleIStorageKeysSyncRegistryService);
|
||||
|
||||
//#endregion
|
||||
|
||||
|
||||
//#region Task
|
||||
|
||||
class SimpleTaskService implements ITaskService {
|
||||
@@ -756,6 +699,7 @@ class SimpleTaskService implements ITaskService {
|
||||
tryResolveTask(configuringTask: ConfiguringTask): Promise<CustomTask | ContributedTask | InMemoryTask | undefined> { throw new Error('Method not implemented.'); }
|
||||
getTasksForGroup(group: string): Promise<Task[]> { throw new Error('Method not implemented.'); }
|
||||
getRecentlyUsedTasks(): LinkedMap<string, string> { throw new Error('Method not implemented.'); }
|
||||
removeRecentlyUsedTask(taskRecentlyUsedKey: string): void { throw new Error('Method not implemented.'); }
|
||||
migrateRecentTasks(tasks: Task[]): Promise<void> { throw new Error('Method not implemented.'); }
|
||||
createSorter(): TaskSorter { throw new Error('Method not implemented.'); }
|
||||
getTaskDescription(task: CustomTask | ContributedTask | InMemoryTask | ConfiguringTask): string | undefined { throw new Error('Method not implemented.'); }
|
||||
@@ -800,7 +744,7 @@ class SimpleWorkspaceTagsService implements IWorkspaceTagsService {
|
||||
declare readonly _serviceBrand: undefined;
|
||||
|
||||
async getTags(): Promise<Tags> { return Object.create(null); }
|
||||
getTelemetryWorkspaceId(workspace: IWorkspace, state: WorkbenchState): string | undefined { return undefined; }
|
||||
async getTelemetryWorkspaceId(workspace: IWorkspace, state: WorkbenchState): Promise<string | undefined> { return undefined; }
|
||||
async getHashedRemotesFromUri(workspaceUri: URI, stripEndingDotGit?: boolean): Promise<string[]> { return []; }
|
||||
}
|
||||
|
||||
@@ -811,7 +755,7 @@ registerSingleton(IWorkspaceTagsService, SimpleWorkspaceTagsService);
|
||||
|
||||
//#region Output Channel
|
||||
|
||||
class SimpleOutputChannelModelService extends AsbtractOutputChannelModelService {
|
||||
class SimpleOutputChannelModelService extends AbstractOutputChannelModelService {
|
||||
declare readonly _serviceBrand: undefined;
|
||||
}
|
||||
|
||||
@@ -834,3 +778,9 @@ class SimpleIntegrityService implements IIntegrityService {
|
||||
registerSingleton(IIntegrityService, SimpleIntegrityService);
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Terminal Instance
|
||||
|
||||
class SimpleTerminalInstanceService extends TerminalInstanceService { }
|
||||
|
||||
registerSingleton(ITerminalInstanceService, SimpleTerminalInstanceService);
|
||||
|
||||
@@ -32,7 +32,7 @@ import { IWorkspaceFolderCreationData, IWorkspacesService } from 'vs/platform/wo
|
||||
import { IIntegrityService } from 'vs/workbench/services/integrity/common/integrity';
|
||||
import { isWindows, isMacintosh } from 'vs/base/common/platform';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { INotificationService, IPromptChoice, NeverShowAgainScope, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService';
|
||||
import { IAccessibilityService, AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
|
||||
@@ -43,7 +43,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { MenubarControl } from '../browser/parts/titlebar/menubarControl';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { IUpdateService } from 'vs/platform/update/common/update';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||
import { IPreferencesService } from '../services/preferences/common/preferences';
|
||||
import { IMenubarData, IMenubarMenu, IMenubarKeybinding, IMenubarMenuItemSubmenu, IMenubarMenuItemAction, MenubarMenuItem } from 'vs/platform/menubar/common/menubar';
|
||||
import { IMenubarService } from 'vs/platform/menubar/electron-sandbox/menubar';
|
||||
@@ -59,7 +59,6 @@ import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { IWorkingCopyService, WorkingCopyCapabilities } from 'vs/workbench/services/workingCopy/common/workingCopyService';
|
||||
import { AutoSaveMode, IFilesConfigurationService } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { clearAllFontInfos } from 'vs/editor/browser/config/configuration';
|
||||
import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver';
|
||||
import { IAddressProvider, IAddress } from 'vs/platform/remote/common/remoteAgentConnection';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
@@ -185,14 +184,29 @@ export class NativeWindow extends Disposable {
|
||||
ipcRenderer.on('vscode:addFolders', (event: unknown, request: IAddFoldersRequest) => this.onAddFoldersRequest(request));
|
||||
|
||||
// Message support
|
||||
ipcRenderer.on('vscode:showInfoMessage', (event: unknown, message: string) => {
|
||||
this.notificationService.info(message);
|
||||
});
|
||||
ipcRenderer.on('vscode:showInfoMessage', (event: unknown, message: string) => this.notificationService.info(message));
|
||||
|
||||
// Display change events
|
||||
ipcRenderer.on('vscode:displayChanged', () => {
|
||||
clearAllFontInfos();
|
||||
});
|
||||
// Shell Environment Issue Notifications
|
||||
const choices: IPromptChoice[] = [{
|
||||
label: nls.localize('learnMode', "Learn More"),
|
||||
run: () => this.openerService.open('https://go.microsoft.com/fwlink/?linkid=2149667')
|
||||
}];
|
||||
|
||||
ipcRenderer.on('vscode:showShellEnvSlowWarning', () => this.notificationService.prompt(
|
||||
Severity.Warning,
|
||||
nls.localize('shellEnvSlowWarning', "Resolving your shell environment is taking very long. Please review your shell configuration."),
|
||||
choices,
|
||||
{
|
||||
sticky: true,
|
||||
neverShowAgain: { id: 'ignoreShellEnvSlowWarning', scope: NeverShowAgainScope.GLOBAL }
|
||||
}
|
||||
));
|
||||
|
||||
ipcRenderer.on('vscode:showShellEnvTimeoutError', () => this.notificationService.prompt(
|
||||
Severity.Error,
|
||||
nls.localize('shellEnvTimeoutError', "Unable to resolve your shell environment in a reasonable time. Please review your shell configuration."),
|
||||
choices
|
||||
));
|
||||
|
||||
// Fullscreen Events
|
||||
ipcRenderer.on('vscode:enterFullScreen', async () => {
|
||||
@@ -237,7 +251,7 @@ export class NativeWindow extends Disposable {
|
||||
|
||||
// Update state based on checkbox
|
||||
if (result.checkboxChecked) {
|
||||
this.storageService.store(NativeWindow.REMEMBER_PROXY_CREDENTIALS_KEY, true, StorageScope.GLOBAL);
|
||||
this.storageService.store(NativeWindow.REMEMBER_PROXY_CREDENTIALS_KEY, true, StorageScope.GLOBAL, StorageTarget.MACHINE);
|
||||
} else {
|
||||
this.storageService.remove(NativeWindow.REMEMBER_PROXY_CREDENTIALS_KEY, StorageScope.GLOBAL);
|
||||
}
|
||||
@@ -286,7 +300,7 @@ export class NativeWindow extends Disposable {
|
||||
}
|
||||
|
||||
// Maximize/Restore on doubleclick (for macOS custom title)
|
||||
if (isMacintosh && getTitleBarStyle(this.configurationService, this.environmentService) === 'custom') {
|
||||
if (isMacintosh && getTitleBarStyle(this.configurationService) === 'custom') {
|
||||
const titlePart = assertIsDefined(this.layoutService.getContainer(Parts.TITLEBAR_PART));
|
||||
|
||||
this._register(DOM.addDisposableListener(titlePart, DOM.EventType.DBLCLICK, e => {
|
||||
@@ -402,7 +416,7 @@ export class NativeWindow extends Disposable {
|
||||
this.customTitleContextMenuDisposable.clear();
|
||||
|
||||
// Provide new menu if a file is opened and we are on a custom title
|
||||
if (!filePath || getTitleBarStyle(this.configurationService, this.environmentService) !== 'custom') {
|
||||
if (!filePath || getTitleBarStyle(this.configurationService) !== 'custom') {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -434,7 +448,7 @@ export class NativeWindow extends Disposable {
|
||||
private create(): void {
|
||||
|
||||
// Native menu controller
|
||||
if (isMacintosh || getTitleBarStyle(this.configurationService, this.environmentService) === 'native') {
|
||||
if (isMacintosh || getTitleBarStyle(this.configurationService) === 'native') {
|
||||
this._register(this.instantiationService.createInstance(NativeMenubarControl));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user