提交 9459d2aa 编写于 作者: B Benjamin Pasero

Update to Electron 2.0.x

上级 e47a9c9e
disturl "https://atom.io/download/electron"
target "1.7.12"
target "2.0.2"
runtime "electron"
Package: @@NAME@@
Version: @@VERSION@@
Section: devel
Depends: libnotify4, libnss3, gnupg, apt, libxkbfile1, libgconf-2-4, libsecret-1-0
Depends: libnotify4, libnss3, gnupg, apt, libxkbfile1, libgconf-2-4, libsecret-1-0, libgtk-3-0 (>= 3.10.0)
Priority: optional
Architecture: @@ARCHITECTURE@@
Maintainer: Microsoft Corporation <vscode-linux@microsoft.com>
......@@ -12,3 +12,4 @@ Conflicts: visual-studio-@@NAME@@
Replaces: visual-studio-@@NAME@@
Description: Code editing. Redefined.
Visual Studio Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle. See https://code.visualstudio.com/docs/setup/linux for installation instructions and FAQ.
\ No newline at end of file
......@@ -4,7 +4,7 @@
"libpthread.so.0(GLIBC_2.2.5)(64bit)",
"libpthread.so.0(GLIBC_2.3.2)(64bit)",
"libpthread.so.0(GLIBC_2.3.3)(64bit)",
"libgtk-x11-2.0.so.0()(64bit)",
"libgtk-3.so.0()(64bit)",
"libgdk-x11-2.0.so.0()(64bit)",
"libatk-1.0.so.0()(64bit)",
"libgio-2.0.so.0()(64bit)",
......@@ -114,7 +114,7 @@
"libglib-2.0.so.0",
"libgmodule-2.0.so.0",
"libgobject-2.0.so.0",
"libgtk-x11-2.0.so.0",
"libgtk-3.so.0",
"libm.so.6",
"libm.so.6(GLIBC_2.0)",
"libm.so.6(GLIBC_2.1)",
......
......@@ -29,7 +29,7 @@ set ELECTRON_ENABLE_LOGGING=1
set ELECTRON_ENABLE_STACK_DUMPING=1
:: Launch Code
%CODE% --debug=5874 out\cli.js . %*
%CODE% --inspect=5874 out\cli.js . %*
popd
endlocal
......@@ -32,7 +32,7 @@ function code() {
VSCODE_DEV=1 \
ELECTRON_ENABLE_LOGGING=1 \
ELECTRON_ENABLE_STACK_DUMPING=1 \
"$CODE" --debug=5874 "$ROOT/out/cli.js" . "$@"
"$CODE" --inspect=5874 "$ROOT/out/cli.js" . "$@"
}
code "$@"
......@@ -3,6 +3,10 @@
if [[ "$OSTYPE" == "darwin"* ]]; then
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
ROOT=$(dirname "$(dirname "$(realpath "$0")")")
# On Linux with Electron 2.0.x running out of a VM causes
# a freeze so we only enable this flag on macOS
export ELECTRON_ENABLE_LOGGING=1
else
ROOT=$(dirname "$(dirname "$(readlink -f $0)")")
fi
......@@ -40,7 +44,6 @@ function code() {
export NODE_ENV=development
export VSCODE_DEV=1
export VSCODE_CLI=1
export ELECTRON_ENABLE_LOGGING=1
export ELECTRON_ENABLE_STACK_DUMPING=1
# Launch Code
......
......@@ -4,6 +4,10 @@
if [[ "$OSTYPE" == "darwin"* ]]; then
realpath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"; }
ROOT=$(dirname $(dirname $(realpath "$0")))
# On Linux with Electron 2.0.x running out of a VM causes
# a freeze so we only enable this flag on macOS
export ELECTRON_ENABLE_LOGGING=1
else
ROOT=$(dirname $(dirname $(readlink -f $0)))
fi
......@@ -25,7 +29,6 @@ test -d node_modules || yarn
node build/lib/electron.js || ./node_modules/.bin/gulp electron
# Unit Tests
export ELECTRON_ENABLE_LOGGING=1
if [[ "$OSTYPE" == "darwin"* ]]; then
cd $ROOT ; ulimit -n 4096 ; \
"$CODE" \
......
......@@ -69,6 +69,12 @@ if (isTempPortable) {
const app = require('electron').app;
// TODO@Ben Electron 2.0.x: prevent localStorage migration from SQLite to LevelDB due to issues
app.commandLine.appendSwitch('disable-mojo-local-storage');
// TODO@Ben Electron 2.0.x: force srgb color profile (for https://github.com/Microsoft/vscode/issues/51791)
app.commandLine.appendSwitch('force-color-profile', 'srgb');
const minimist = require('minimist');
const paths = require('./paths');
......
此差异已折叠。
此差异已折叠。
......@@ -190,7 +190,7 @@ function showContextMenu(e) {
}));
}
menu.popup(remote.getCurrentWindow());
menu.popup({ window: remote.getCurrentWindow() });
}
export function startup(data: ProcessExplorerData): void {
......
......@@ -193,23 +193,6 @@ export class CodeWindow implements ICodeWindow {
this._win = new BrowserWindow(options);
this._id = this._win.id;
// Bug in Electron (https://github.com/electron/electron/issues/10862). On multi-monitor setups,
// it can happen that the position we set to the window is not the correct one on the display.
// To workaround, we ask the window for its position and set it again if not matching.
// This only applies if the window is not fullscreen or maximized and multiple monitors are used.
if (isWindows && !isFullscreenOrMaximized) {
try {
if (screen.getAllDisplays().length > 1) {
const [x, y] = this._win.getPosition();
if (x !== this.windowState.x || y !== this.windowState.y) {
this._win.setPosition(this.windowState.x, this.windowState.y, false);
}
}
} catch (err) {
this.logService.warn(`Unexpected error fixing window position on windows with multiple windows: ${err}\n${err.stack}`);
}
}
if (useCustomTitleStyle) {
this._win.setSheetOffset(22); // offset dialogs by the height of the custom title bar if we have any
}
......@@ -987,11 +970,6 @@ export class CodeWindow implements ICodeWindow {
this.touchBarGroups.push(groupTouchBar);
}
// Ugly workaround for native crash on macOS 10.12.1. We are not
// leveraging the API for changing the ESC touch bar item.
// See https://github.com/electron/electron/issues/10442
(<any>this._win)._setEscapeTouchBarItem = () => { };
this._win.setTouchBar(new TouchBar({ items: this.touchBarGroups }));
}
......
......@@ -49,7 +49,7 @@ export class DarwinUpdateService extends AbstractUpdateService {
protected setUpdateFeedUrl(quality: string): boolean {
try {
electron.autoUpdater.setFeedURL(createUpdateURL('darwin', quality));
electron.autoUpdater.setFeedURL({ url: createUpdateURL('darwin', quality) });
} catch (e) {
// application is very likely not signed
this.logService.error('Failed to set update feed URL', e);
......
......@@ -20,13 +20,16 @@ import { IPartService, Parts, Position as SideBarPosition } from 'vs/workbench/s
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { ToggleActivityBarVisibilityAction } from 'vs/workbench/browser/actions/toggleActivityBarVisibility';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { ACTIVITY_BAR_BACKGROUND, ACTIVITY_BAR_BORDER, ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND, ACTIVITY_BAR_DRAG_AND_DROP_BACKGROUND } from 'vs/workbench/common/theme';
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
import { CompositeBar } from 'vs/workbench/browser/parts/compositebar/compositeBar';
import { isMacintosh } from 'vs/base/common/platform';
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { scheduleAtNextAnimationFrame, Dimension, createCSSRule } from 'vs/base/browser/dom';
import { Color } from 'vs/base/common/color';
import { ToggleCompositePinnedAction, ICompositeBar } from 'vs/workbench/browser/parts/compositebar/compositeBarActions';
import { ViewletDescriptor } from 'vs/workbench/browser/viewlet';
import { Dimension, createCSSRule } from 'vs/base/browser/dom';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
......@@ -66,6 +69,7 @@ export class ActivitybarPart extends Part {
@IInstantiationService private instantiationService: IInstantiationService,
@IPartService private partService: IPartService,
@IThemeService themeService: IThemeService,
@ILifecycleService private lifecycleService: ILifecycleService,
@IStorageService private storageService: IStorageService,
@IExtensionService extensionService: IExtensionService
) {
......@@ -167,6 +171,27 @@ export class ActivitybarPart extends Part {
// Top Actionbar with action items for each viewlet action
this.createGlobalActivityActionBar($('.global-activity').appendTo($result).getHTMLElement());
// TODO@Ben: workaround for https://github.com/Microsoft/vscode/issues/45700
// It looks like there are rendering glitches on macOS with Chrome 61 when
// using --webkit-mask with a background color that is different from the image
// The workaround is to promote the element onto its own drawing layer. We do
// this only after the workbench has loaded because otherwise there is ugly flicker.
if (isMacintosh) {
this.lifecycleService.when(LifecyclePhase.Running).then(() => {
scheduleAtNextAnimationFrame(() => { // another delay...
scheduleAtNextAnimationFrame(() => { // ...to prevent more flickering on startup
registerThemingParticipant((theme, collector) => {
const activityBarForeground = theme.getColor(ACTIVITY_BAR_FOREGROUND);
if (activityBarForeground && !activityBarForeground.equals(Color.white)) {
// only apply this workaround if the color is different from the image one (white)
collector.addRule('.monaco-workbench .activitybar > .content .monaco-action-bar .action-label { will-change: transform; }');
}
});
});
});
});
}
return $result.getHTMLElement();
}
......
......@@ -16,8 +16,8 @@ import { Queue } from 'vs/base/common/async';
import { stat, writeFile } from 'vs/base/node/pfs';
import { IJSONContributionRegistry, Extensions as JSONExtensions } from 'vs/platform/jsonschemas/common/jsonContributionRegistry';
import { IWorkspaceContextService, Workspace, WorkbenchState, IWorkspaceFolder, toWorkspaceFolders, IWorkspaceFoldersChangeEvent, WorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { isLinux, isWindows, isMacintosh } from 'vs/base/common/platform';
import { IFileService } from 'vs/platform/files/common/files';
import { isLinux } from 'vs/base/common/platform';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { ConfigurationChangeEvent, ConfigurationModel, DefaultConfigurationModel } from 'vs/platform/configuration/common/configurationModels';
import { IConfigurationChangeEvent, ConfigurationTarget, IConfigurationOverrides, keyFromOverrideIdentifier, isConfigurationOverrides, IConfigurationData } from 'vs/platform/configuration/common/configuration';
......@@ -349,7 +349,19 @@ export class WorkspaceService extends Disposable implements IWorkspaceConfigurat
const folderPath = URI.file(singleFolderWorkspaceIdentifier);
return stat(folderPath.fsPath)
.then(workspaceStat => {
const ctime = isLinux ? workspaceStat.ino : workspaceStat.birthtime.getTime(); // On Linux, birthtime is ctime, so we cannot use it! We use the ino instead!
let ctime: number;
if (isLinux) {
ctime = workspaceStat.ino; // Linux: birthtime is ctime, so we cannot use it! We use the ino instead!
} else if (isMacintosh) {
ctime = workspaceStat.birthtime.getTime(); // macOS: birthtime is fine to use as is
} else if (isWindows) {
if (typeof workspaceStat.birthtimeMs === 'number') {
ctime = Math.floor(workspaceStat.birthtimeMs); // Windows: fix precision issue in node.js 8.x to get 7.x results (see https://github.com/nodejs/node/issues/19897)
} else {
ctime = workspaceStat.birthtime.getTime();
}
}
const id = createHash('md5').update(folderPath.fsPath).update(ctime ? String(ctime) : '').digest('hex');
const folder = URI.file(folderPath.fsPath);
return new Workspace(id, getBaseLabel(folder), toWorkspaceFolders([{ path: folder.fsPath }]), null, ctime);
......
......@@ -18,6 +18,7 @@ import { unmnemonicLabel } from 'vs/base/common/labels';
import { Event, Emitter } from 'vs/base/common/event';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IContextMenuDelegate, ContextSubMenu, IEvent } from 'vs/base/browser/contextmenu';
import { once } from 'vs/base/common/functional';
export class ContextMenuService implements IContextMenuService {
......@@ -42,7 +43,15 @@ export class ContextMenuService implements IContextMenuService {
}
return TPromise.timeout(0).then(() => { // https://github.com/Microsoft/vscode/issues/3638
const menu = this.createMenu(delegate, actions);
const onHide = once(() => {
if (delegate.onHide) {
delegate.onHide(undefined);
}
this._onDidContextMenu.fire();
});
const menu = this.createMenu(delegate, actions, onHide);
const anchor = delegate.getAnchor();
let x: number, y: number;
......@@ -61,16 +70,18 @@ export class ContextMenuService implements IContextMenuService {
x *= zoom;
y *= zoom;
menu.popup(remote.getCurrentWindow(), { x: Math.floor(x), y: Math.floor(y), positioningItem: delegate.autoSelectFirstItem ? 0 : void 0 });
this._onDidContextMenu.fire();
if (delegate.onHide) {
delegate.onHide(undefined);
}
menu.popup({
window: remote.getCurrentWindow(),
x: Math.floor(x),
y: Math.floor(y),
positioningItem: delegate.autoSelectFirstItem ? 0 : void 0,
callback: () => onHide()
});
});
});
}
private createMenu(delegate: IContextMenuDelegate, entries: (IAction | ContextSubMenu)[]): Electron.Menu {
private createMenu(delegate: IContextMenuDelegate, entries: (IAction | ContextSubMenu)[], onHide: () => void): Electron.Menu {
const menu = new remote.Menu();
const actionRunner = delegate.actionRunner || new ActionRunner();
......@@ -79,7 +90,7 @@ export class ContextMenuService implements IContextMenuService {
menu.append(new remote.MenuItem({ type: 'separator' }));
} else if (e instanceof ContextSubMenu) {
const submenu = new remote.MenuItem({
submenu: this.createMenu(delegate, e.entries),
submenu: this.createMenu(delegate, e.entries, onHide),
label: unmnemonicLabel(e.label)
});
......@@ -91,6 +102,13 @@ export class ContextMenuService implements IContextMenuService {
type: !!e.checked ? 'checkbox' : !!e.radio ? 'radio' : void 0,
enabled: !!e.enabled,
click: (menuItem, win, event) => {
// To preserve pre-electron-2.x behaviour, we first trigger
// the onHide callback and then the action.
// Fixes https://github.com/Microsoft/vscode/issues/45601
onHide();
// Run action which will close the menu
this.runAction(actionRunner, e, delegate, event);
}
};
......
......@@ -193,13 +193,13 @@ export class ExtensionHostProcessWorker {
}, 100);
// Print out extension host output
onDebouncedOutput(data => {
const inspectorUrlIndex = !this._environmentService.isBuilt && data.data && data.data.indexOf('chrome-devtools://');
if (inspectorUrlIndex >= 0) {
console.log(`%c[Extension Host] %cdebugger inspector at ${data.data.substr(inspectorUrlIndex)}`, 'color: blue', 'color: black');
onDebouncedOutput(output => {
const inspectorUrlMatch = !this._environmentService.isBuilt && output.data && output.data.match(/ws:\/\/([^\s]+)/);
if (inspectorUrlMatch) {
console.log(`%c[Extension Host] %cdebugger inspector at chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=${inspectorUrlMatch[1]}`, 'color: blue', 'color: black');
} else {
console.group('Extension Host');
console.log(data.data, ...data.format);
console.log(output.data, ...output.format);
console.groupEnd();
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册