mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-29 13:03:42 +01:00
Merge branch 'master' into ben/stacks
This commit is contained in:
@@ -17,9 +17,9 @@ import * as platform from 'vs/base/common/platform';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import * as types from 'vs/base/common/types';
|
||||
import { ServiceIdentifier, createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import product, { IProductConfiguration } from 'vs/code/node/product';
|
||||
import product, { IProductConfiguration } from 'vs/platform/product';
|
||||
import { parseArgs } from 'vs/code/node/argv';
|
||||
import pkg from 'vs/code/node/package';
|
||||
import pkg from 'vs/platform/package';
|
||||
|
||||
export interface IProcessEnvironment {
|
||||
[key: string]: string;
|
||||
@@ -46,7 +46,7 @@ export interface ICommandLineArguments {
|
||||
waitForWindowClose?: boolean;
|
||||
}
|
||||
|
||||
export const IEnvironmentService = createDecorator<IEnvironmentService>('environmentService');
|
||||
export const IEnvironmentService = createDecorator<IEnvironmentService>('mainEnvironmentService');
|
||||
|
||||
export interface IEnvironmentService {
|
||||
serviceId: ServiceIdentifier<any>;
|
||||
|
||||
@@ -409,10 +409,6 @@ export class VSCodeMenu {
|
||||
|
||||
// Files
|
||||
let files = recentList.files;
|
||||
if (platform.isMacintosh && recentList.files.length > 0) {
|
||||
files = recentList.files.filter(f => recentList.folders.indexOf(f) < 0); // TODO@Ben migration (remove in the future)
|
||||
}
|
||||
|
||||
if (files.length > 0) {
|
||||
openRecentMenu.append(__separator__());
|
||||
|
||||
@@ -828,7 +824,7 @@ function __separator__(): Electron.MenuItem {
|
||||
|
||||
function mnemonicLabel(label: string): string {
|
||||
if (platform.isMacintosh) {
|
||||
return label.replace(/&&/g, ''); // no mnemonic support on mac
|
||||
return label.replace(/\(&&\w\)|&&/g, ''); // no mnemonic support on mac/linux
|
||||
}
|
||||
|
||||
return label.replace(/&&/g, '&');
|
||||
|
||||
@@ -5,57 +5,21 @@
|
||||
|
||||
import * as cp from 'child_process';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import pkg from 'vs/code/node/package';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { IEnvironment } from 'vs/platform/workspace/common/workspace';
|
||||
import { IEnvironmentService } from 'vs/code/electron-main/env';
|
||||
import { ISettingsService } from 'vs/code/electron-main/settings';
|
||||
import { IUpdateService } from 'vs/code/electron-main/update-manager';
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
const boostrapPath = URI.parse(require.toUrl('bootstrap')).fsPath;
|
||||
|
||||
function getEnvironment(envService: IEnvironmentService, updateManager: IUpdateService): IEnvironment {
|
||||
let configuration: IEnvironment = assign({}, envService.cliArgs);
|
||||
configuration.execPath = process.execPath;
|
||||
configuration.appName = envService.product.nameLong;
|
||||
configuration.appRoot = envService.appRoot;
|
||||
configuration.version = pkg.version;
|
||||
configuration.commitHash = envService.product.commit;
|
||||
configuration.appSettingsHome = envService.appSettingsHome;
|
||||
configuration.appSettingsPath = envService.appSettingsPath;
|
||||
configuration.appKeybindingsPath = envService.appKeybindingsPath;
|
||||
configuration.userExtensionsHome = envService.userExtensionsHome;
|
||||
configuration.isBuilt = envService.isBuilt;
|
||||
configuration.updateFeedUrl = updateManager.feedUrl;
|
||||
configuration.updateChannel = updateManager.channel;
|
||||
configuration.extensionsGallery = envService.product.extensionsGallery;
|
||||
function _spawnSharedProcess(): cp.ChildProcess {
|
||||
const env = assign({}, process.env, {
|
||||
AMD_ENTRYPOINT: 'vs/code/node/sharedProcessMain'
|
||||
});
|
||||
|
||||
return configuration;
|
||||
}
|
||||
|
||||
function _spawnSharedProcess(envService: IEnvironmentService, updateManager: IUpdateService, settingsManager: ISettingsService): cp.ChildProcess {
|
||||
// Make sure the nls configuration travels to the shared process.
|
||||
const opts = {
|
||||
env: assign(assign({}, process.env), {
|
||||
AMD_ENTRYPOINT: 'vs/code/node/sharedProcessMain'
|
||||
})
|
||||
};
|
||||
|
||||
const result = cp.fork(boostrapPath, ['--type=SharedProcess'], opts);
|
||||
const result = cp.fork(boostrapPath, ['--type=SharedProcess'], { env });
|
||||
|
||||
// handshake
|
||||
result.once('message', () => {
|
||||
result.send({
|
||||
configuration: {
|
||||
env: getEnvironment(envService, updateManager)
|
||||
},
|
||||
contextServiceOptions: {
|
||||
globalSettings: settingsManager.globalSettings
|
||||
}
|
||||
});
|
||||
});
|
||||
result.once('message', () => result.send('hey'));
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -63,10 +27,6 @@ function _spawnSharedProcess(envService: IEnvironmentService, updateManager: IUp
|
||||
let spawnCount = 0;
|
||||
|
||||
export function spawnSharedProcess(accessor: ServicesAccessor): IDisposable {
|
||||
const envService = accessor.get(IEnvironmentService);
|
||||
const updateManager = accessor.get(IUpdateService);
|
||||
const settingsManager = accessor.get(ISettingsService);
|
||||
|
||||
let child: cp.ChildProcess;
|
||||
|
||||
const spawn = () => {
|
||||
@@ -74,7 +34,7 @@ export function spawnSharedProcess(accessor: ServicesAccessor): IDisposable {
|
||||
return;
|
||||
}
|
||||
|
||||
child = _spawnSharedProcess(envService, updateManager, settingsManager);
|
||||
child = _spawnSharedProcess();
|
||||
child.on('exit', spawn);
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import * as nls from 'vs/nls';
|
||||
import * as paths from 'vs/base/common/paths';
|
||||
import * as arrays from 'vs/base/common/arrays';
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
import pkg from 'vs/code/node/package';
|
||||
import pkg from 'vs/platform/package';
|
||||
import { EventEmitter } from 'events';
|
||||
import { IStorageService } from 'vs/code/electron-main/storage';
|
||||
import { IPath, VSCodeWindow, ReadyState, IWindowConfiguration, IWindowState as ISingleWindowState, defaultWindowState } from 'vs/code/electron-main/window';
|
||||
@@ -789,10 +789,6 @@ export class WindowsManager implements IWindowsService {
|
||||
files = arrays.distinct(files);
|
||||
folders = arrays.distinct(folders);
|
||||
|
||||
if (platform.isMacintosh && files.length > 0) {
|
||||
files = files.filter(f => folders.indexOf(f) < 0); // TODO@Ben migration (remove in the future)
|
||||
}
|
||||
|
||||
// Make sure it is bounded
|
||||
files = files.slice(0, 10);
|
||||
folders = folders.slice(0, 10);
|
||||
|
||||
Reference in New Issue
Block a user