提交 84abe711 编写于 作者: B Benjamin Pasero

Update to Electron 0.37.x (#2559)

上级 96c3dbc1
{ {
"name": "Code", "name": "Code",
"version": "0.8.0-preview", "version": "0.10.12",
"dependencies": { "dependencies": {
"applicationinsights": { "applicationinsights": {
"version": "0.15.6", "version": "0.15.6",
...@@ -305,9 +305,9 @@ ...@@ -305,9 +305,9 @@
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-0.3.8.tgz", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-0.3.8.tgz",
"dependencies": { "dependencies": {
"nan": { "nan": {
"version": "2.0.8", "version": "2.2.0",
"from": "nan@>=2.0.2 <3.0.0", "from": "nan@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.0.8.tgz" "resolved": "https://registry.npmjs.org/nan/-/nan-2.2.0.tgz"
} }
} }
} }
...@@ -431,9 +431,9 @@ ...@@ -431,9 +431,9 @@
"resolved": "https://registry.npmjs.org/oniguruma/-/oniguruma-6.0.1.tgz", "resolved": "https://registry.npmjs.org/oniguruma/-/oniguruma-6.0.1.tgz",
"dependencies": { "dependencies": {
"nan": { "nan": {
"version": "2.0.9", "version": "2.2.0",
"from": "nan@>=2.0.9 <3.0.0", "from": "nan@>=2.0.9 <3.0.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.0.9.tgz" "resolved": "https://registry.npmjs.org/nan/-/nan-2.2.0.tgz"
} }
} }
}, },
...@@ -481,9 +481,9 @@ ...@@ -481,9 +481,9 @@
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz" "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz"
}, },
"nan": { "nan": {
"version": "2.1.0", "version": "2.2.0",
"from": "nan@>=2.1.0 <3.0.0", "from": "nan@>=2.0.5 <3.0.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.1.0.tgz" "resolved": "https://registry.npmjs.org/nan/-/nan-2.2.0.tgz"
} }
} }
} }
......
{ {
"name": "Code", "name": "Code",
"version": "1.0.0", "version": "1.0.0",
"electronVersion": "0.35.6", "electronVersion": "0.37.5",
"author": { "author": {
"name": "Microsoft Corporation" "name": "Microsoft Corporation"
}, },
......
...@@ -1278,6 +1278,7 @@ declare module Electron { ...@@ -1278,6 +1278,7 @@ declare module Electron {
icon?: NativeImage; icon?: NativeImage;
noLink?: boolean; noLink?: boolean;
cancelId?: number; cancelId?: number;
defaultId?: number;
} }
} }
...@@ -1797,8 +1798,8 @@ declare module Electron { ...@@ -1797,8 +1798,8 @@ declare module Electron {
} }
class Session { class Session {
static fromPartition(partition: string): Session; fromPartition(partition: string): Session;
static defaultSession: Session; defaultSession: Session;
cookies: any; cookies: any;
clearCache(callback: Function): void; clearCache(callback: Function): void;
...@@ -1811,6 +1812,7 @@ declare module Electron { ...@@ -1811,6 +1812,7 @@ declare module Electron {
disableNetworkEmulation(): void; disableNetworkEmulation(): void;
setCertificateVerifyProc(proc: CertificateVerifyProc): void; setCertificateVerifyProc(proc: CertificateVerifyProc): void;
webRequest: any; webRequest: any;
flushStorageData(): void;
} }
interface CommonElectron { interface CommonElectron {
......
...@@ -80,7 +80,7 @@ export class BaseDropdown extends ActionRunner { ...@@ -80,7 +80,7 @@ export class BaseDropdown extends ActionRunner {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.toggleDropdown(); this.show();
}).appendTo(this.$el); }).appendTo(this.$el);
let cleanupFn = labelRenderer(this.$label.getHTMLElement()); let cleanupFn = labelRenderer(this.$label.getHTMLElement());
...@@ -96,14 +96,6 @@ export class BaseDropdown extends ActionRunner { ...@@ -96,14 +96,6 @@ export class BaseDropdown extends ActionRunner {
this.$label.title(tooltip); this.$label.title(tooltip);
} }
/*protected*/ toggleDropdown(): void {
if (this.$el.hasClass('active')) {
this.hide();
} else {
this.show();
}
}
/*protected*/ show(): void { /*protected*/ show(): void {
// noop // noop
} }
...@@ -219,7 +211,6 @@ export class DropdownMenu extends BaseDropdown { ...@@ -219,7 +211,6 @@ export class DropdownMenu extends BaseDropdown {
/*protected*/ _contextMenuProvider: IContextMenuProvider; /*protected*/ _contextMenuProvider: IContextMenuProvider;
private _menuOptions: IMenuOptions; private _menuOptions: IMenuOptions;
/*protected*/ currentContainer: HTMLElement;
/*protected*/ _actions: IAction[]; /*protected*/ _actions: IAction[];
/*protected*/ actionProvider: IActionProvider; /*protected*/ actionProvider: IActionProvider;
private menuClassName: string; private menuClassName: string;
...@@ -228,7 +219,6 @@ export class DropdownMenu extends BaseDropdown { ...@@ -228,7 +219,6 @@ export class DropdownMenu extends BaseDropdown {
super(container, options); super(container, options);
this._contextMenuProvider = options.contextMenuProvider; this._contextMenuProvider = options.contextMenuProvider;
this.currentContainer = null;
this.actions = options.actions || []; this.actions = options.actions || [];
this.actionProvider = options.actionProvider; this.actionProvider = options.actionProvider;
this.menuClassName = options.menuClassName || ''; this.menuClassName = options.menuClassName || '';
...@@ -273,7 +263,6 @@ export class DropdownMenu extends BaseDropdown { ...@@ -273,7 +263,6 @@ export class DropdownMenu extends BaseDropdown {
getMenuClassName: () => this.menuClassName, getMenuClassName: () => this.menuClassName,
onHide: () => { onHide: () => {
this.$el.removeClass('active'); this.$el.removeClass('active');
this.currentContainer = null;
} }
}); });
} }
......
...@@ -670,4 +670,4 @@ export class MainThreadDocuments { ...@@ -670,4 +670,4 @@ export class MainThreadDocuments {
} }
}, onUnexpectedError); }, onUnexpectedError);
} }
} }
\ No newline at end of file
...@@ -127,6 +127,13 @@ export class UpdateManager extends events.EventEmitter { ...@@ -127,6 +127,13 @@ export class UpdateManager extends events.EventEmitter {
return; return;
} }
// for some reason updating on Mac causes the local storage not to be flushed.
// we workaround this issue by forcing an explicit flush of the storage data.
// see also https://github.com/Microsoft/vscode/issues/172
if (platform.isMacintosh) {
electron.session.defaultSession.flushStorageData();
}
rawQuitAndUpdate(); rawQuitAndUpdate();
}); });
} }
......
...@@ -166,7 +166,7 @@ export class VSCodeWindow { ...@@ -166,7 +166,7 @@ export class VSCodeWindow {
// For VS theme we can show directly because background is white // For VS theme we can show directly because background is white
const usesLightTheme = /vs($| )/.test(storage.getItem<string>(VSCodeWindow.themeStorageKey)); const usesLightTheme = /vs($| )/.test(storage.getItem<string>(VSCodeWindow.themeStorageKey));
let showDirectly = usesLightTheme; let showDirectly = true; // set to false to prevent background color flash (flash should be fixed for Electron >= 0.37.x)
if (showDirectly && !global.windowShow) { if (showDirectly && !global.windowShow) {
global.windowShow = new Date().getTime(); global.windowShow = new Date().getTime();
} }
......
...@@ -9,7 +9,7 @@ import nls = require('vs/nls'); ...@@ -9,7 +9,7 @@ import nls = require('vs/nls');
import {TPromise} from 'vs/base/common/winjs.base'; import {TPromise} from 'vs/base/common/winjs.base';
import paths = require('vs/base/common/paths'); import paths = require('vs/base/common/paths');
import strings = require('vs/base/common/strings'); import strings = require('vs/base/common/strings');
import {isWindows} from 'vs/base/common/platform'; import {isWindows, isLinux} from 'vs/base/common/platform';
import URI from 'vs/base/common/uri'; import URI from 'vs/base/common/uri';
import {UntitledEditorModel} from 'vs/workbench/common/editor/untitledEditorModel'; import {UntitledEditorModel} from 'vs/workbench/common/editor/untitledEditorModel';
import {IEventService} from 'vs/platform/event/common/event'; import {IEventService} from 'vs/platform/event/common/event';
...@@ -165,17 +165,20 @@ export class TextFileService extends AbstractTextFileService { ...@@ -165,17 +165,20 @@ export class TextFileService extends AbstractTextFileService {
// Button order // Button order
// Windows: Save | Don't Save | Cancel // Windows: Save | Don't Save | Cancel
// Mac/Linux: Save | Cancel | Don't // Mac: Save | Cancel | Don't Save
// Linux: Don't Save | Cancel | Save
const save = { label: resourcesToConfirm.length > 1 ? this.mnemonicLabel(nls.localize({ key: 'saveAll', comment: ['&& denotes a mnemonic'] }, "&&Save All")) : this.mnemonicLabel(nls.localize({ key: 'save', comment: ['&& denotes a mnemonic'] }, "&&Save")), result: ConfirmResult.SAVE }; const save = { label: resourcesToConfirm.length > 1 ? this.mnemonicLabel(nls.localize({ key: 'saveAll', comment: ['&& denotes a mnemonic'] }, "&&Save All")) : this.mnemonicLabel(nls.localize({ key: 'save', comment: ['&& denotes a mnemonic'] }, "&&Save")), result: ConfirmResult.SAVE };
const dontSave = { label: this.mnemonicLabel(nls.localize({ key: 'dontSave', comment: ['&& denotes a mnemonic'] }, "Do&&n't Save")), result: ConfirmResult.DONT_SAVE }; const dontSave = { label: this.mnemonicLabel(nls.localize({ key: 'dontSave', comment: ['&& denotes a mnemonic'] }, "Do&&n't Save")), result: ConfirmResult.DONT_SAVE };
const cancel = { label: nls.localize('cancel', "Cancel"), result: ConfirmResult.CANCEL }; const cancel = { label: nls.localize('cancel', "Cancel"), result: ConfirmResult.CANCEL };
const buttons = [save]; const buttons = [];
if (isWindows) { if (isWindows) {
buttons.push(dontSave, cancel); buttons.push(save, dontSave, cancel);
} else if (isLinux) {
buttons.push(dontSave, cancel, save);
} else { } else {
buttons.push(cancel, dontSave); buttons.push(save, cancel, dontSave);
} }
let opts: Electron.Dialog.ShowMessageBoxOptions = { let opts: Electron.Dialog.ShowMessageBoxOptions = {
...@@ -188,6 +191,10 @@ export class TextFileService extends AbstractTextFileService { ...@@ -188,6 +191,10 @@ export class TextFileService extends AbstractTextFileService {
cancelId: buttons.indexOf(cancel) cancelId: buttons.indexOf(cancel)
}; };
if (isLinux) {
opts.defaultId = 2;
}
const choice = this.windowService.getWindow().showMessageBox(opts); const choice = this.windowService.getWindow().showMessageBox(opts);
return buttons[choice].result; return buttons[choice].result;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import {TPromise} from 'vs/base/common/winjs.base'; import {TPromise} from 'vs/base/common/winjs.base';
import severity from 'vs/base/common/severity'; import severity from 'vs/base/common/severity';
import actions = require('vs/base/common/actions'); import {IAction} from 'vs/base/common/actions';
import {Separator} from 'vs/base/browser/ui/actionbar/actionbar'; import {Separator} from 'vs/base/browser/ui/actionbar/actionbar';
import dom = require('vs/base/browser/dom'); import dom = require('vs/base/browser/dom');
import {$} from 'vs/base/browser/builder'; import {$} from 'vs/base/browser/builder';
...@@ -40,7 +40,6 @@ export class ContextMenuService implements IContextMenuService { ...@@ -40,7 +40,6 @@ export class ContextMenuService implements IContextMenuService {
return TPromise.timeout(0).then(() => { // https://github.com/Microsoft/vscode/issues/3638 return TPromise.timeout(0).then(() => { // https://github.com/Microsoft/vscode/issues/3638
let menu = new remote.Menu(); let menu = new remote.Menu();
let actionToRun: actions.IAction = null;
actions.forEach(a => { actions.forEach(a => {
if (a instanceof Separator) { if (a instanceof Separator) {
...@@ -55,7 +54,7 @@ export class ContextMenuService implements IContextMenuService { ...@@ -55,7 +54,7 @@ export class ContextMenuService implements IContextMenuService {
accelerator, accelerator,
enabled: a.enabled, enabled: a.enabled,
click: () => { click: () => {
actionToRun = a; this.runAction(a, delegate);
} }
}); });
...@@ -84,21 +83,20 @@ export class ContextMenuService implements IContextMenuService { ...@@ -84,21 +83,20 @@ export class ContextMenuService implements IContextMenuService {
y *= zoom; y *= zoom;
menu.popup(remote.getCurrentWindow(), Math.floor(x), Math.floor(y)); menu.popup(remote.getCurrentWindow(), Math.floor(x), Math.floor(y));
});
});
}
if (delegate.onHide) { private runAction(actionToRun: IAction, delegate: IContextMenuDelegate): void {
delegate.onHide(false); if (delegate.onHide) {
} delegate.onHide(false);
}
if (!actionToRun) { this.telemetryService.publicLog('workbenchActionExecuted', { id: actionToRun.id, from: 'contextMenu' });
return;
}
this.telemetryService.publicLog('workbenchActionExecuted', { id: actionToRun.id, from: 'contextMenu' }); const context = delegate.getActionsContext ? delegate.getActionsContext() : null;
const res = actionToRun.run(context) || TPromise.as(null);
const context = delegate.getActionsContext ? delegate.getActionsContext() : null; res.done(null, e => this.messageService.show(severity.Error, e));
return actionToRun.run(context) || TPromise.as(null);
});
})
.done(null, e => this.messageService.show(severity.Error, e));
} }
} }
...@@ -9,7 +9,7 @@ import {IWindowService} from 'vs/workbench/services/window/electron-browser/wind ...@@ -9,7 +9,7 @@ import {IWindowService} from 'vs/workbench/services/window/electron-browser/wind
import nls = require('vs/nls'); import nls = require('vs/nls');
import {WorkbenchMessageService} from 'vs/workbench/services/message/browser/messageService'; import {WorkbenchMessageService} from 'vs/workbench/services/message/browser/messageService';
import {IConfirmation} from 'vs/platform/message/common/message'; import {IConfirmation} from 'vs/platform/message/common/message';
import {isWindows} from 'vs/base/common/platform'; import {isWindows, isLinux} from 'vs/base/common/platform';
import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry'; import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService'; import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
...@@ -38,19 +38,27 @@ export class MessageService extends WorkbenchMessageService { ...@@ -38,19 +38,27 @@ export class MessageService extends WorkbenchMessageService {
title: confirmation.title || this.contextService.getConfiguration().env.appName, title: confirmation.title || this.contextService.getConfiguration().env.appName,
message: confirmation.message, message: confirmation.message,
buttons: [ buttons: [
this.mnemonicLabel(confirmation.primaryButton), isLinux ? this.mnemonicLabel(confirmation.secondaryButton) : this.mnemonicLabel(confirmation.primaryButton),
this.mnemonicLabel(confirmation.secondaryButton) isLinux ? this.mnemonicLabel(confirmation.primaryButton) : this.mnemonicLabel(confirmation.secondaryButton)
], ],
noLink: true, noLink: true,
cancelId: 1 cancelId: 1
}; };
if (isLinux) {
opts.defaultId = 1; // Linux: buttons are swapped
}
if (confirmation.detail) { if (confirmation.detail) {
opts.detail = confirmation.detail; opts.detail = confirmation.detail;
} }
let result = this.windowService.getWindow().showMessageBox(opts); let result = this.windowService.getWindow().showMessageBox(opts);
if (isLinux) {
return result === 1 ? true : false; // Linux: buttons are swapped
}
return result === 0 ? true : false; return result === 0 ? true : false;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册