mirror of
https://github.com/Microsoft/vscode
synced 2024-10-12 06:17:18 +00:00
Revert "Merge pull request #54854 from Microsoft/revert-52782-electron-2.0.x"
This reverts commit90fc7e66e2
, reversing changes made to3b25417fa2
.
This commit is contained in:
parent
0027da0dac
commit
5dc414cbc9
2
.yarnrc
2
.yarnrc
|
@ -1,3 +1,3 @@
|
|||
disturl "https://atom.io/download/electron"
|
||||
target "1.7.12"
|
||||
target "2.0.5"
|
||||
runtime "electron"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
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.
|
||||
|
|
@ -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" \
|
||||
|
|
|
@ -81,6 +81,13 @@ 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)
|
||||
// This also seems to fix: https://github.com/Microsoft/vscode/issues/48043
|
||||
app.commandLine.appendSwitch('force-color-profile', 'srgb');
|
||||
|
||||
const minimist = require('minimist');
|
||||
const paths = require('./paths');
|
||||
|
||||
|
|
1264
src/typings/electron.d.ts
vendored
1264
src/typings/electron.d.ts
vendored
File diff suppressed because it is too large
Load diff
9582
src/typings/node.d.ts
vendored
9582
src/typings/node.d.ts
vendored
File diff suppressed because it is too large
Load diff
|
@ -190,7 +190,7 @@ function showContextMenu(e) {
|
|||
}));
|
||||
}
|
||||
|
||||
menu.popup(remote.getCurrentWindow());
|
||||
menu.popup({ window: remote.getCurrentWindow() });
|
||||
}
|
||||
|
||||
export function startup(data: ProcessExplorerData): void {
|
||||
|
|
|
@ -283,7 +283,7 @@ export class CodeApplication {
|
|||
// See: https://github.com/Microsoft/vscode/issues/35361#issuecomment-399794085
|
||||
try {
|
||||
if (platform.isMacintosh && this.configurationService.getValue<boolean>('window.nativeTabs') === true && !systemPreferences.getUserDefault('NSUseImprovedLayoutPass', 'boolean')) {
|
||||
systemPreferences.setUserDefault('NSUseImprovedLayoutPass', 'boolean', true as any);
|
||||
systemPreferences.registerDefaults({ NSUseImprovedLayoutPass: true });
|
||||
}
|
||||
} catch (error) {
|
||||
this.logService.error(error);
|
||||
|
|
|
@ -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 }));
|
||||
}
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider {
|
|||
|
||||
const _CSS_MAP: { [prop: string]: string; } = {
|
||||
color: 'color:{0} !important;',
|
||||
opacity: 'opacity:{0};',
|
||||
opacity: 'opacity:{0}; will-change: opacity;', // TODO@Ben: 'will-change: opacity' is a workaround for https://github.com/Microsoft/vscode/issues/52196
|
||||
backgroundColor: 'background-color:{0};',
|
||||
|
||||
outline: 'outline:{0};',
|
||||
|
|
|
@ -1805,7 +1805,7 @@ registerThemingParticipant((theme, collector) => {
|
|||
|
||||
const unnecessaryForeground = theme.getColor(editorUnnecessaryCodeOpacity);
|
||||
if (unnecessaryForeground) {
|
||||
collector.addRule(`.${SHOW_UNUSED_ENABLED_CLASS} .monaco-editor .${ClassName.EditorUnnecessaryInlineDecoration} { opacity: ${unnecessaryForeground.rgba.a}; }`);
|
||||
collector.addRule(`.${SHOW_UNUSED_ENABLED_CLASS} .monaco-editor .${ClassName.EditorUnnecessaryInlineDecoration} { opacity: ${unnecessaryForeground.rgba.a}; will-change: opacity; }`); // TODO@Ben: 'will-change: opacity' is a workaround for https://github.com/Microsoft/vscode/issues/52196
|
||||
}
|
||||
|
||||
const unnecessaryBorder = theme.getColor(editorUnnecessaryCodeBorder);
|
||||
|
|
|
@ -52,7 +52,7 @@ export class DarwinUpdateService extends AbstractUpdateService {
|
|||
protected buildUpdateFeedUrl(quality: string): string | undefined {
|
||||
const url = createUpdateURL('darwin', quality);
|
||||
try {
|
||||
electron.autoUpdater.setFeedURL(url);
|
||||
electron.autoUpdater.setFeedURL({ url });
|
||||
} catch (e) {
|
||||
// application is very likely not signed
|
||||
this.logService.error('Failed to set update feed URL', e);
|
||||
|
|
|
@ -20,16 +20,19 @@ 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 { ToggleCompositePinnedAction } from 'vs/workbench/browser/parts/compositebar/compositeBarActions';
|
||||
import { ViewletDescriptor } from 'vs/workbench/browser/viewlet';
|
||||
import { Dimension } from 'vs/base/browser/dom';
|
||||
import { isMacintosh } from 'vs/base/common/platform';
|
||||
import { ILifecycleService, LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { scheduleAtNextAnimationFrame, Dimension } from 'vs/base/browser/dom';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { ToggleCompositePinnedAction } from 'vs/workbench/browser/parts/compositebar/compositeBarActions';
|
||||
import { ViewletDescriptor } from 'vs/workbench/browser/viewlet';
|
||||
|
||||
interface IPlaceholderComposite {
|
||||
id: string;
|
||||
|
@ -63,6 +66,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 private extensionService: IExtensionService
|
||||
) {
|
||||
|
@ -161,6 +165,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
|
|||
if (folder.scheme === Schemas.file) {
|
||||
return stat(folder.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(folder.fsPath).update(ctime ? String(ctime) : '').digest('hex');
|
||||
return new Workspace(id, getWorkspaceLabel(folder, this.environmentService), toWorkspaceFolders([{ path: folder.fsPath }]), null, ctime);
|
||||
});
|
||||
|
|
|
@ -17,6 +17,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';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
export class ContextMenuService extends Disposable implements IContextMenuService {
|
||||
|
@ -41,7 +42,15 @@ export class ContextMenuService extends Disposable implements IContextMenuServic
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
|
@ -60,16 +69,18 @@ export class ContextMenuService extends Disposable implements IContextMenuServic
|
|||
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();
|
||||
|
||||
|
@ -78,7 +89,7 @@ export class ContextMenuService extends Disposable implements IContextMenuServic
|
|||
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)
|
||||
});
|
||||
|
||||
|
@ -90,6 +101,13 @@ export class ContextMenuService extends Disposable implements IContextMenuServic
|
|||
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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -191,13 +191,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();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue