diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 6ffa2fe8eef5e..87e61522cd7a1 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "Code", - "version": "0.8.0-preview", + "version": "0.10.12", "dependencies": { "applicationinsights": { "version": "0.15.6", @@ -305,9 +305,9 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-0.3.8.tgz", "dependencies": { "nan": { - "version": "2.0.8", + "version": "2.2.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 @@ "resolved": "https://registry.npmjs.org/oniguruma/-/oniguruma-6.0.1.tgz", "dependencies": { "nan": { - "version": "2.0.9", + "version": "2.2.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 @@ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz" }, "nan": { - "version": "2.1.0", - "from": "nan@>=2.1.0 <3.0.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.1.0.tgz" + "version": "2.2.0", + "from": "nan@>=2.0.5 <3.0.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.2.0.tgz" } } } diff --git a/package.json b/package.json index f81ad6b6dbff2..b7770eb669026 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "Code", "version": "1.0.0", - "electronVersion": "0.35.6", + "electronVersion": "0.37.5", "author": { "name": "Microsoft Corporation" }, diff --git a/src/typings/electron.d.ts b/src/typings/electron.d.ts index cc46c9828d23b..d850a218928fb 100644 --- a/src/typings/electron.d.ts +++ b/src/typings/electron.d.ts @@ -1278,6 +1278,7 @@ declare module Electron { icon?: NativeImage; noLink?: boolean; cancelId?: number; + defaultId?: number; } } @@ -1797,8 +1798,8 @@ declare module Electron { } class Session { - static fromPartition(partition: string): Session; - static defaultSession: Session; + fromPartition(partition: string): Session; + defaultSession: Session; cookies: any; clearCache(callback: Function): void; @@ -1811,6 +1812,7 @@ declare module Electron { disableNetworkEmulation(): void; setCertificateVerifyProc(proc: CertificateVerifyProc): void; webRequest: any; + flushStorageData(): void; } interface CommonElectron { diff --git a/src/vs/base/browser/ui/dropdown/dropdown.ts b/src/vs/base/browser/ui/dropdown/dropdown.ts index 91ddf27eebc4b..46be1fd66b1a8 100644 --- a/src/vs/base/browser/ui/dropdown/dropdown.ts +++ b/src/vs/base/browser/ui/dropdown/dropdown.ts @@ -80,7 +80,7 @@ export class BaseDropdown extends ActionRunner { e.preventDefault(); e.stopPropagation(); - this.toggleDropdown(); + this.show(); }).appendTo(this.$el); let cleanupFn = labelRenderer(this.$label.getHTMLElement()); @@ -96,14 +96,6 @@ export class BaseDropdown extends ActionRunner { this.$label.title(tooltip); } - /*protected*/ toggleDropdown(): void { - if (this.$el.hasClass('active')) { - this.hide(); - } else { - this.show(); - } - } - /*protected*/ show(): void { // noop } @@ -219,7 +211,6 @@ export class DropdownMenu extends BaseDropdown { /*protected*/ _contextMenuProvider: IContextMenuProvider; private _menuOptions: IMenuOptions; - /*protected*/ currentContainer: HTMLElement; /*protected*/ _actions: IAction[]; /*protected*/ actionProvider: IActionProvider; private menuClassName: string; @@ -228,7 +219,6 @@ export class DropdownMenu extends BaseDropdown { super(container, options); this._contextMenuProvider = options.contextMenuProvider; - this.currentContainer = null; this.actions = options.actions || []; this.actionProvider = options.actionProvider; this.menuClassName = options.menuClassName || ''; @@ -273,7 +263,6 @@ export class DropdownMenu extends BaseDropdown { getMenuClassName: () => this.menuClassName, onHide: () => { this.$el.removeClass('active'); - this.currentContainer = null; } }); } diff --git a/src/vs/workbench/api/node/extHostDocuments.ts b/src/vs/workbench/api/node/extHostDocuments.ts index 9a458cda39683..8be2db27dbcbc 100644 --- a/src/vs/workbench/api/node/extHostDocuments.ts +++ b/src/vs/workbench/api/node/extHostDocuments.ts @@ -670,4 +670,4 @@ export class MainThreadDocuments { } }, onUnexpectedError); } -} +} \ No newline at end of file diff --git a/src/vs/workbench/electron-main/update-manager.ts b/src/vs/workbench/electron-main/update-manager.ts index 719c9334419c1..8f75421dacc64 100644 --- a/src/vs/workbench/electron-main/update-manager.ts +++ b/src/vs/workbench/electron-main/update-manager.ts @@ -127,6 +127,13 @@ export class UpdateManager extends events.EventEmitter { 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(); }); } diff --git a/src/vs/workbench/electron-main/window.ts b/src/vs/workbench/electron-main/window.ts index 63f87c3fb0baa..2cdf2a1e5b1d3 100644 --- a/src/vs/workbench/electron-main/window.ts +++ b/src/vs/workbench/electron-main/window.ts @@ -166,7 +166,7 @@ export class VSCodeWindow { // For VS theme we can show directly because background is white const usesLightTheme = /vs($| )/.test(storage.getItem(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) { global.windowShow = new Date().getTime(); } diff --git a/src/vs/workbench/parts/files/electron-browser/textFileServices.ts b/src/vs/workbench/parts/files/electron-browser/textFileServices.ts index ddc1f36190042..ac71468da1280 100644 --- a/src/vs/workbench/parts/files/electron-browser/textFileServices.ts +++ b/src/vs/workbench/parts/files/electron-browser/textFileServices.ts @@ -9,7 +9,7 @@ import nls = require('vs/nls'); import {TPromise} from 'vs/base/common/winjs.base'; import paths = require('vs/base/common/paths'); 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 {UntitledEditorModel} from 'vs/workbench/common/editor/untitledEditorModel'; import {IEventService} from 'vs/platform/event/common/event'; @@ -165,17 +165,20 @@ export class TextFileService extends AbstractTextFileService { // Button order // 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 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 buttons = [save]; + const buttons = []; if (isWindows) { - buttons.push(dontSave, cancel); + buttons.push(save, dontSave, cancel); + } else if (isLinux) { + buttons.push(dontSave, cancel, save); } else { - buttons.push(cancel, dontSave); + buttons.push(save, cancel, dontSave); } let opts: Electron.Dialog.ShowMessageBoxOptions = { @@ -188,6 +191,10 @@ export class TextFileService extends AbstractTextFileService { cancelId: buttons.indexOf(cancel) }; + if (isLinux) { + opts.defaultId = 2; + } + const choice = this.windowService.getWindow().showMessageBox(opts); return buttons[choice].result; diff --git a/src/vs/workbench/services/contextview/electron-browser/contextmenuService.ts b/src/vs/workbench/services/contextview/electron-browser/contextmenuService.ts index 9512b7408b435..f50127166a658 100644 --- a/src/vs/workbench/services/contextview/electron-browser/contextmenuService.ts +++ b/src/vs/workbench/services/contextview/electron-browser/contextmenuService.ts @@ -7,7 +7,7 @@ import {TPromise} from 'vs/base/common/winjs.base'; 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 dom = require('vs/base/browser/dom'); import {$} from 'vs/base/browser/builder'; @@ -40,7 +40,6 @@ export class ContextMenuService implements IContextMenuService { return TPromise.timeout(0).then(() => { // https://github.com/Microsoft/vscode/issues/3638 let menu = new remote.Menu(); - let actionToRun: actions.IAction = null; actions.forEach(a => { if (a instanceof Separator) { @@ -55,7 +54,7 @@ export class ContextMenuService implements IContextMenuService { accelerator, enabled: a.enabled, click: () => { - actionToRun = a; + this.runAction(a, delegate); } }); @@ -84,21 +83,20 @@ export class ContextMenuService implements IContextMenuService { y *= zoom; menu.popup(remote.getCurrentWindow(), Math.floor(x), Math.floor(y)); + }); + }); + } - if (delegate.onHide) { - delegate.onHide(false); - } + private runAction(actionToRun: IAction, delegate: IContextMenuDelegate): void { + if (delegate.onHide) { + delegate.onHide(false); + } - if (!actionToRun) { - return; - } + this.telemetryService.publicLog('workbenchActionExecuted', { id: actionToRun.id, from: 'contextMenu' }); - 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; - return actionToRun.run(context) || TPromise.as(null); - }); - }) - .done(null, e => this.messageService.show(severity.Error, e)); + res.done(null, e => this.messageService.show(severity.Error, e)); } } diff --git a/src/vs/workbench/services/message/electron-browser/messageService.ts b/src/vs/workbench/services/message/electron-browser/messageService.ts index 5fedbd68b6ece..f46a92ed5dc44 100644 --- a/src/vs/workbench/services/message/electron-browser/messageService.ts +++ b/src/vs/workbench/services/message/electron-browser/messageService.ts @@ -9,7 +9,7 @@ import {IWindowService} from 'vs/workbench/services/window/electron-browser/wind import nls = require('vs/nls'); import {WorkbenchMessageService} from 'vs/workbench/services/message/browser/messageService'; 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 {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService'; import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace'; @@ -38,19 +38,27 @@ export class MessageService extends WorkbenchMessageService { title: confirmation.title || this.contextService.getConfiguration().env.appName, message: confirmation.message, buttons: [ - this.mnemonicLabel(confirmation.primaryButton), - this.mnemonicLabel(confirmation.secondaryButton) + isLinux ? this.mnemonicLabel(confirmation.secondaryButton) : this.mnemonicLabel(confirmation.primaryButton), + isLinux ? this.mnemonicLabel(confirmation.primaryButton) : this.mnemonicLabel(confirmation.secondaryButton) ], noLink: true, cancelId: 1 }; + if (isLinux) { + opts.defaultId = 1; // Linux: buttons are swapped + } + if (confirmation.detail) { opts.detail = confirmation.detail; } let result = this.windowService.getWindow().showMessageBox(opts); + if (isLinux) { + return result === 1 ? true : false; // Linux: buttons are swapped + } + return result === 0 ? true : false; }