Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to electron 1.6.x #23800

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d42d446
electron 1.6.2
bpasero Mar 2, 2017
2ec9f79
electron 1.6.3
bpasero Mar 17, 2017
418085f
Merge branch 'master' into ben/electron
bpasero Mar 17, 2017
7315001
Merge branch 'master' into ben/electron
bpasero Mar 18, 2017
1af335a
Merge branch 'master' into ben/electron
bpasero Mar 18, 2017
27d2632
Merge branch 'master' into ben/electron
bpasero Mar 23, 2017
e456867
electron 1.6.4
bpasero Mar 23, 2017
971d605
Merge branch 'master' into ben/electron
bpasero Mar 28, 2017
8b99116
Merge branch 'master' into ben/electron
bpasero Mar 30, 2017
7dd803d
listen to auxclick for mouse button 2 and 3 support
bpasero Mar 30, 2017
6d0c3b5
disable auxclick altogether via webPreferences
bpasero Mar 30, 2017
54e37f6
more elegant way of disabling blink features for webview
bpasero Mar 30, 2017
774933d
Merge branch 'master' into ben/electron
bpasero Mar 31, 2017
dcf4fc5
electron 1.6.5
bpasero Mar 31, 2017
31d0af3
Merge branch 'master' into ben/electron
bpasero Mar 31, 2017
f76d160
more timeout for failing test
bpasero Apr 1, 2017
81c82a9
OSS input
bpasero Apr 1, 2017
440b1b8
tweak timeout
bpasero Apr 1, 2017
fc7f97d
Merge branch 'master' into ben/electron
bpasero Apr 2, 2017
094800e
Add an option 'nativeTabs' (for #15478)
bpasero Apr 2, 2017
7569bb8
applicationinsights 0.17.1 (os.tmpdir deprecation fix)
bpasero Apr 3, 2017
7104f57
Set relaunch command for window (for #13905)
the-ress Apr 3, 2017
399103d
Windows: rename casing of file shows "file deleted on disk" in editor…
bpasero Apr 3, 2017
02cdb94
SCM: Text-only navigation action misaligned (fixes #23583)
bpasero Apr 3, 2017
f643b27
Adopt menu service and commands for save conflict actions (for #23420…
bpasero Apr 3, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ before_install:
- git submodule update --init --recursive
- git clone --depth 1 https://github.com/creationix/nvm.git ./.nvm
- source ./.nvm/nvm.sh
- nvm install 6.6.0
- nvm use 6.6.0
- nvm install 7.4.0
- nvm use 7.4.0
- npm config set python `which python`
- npm install -g gulp
- if [ $TRAVIS_OS_NAME == "linux" ]; then
Expand Down
6 changes: 3 additions & 3 deletions OSSREADME.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
},
{
"name": "chromium",
"version": "53.0.2785.143",
"version": "56.0.2924.87",
"repositoryURL": "http://www.chromium.org/Home",
"licenseDetail": [
"BSD License",
Expand Down Expand Up @@ -104,14 +104,14 @@
},
{
"name": "libchromiumcontent",
"version": "53.0.2785.143",
"version": "56.0.2924.87",
"license": "MIT",
"repositoryURL": "https://github.com/electron/libchromiumcontent",
"isProd": true
},
{
"name": "nodejs",
"version": "6.5.0",
"version": "7.4.0",
"repositoryURL": "https://github.com/nodejs/node",
"isProd": true
},
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ environment:
VSCODE_BUILD_VERBOSE: true

install:
- ps: Install-Product node 6.6.0 x64
- ps: Install-Product node 7.4.0 x64
- npm install -g npm --silent
- npm install -g gulp mocha --silent

Expand Down
6 changes: 3 additions & 3 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.12.0",
"electronVersion": "1.4.6",
"electronVersion": "1.6.5",
"distro": "fbef8e6a73f122b5c8b0034e2c1549e00a1815c3",
"author": {
"name": "Microsoft Corporation"
Expand All @@ -19,7 +19,7 @@
"precommit": "node build/gulpfile.hygiene.js"
},
"dependencies": {
"applicationinsights": "0.17.0",
"applicationinsights": "0.17.1",
"chokidar": "bpasero/chokidar#vscode",
"emmet": "ramya-rao-a/emmet#vscode",
"fast-plist": "0.1.2",
Expand Down
17 changes: 17 additions & 0 deletions src/typings/electron.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,18 @@ declare namespace Electron {
* Note: This API is available only on Windows.
*/
setThumbnailToolTip(toolTip: string): boolean;
/**
* Sets the application id, app icon, relaunch command and relaunch display name
* for the given window. appIconIndex should be set to 0 if the app icon
* file only has a single icon.
*/
setAppDetails(options: {
appId?: string;
appIconPath?: string;
appIconIndex?: number;
relaunchCommand?: string;
relaunchDisplayName?: string;
}): void;
/**
* Same as webContents.showDefinitionForSelection().
* Note: This API is available only on macOS.
Expand Down Expand Up @@ -1784,6 +1796,11 @@ declare namespace Electron {
* Settings of web page’s features.
*/
webPreferences?: WebPreferences;
/**
* Tab group name, allows opening the window as a native tab on macOS 10.12+.
* Windows with the same tabbing identifier will be grouped together.
*/
tabbingIdentifier?: string;
}

type BrowserWindowType = BrowserWindowTypeLinux | BrowserWindowTypeMac | BrowserWindowTypeWindows;
Expand Down
1 change: 1 addition & 0 deletions src/vs/base/browser/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ export function isHTMLElement(o: any): o is HTMLElement {
export const EventType = {
// Mouse
CLICK: 'click',
AUXCLICK: 'auxclick', // >= Chrome 56
DBLCLICK: 'dblclick',
MOUSE_UP: 'mouseup',
MOUSE_DOWN: 'mousedown',
Expand Down
1 change: 1 addition & 0 deletions src/vs/base/parts/tree/browser/treeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ export class TreeView extends HeightMap {
this.viewListeners.push(DOM.addDisposableListener(this.domNode, 'mousedown', (e) => this.onMouseDown(e)));
this.viewListeners.push(DOM.addDisposableListener(this.domNode, 'mouseup', (e) => this.onMouseUp(e)));
this.viewListeners.push(DOM.addDisposableListener(this.wrapper, 'click', (e) => this.onClick(e)));
this.viewListeners.push(DOM.addDisposableListener(this.wrapper, 'auxclick', (e) => this.onClick(e))); // >= Chrome 56
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If AUXCLICK is getting disabled, why add an event listener for the event type?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@auchenberg our code is not just running in VS Code, see also https://github.com/Microsoft/monaco-editor

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, makes sense. Just found it puzzling.

this.viewListeners.push(DOM.addDisposableListener(this.domNode, 'contextmenu', (e) => this.onContextMenu(e)));
this.viewListeners.push(DOM.addDisposableListener(this.wrapper, Touch.EventType.Tap, (e) => this.onTap(e)));
this.viewListeners.push(DOM.addDisposableListener(this.wrapper, Touch.EventType.Change, (e) => this.onTouchChange(e)));
Expand Down
29 changes: 25 additions & 4 deletions src/vs/code/electron-main/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export interface IWindowCreationOptions {
state: IWindowState;
extensionDevelopmentPath?: string;
isExtensionTestHost?: boolean;
titleBarStyle?: 'native' | 'custom';
}

export enum WindowMode {
Expand Down Expand Up @@ -190,22 +189,35 @@ export class VSCodeWindow {
show: !isFullscreenOrMaximized,
title: product.nameLong,
webPreferences: {
'backgroundThrottling': false // by default if Code is in the background, intervals and timeouts get throttled
'backgroundThrottling': false, // by default if Code is in the background, intervals and timeouts get throttled,
disableBlinkFeatures: 'Auxclick' // disable auxclick events (see https://developers.google.com/web/updates/2016/10/auxclick)
}
};

if (platform.isLinux) {
options.icon = path.join(this.environmentService.appRoot, 'resources/linux/code.png'); // Windows and Mac are better off using the embedded icon(s)
}

const windowConfig = this.configurationService.getConfiguration<IWindowSettings>('window');

let useNativeTabs = false;
if (windowConfig && windowConfig.nativeTabs) {
options.tabbingIdentifier = product.nameShort; // this opts in to sierra tabs
useNativeTabs = true;
}

let useCustomTitleStyle = false;
if (platform.isMacintosh && (!this.options.titleBarStyle || this.options.titleBarStyle === 'custom')) {
if (platform.isMacintosh && (!windowConfig || !windowConfig.titleBarStyle || windowConfig.titleBarStyle === 'custom')) {
const isDev = !this.environmentService.isBuilt || !!config.extensionDevelopmentPath;
if (!isDev) {
useCustomTitleStyle = true; // not enabled when developing due to https://github.com/electron/electron/issues/3647
}
}

if (useNativeTabs) {
useCustomTitleStyle = false; // native tabs on sierra do not work with custom title style
}

if (useCustomTitleStyle) {
options.titleBarStyle = 'hidden';
this.hiddenTitleBarStyle = true;
Expand All @@ -219,6 +231,15 @@ export class VSCodeWindow {
this._win.setSheetOffset(22); // offset dialogs by the height of the custom title bar if we have any
}

// Set relaunch command
if (platform.isWindows && product.win32AppUserModelId && typeof this._win.setAppDetails === 'function') {
this._win.setAppDetails({
appId: product.win32AppUserModelId,
relaunchCommand: `"${process.execPath}" -n`,
relaunchDisplayName: product.nameLong
});
}

if (isFullscreenOrMaximized) {
this.win.maximize();

Expand Down Expand Up @@ -769,4 +790,4 @@ export class VSCodeWindow {

this._win = null; // Important to dereference the window object to allow for GC
}
}
}
3 changes: 1 addition & 2 deletions src/vs/code/electron-main/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -851,8 +851,7 @@ export class WindowsManager implements IWindowsMainService {
vscodeWindow = new VSCodeWindow({
state,
extensionDevelopmentPath: configuration.extensionDevelopmentPath,
isExtensionTestHost: !!configuration.extensionTestsPath,
titleBarStyle: windowConfig ? windowConfig.titleBarStyle : void 0
isExtensionTestHost: !!configuration.extensionTestsPath
},
this.logService,
this.environmentService,
Expand Down
1 change: 1 addition & 0 deletions src/vs/platform/windows/common/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,5 @@ export interface IWindowSettings {
autoDetectHighContrast: boolean;
menuBarVisibility: MenuBarVisibility;
newWindowDimensions: 'default' | 'inherit' | 'maximized' | 'fullscreen';
nativeTabs: boolean;
}
3 changes: 2 additions & 1 deletion src/vs/workbench/browser/media/part.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@
.monaco-workbench > .part > .title > .title-actions .action-label {
display: block;
height: 35px;
width: 28px;
line-height: 35px;
min-width: 28px;
background-size: 16px;
background-position: center center;
background-repeat: no-repeat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class NoTabsTitleControl extends TitleControl {

// Detect mouse click
this.toUnbind.push(DOM.addDisposableListener(this.titleContainer, DOM.EventType.CLICK, (e: MouseEvent) => this.onTitleClick(e)));
this.toUnbind.push(DOM.addDisposableListener(this.titleContainer, DOM.EventType.AUXCLICK, (e: MouseEvent) => this.onTitleClick(e)));

// Editor Label
this.editorLabel = this.instantiationService.createInstance(EditorLabel, this.titleContainer, void 0);
Expand Down
10 changes: 10 additions & 0 deletions src/vs/workbench/electron-browser/main.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { Registry } from 'vs/platform/platform';
import nls = require('vs/nls');
import product from 'vs/platform/node/product';
import * as os from 'os';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actionRegistry';
Expand Down Expand Up @@ -269,6 +270,15 @@ if (isMacintosh) {
'default': 'custom',
'description': nls.localize('titleBarStyle', "Adjust the appearance of the window title bar. Changes require a full restart to apply.")
};

// macOS Sierra (10.12.x = darwin 16.x) only
if (os.release().indexOf('16.') === 0) {
properties['window.nativeTabs'] = {
'type': 'boolean',
'default': false,
'description': nls.localize('window.nativeTabs', "Enables macOS Sierra window tabs. Note that changes require a full restart to apply and that native tabs will disable a custom title bar style if configured.")
};
}
}

configurationRegistry.registerConfiguration({
Expand Down
13 changes: 9 additions & 4 deletions src/vs/workbench/electron-browser/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -673,11 +673,16 @@ export class Workbench implements IPartService {
}

const windowConfig = this.configurationService.getConfiguration<IWindowConfiguration>();
if (windowConfig && windowConfig.window) {
const useNativeTabs = windowConfig.window.nativeTabs;
if (useNativeTabs) {
return null; // native tabs on sierra do not work with custom title style
}

const style = windowConfig && windowConfig.window && windowConfig.window.titleBarStyle;

if (style === 'custom') {
return style;
const style = windowConfig.window.titleBarStyle;
if (style === 'custom') {
return style;
}
}

return null;
Expand Down
50 changes: 19 additions & 31 deletions src/vs/workbench/parts/files/browser/fileActions.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@ import { Action, IAction } from 'vs/base/common/actions';
import { isMacintosh } from 'vs/base/common/platform';
import { ActionItem, BaseActionItem, Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { Scope, IActionBarRegistry, Extensions as ActionBarExtensions, ActionBarContributor } from 'vs/workbench/browser/actionBarRegistry';
import { IEditorInputActionContext, IEditorInputAction, EditorInputActionContributor } from 'vs/workbench/browser/parts/editor/baseEditor';
import { GlobalNewUntitledFileAction, SaveFileAsAction, OpenFileAction, ShowOpenedFileInNewWindow, CopyPathAction, GlobalCopyPathAction, RevealInOSAction, GlobalRevealInOSAction, pasteIntoFocusedFilesExplorerViewItem, FocusOpenEditorsView, FocusFilesExplorer, GlobalCompareResourcesAction, GlobalNewFileAction, GlobalNewFolderAction, RevertFileAction, SaveFilesAction, SaveAllAction, SaveFileAction, MoveFileToTrashAction, TriggerRenameFileAction, PasteFileAction, CopyFileAction, SelectResourceForCompareAction, CompareResourcesAction, NewFolderAction, NewFileAction, OpenToSideAction, ShowActiveFileInExplorer, CollapseExplorerView, RefreshExplorerView } from 'vs/workbench/parts/files/browser/fileActions';
import { RevertLocalChangesAction, AcceptLocalChangesAction, CONFLICT_RESOLUTION_SCHEME } from 'vs/workbench/parts/files/browser/saveErrorHandler';
import { revertLocalChangesCommand, acceptLocalChangesCommand, CONFLICT_RESOLUTION_CONTEXT } from 'vs/workbench/parts/files/browser/saveErrorHandler';
import { SyncActionDescriptor, MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actionRegistry';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { FileStat } from 'vs/workbench/parts/files/common/explorerViewModel';
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
import { OpenFolderAction, OpenFileFolderAction } from 'vs/workbench/browser/actions/fileActions';
import { copyFocusedFilesExplorerViewItem, revealInOSFocusedFilesExplorerItem, openFocusedExplorerItemSideBySideCommand, copyPathOfFocusedExplorerItem, copyPathCommand, revealInExplorerCommand, revealInOSCommand, openFolderPickerCommand, openWindowCommand, openFileInNewWindowCommand, deleteFocusedFilesExplorerViewItemCommand, moveFocusedFilesExplorerViewItemToTrashCommand, renameFocusedFilesExplorerViewItemCommand } from 'vs/workbench/parts/files/browser/fileCommands';
import { CommandsRegistry, ICommandHandler } from 'vs/platform/commands/common/commands';
Expand Down Expand Up @@ -174,38 +171,11 @@ class ExplorerViewersActionContributor extends ActionBarContributor {
}
}

class ConflictResolutionActionContributor extends EditorInputActionContributor {

constructor( @IInstantiationService private instantiationService: IInstantiationService) {
super();
}

public hasActionsForEditorInput(context: IEditorInputActionContext): boolean {
if (context.input instanceof DiffEditorInput && context.input.originalInput instanceof ResourceEditorInput) {
const resource = context.input.originalInput.getResource();

return resource && resource.scheme === CONFLICT_RESOLUTION_SCHEME; // scheme used for conflict resolution
}

return false;
}

public getActionsForEditorInput(context: IEditorInputActionContext): IEditorInputAction[] {
return [
this.instantiationService.createInstance(AcceptLocalChangesAction),
this.instantiationService.createInstance(RevertLocalChangesAction)
];
}
}

// Contribute to Viewers that show Files
const actionBarRegistry = Registry.as<IActionBarRegistry>(ActionBarExtensions.Actionbar);
actionBarRegistry.registerActionBarContributor(Scope.VIEWER, FilesViewerActionContributor);
actionBarRegistry.registerActionBarContributor(Scope.VIEWER, ExplorerViewersActionContributor);

// Contribute to Conflict Editor Inputs
actionBarRegistry.registerActionBarContributor(Scope.EDITOR, ConflictResolutionActionContributor);

// Contribute Global Actions
const category = nls.localize('filesCategory', "Files");

Expand Down Expand Up @@ -340,4 +310,22 @@ function appendEditorTitleContextMenuItem(id: string, title: string, command: IC
when: ContextKeyExpr.equals('resourceScheme', 'file'),
group: '2_files'
});
}

// Editor Title Menu for Conflict Resolution
appendSaveConflictEditorTitleAction('workbench.files.action.acceptLocalChanges', nls.localize('acceptLocalChanges', "Use local changes and overwrite disk contents"), 'save-conflict-action-accept-changes', -10, acceptLocalChangesCommand);
appendSaveConflictEditorTitleAction('workbench.files.action.revertLocalChanges', nls.localize('revertLocalChanges', "Discard local changes and revert to content on disk"), 'save-conflict-action-revert-changes', -9, revertLocalChangesCommand);

function appendSaveConflictEditorTitleAction(id: string, title: string, iconClass: string, order: number, command: ICommandHandler): void {

// Command
CommandsRegistry.registerCommand(id, command);

// Action
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: { id, title, iconClass },
when: ContextKeyExpr.equals(CONFLICT_RESOLUTION_CONTEXT, true),
group: 'navigation',
order
});
}
8 changes: 4 additions & 4 deletions src/vs/workbench/parts/files/browser/media/fileactions.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@
background-image: url('split-editor-horizontal-inverse.svg');
}

.monaco-workbench .conflict-editor-action.accept-changes {
.monaco-workbench .save-conflict-action-accept-changes {
background: url('check.svg') center center no-repeat;
}

.vs-dark .monaco-workbench .conflict-editor-action.accept-changes {
.vs-dark .monaco-workbench .save-conflict-action-accept-changes {
background: url('check-inverse.svg') center center no-repeat;
}

.monaco-workbench .conflict-editor-action.revert-changes {
.monaco-workbench .save-conflict-action-revert-changes {
background: url('undo.svg') center center no-repeat;
}

.vs-dark .monaco-workbench .conflict-editor-action.revert-changes {
.vs-dark .monaco-workbench .save-conflict-action-revert-changes {
background: url('undo-inverse.svg') center center no-repeat;
}

Expand Down
Loading