提交 46d90b43 编写于 作者: B Benjamin Pasero

Should stop sending global settings and keybindings via IPC (fixes #6094)

上级 0b842190
...@@ -167,9 +167,6 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: IProce ...@@ -167,9 +167,6 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: IProce
// Lifecycle // Lifecycle
lifecycleService.ready(); lifecycleService.ready();
// Load settings (TODO@Ben remove)
global.globalSettingsValue = JSON.stringify(configurationService.getConfiguration());
// Propagate to clients // Propagate to clients
windowsService.ready(userEnv); windowsService.ready(userEnv);
......
...@@ -193,11 +193,6 @@ export class WindowsManager implements IWindowsService { ...@@ -193,11 +193,6 @@ export class WindowsManager implements IWindowsService {
}, 100); }, 100);
}); });
this.configurationService.onDidUpdateConfiguration(event => {
global.globalSettingsValue = JSON.stringify(event.config); // Load settings (TODO@Ben remove)
this.sendToAll('vscode:optionsChange', JSON.stringify(event.config));
}, this);
ipc.on('vscode:startCrashReporter', (event: any, config: any) => { ipc.on('vscode:startCrashReporter', (event: any, config: any) => {
this.logService.log('IPC#vscode:startCrashReporter'); this.logService.log('IPC#vscode:startCrashReporter');
......
...@@ -57,9 +57,7 @@ export class TestContextService implements WorkspaceContextService.IWorkspaceCon ...@@ -57,9 +57,7 @@ export class TestContextService implements WorkspaceContextService.IWorkspaceCon
constructor(workspace: any = TestWorkspace, options: any = null) { constructor(workspace: any = TestWorkspace, options: any = null) {
this.workspace = workspace; this.workspace = workspace;
this.options = options || { this.options = options || Object.create(null);
globalSettings: {}
};
} }
public getWorkspace(): IWorkspace { public getWorkspace(): IWorkspace {
......
...@@ -26,29 +26,6 @@ export class EventType { ...@@ -26,29 +26,6 @@ export class EventType {
* Event type for when a resources encoding changes. * Event type for when a resources encoding changes.
*/ */
static RESOURCE_ENCODING_CHANGED = 'resourceEncodingChanged'; static RESOURCE_ENCODING_CHANGED = 'resourceEncodingChanged';
/**
* Event type for when the workbench options change. Listeners should refresh their
* assumption on workbench options after this event is emitted.
*/
static WORKBENCH_OPTIONS_CHANGED = 'workbenchOptionsChanged';
}
/**
* Option change events are send when the options in the running instance change.
*/
export class OptionsChangeEvent extends Event {
public key: string;
public before: any;
public after: any;
constructor(key: string, before: any, after: any, originalEvent?: any) {
super(originalEvent);
this.key = key;
this.before = before;
this.after = after;
}
} }
export class ResourceEvent extends Event { export class ResourceEvent extends Event {
......
...@@ -27,9 +27,4 @@ export interface IOptions { ...@@ -27,9 +27,4 @@ export interface IOptions {
* Instructs the workbench to install the extensions from the provided local paths. * Instructs the workbench to install the extensions from the provided local paths.
*/ */
extensionsToInstall?: string[]; extensionsToInstall?: string[];
/**
* The global application settings if any.
*/
globalSettings?: any;
} }
\ No newline at end of file
...@@ -120,11 +120,6 @@ function main() { ...@@ -120,11 +120,6 @@ function main() {
const enableDeveloperTools = process.env['VSCODE_DEV'] || !!configuration.extensionDevelopmentPath; const enableDeveloperTools = process.env['VSCODE_DEV'] || !!configuration.extensionDevelopmentPath;
registerListeners(enableDeveloperTools); registerListeners(enableDeveloperTools);
// We get the global settings through a remote call from the browser
// because its value can change dynamically.
const rawGlobalSettings = remote.getGlobal('globalSettingsValue') || '{}';
const globalSettings = JSON.parse(rawGlobalSettings);
// disable pinch zoom & apply zoom level early to avoid glitches // disable pinch zoom & apply zoom level early to avoid glitches
const zoomLevel = configuration.zoomLevel; const zoomLevel = configuration.zoomLevel;
webFrame.setZoomLevelLimits(1, 1); webFrame.setZoomLevelLimits(1, 1);
...@@ -177,7 +172,7 @@ function main() { ...@@ -177,7 +172,7 @@ function main() {
timers.afterLoad = new Date(); timers.afterLoad = new Date();
require('vs/workbench/electron-browser/main') require('vs/workbench/electron-browser/main')
.startup(configuration, globalSettings) .startup(configuration)
.done(null, function (error) { onError(error, enableDeveloperTools); }); .done(null, function (error) { onError(error, enableDeveloperTools); });
}); });
}); });
......
...@@ -22,7 +22,6 @@ import {IContextMenuService} from 'vs/platform/contextview/browser/contextView'; ...@@ -22,7 +22,6 @@ import {IContextMenuService} from 'vs/platform/contextview/browser/contextView';
import {ICommandService} from 'vs/platform/commands/common/commands'; import {ICommandService} from 'vs/platform/commands/common/commands';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding'; import {IKeybindingService} from 'vs/platform/keybinding/common/keybinding';
import {IWorkspaceContextService}from 'vs/platform/workspace/common/workspace'; import {IWorkspaceContextService}from 'vs/platform/workspace/common/workspace';
import {LegacyWorkspaceContextService} from 'vs/workbench/services/workspace/common/contextService';
import {IWindowService} from 'vs/workbench/services/window/electron-browser/windowService'; import {IWindowService} from 'vs/workbench/services/window/electron-browser/windowService';
import {IWindowConfiguration} from 'vs/workbench/electron-browser/window'; import {IWindowConfiguration} from 'vs/workbench/electron-browser/window';
import {IConfigurationService} from 'vs/platform/configuration/common/configuration'; import {IConfigurationService} from 'vs/platform/configuration/common/configuration';
...@@ -74,12 +73,6 @@ export class ElectronIntegration { ...@@ -74,12 +73,6 @@ export class ElectronIntegration {
this.commandService.executeCommand(actionId, { from: 'menu' }).done(undefined, err => this.messageService.show(Severity.Error, err)); this.commandService.executeCommand(actionId, { from: 'menu' }).done(undefined, err => this.messageService.show(Severity.Error, err));
}); });
// Support options change
ipc.on('vscode:optionsChange', (event, options: string) => {
const optionsData = JSON.parse(options);
(<LegacyWorkspaceContextService>this.contextService).updateOptions('globalSettings', optionsData);
});
// Support resolve keybindings event // Support resolve keybindings event
ipc.on('vscode:resolveKeybindings', (event, rawActionIds: string) => { ipc.on('vscode:resolveKeybindings', (event, rawActionIds: string) => {
let actionIds: string[] = []; let actionIds: string[] = [];
......
...@@ -62,7 +62,7 @@ export interface IWindowConfiguration extends ParsedArgs { ...@@ -62,7 +62,7 @@ export interface IWindowConfiguration extends ParsedArgs {
extensionsToInstall?: string[]; extensionsToInstall?: string[];
} }
export function startup(configuration: IWindowConfiguration, globalSettings: any): winjs.TPromise<void> { export function startup(configuration: IWindowConfiguration): winjs.TPromise<void> {
// Shell Options // Shell Options
const filesToOpen = configuration.filesToOpen && configuration.filesToOpen.length ? toInputs(configuration.filesToOpen) : null; const filesToOpen = configuration.filesToOpen && configuration.filesToOpen.length ? toInputs(configuration.filesToOpen) : null;
...@@ -72,8 +72,7 @@ export function startup(configuration: IWindowConfiguration, globalSettings: any ...@@ -72,8 +72,7 @@ export function startup(configuration: IWindowConfiguration, globalSettings: any
filesToOpen, filesToOpen,
filesToCreate, filesToCreate,
filesToDiff, filesToDiff,
extensionsToInstall: configuration.extensionsToInstall, extensionsToInstall: configuration.extensionsToInstall
globalSettings
}; };
if (configuration.performance) { if (configuration.performance) {
...@@ -131,7 +130,7 @@ function getWorkspace(workspacePath: string): IWorkspace { ...@@ -131,7 +130,7 @@ function getWorkspace(workspacePath: string): IWorkspace {
function openWorkbench(environment: IWindowConfiguration, workspace: IWorkspace, options: IOptions): winjs.TPromise<void> { function openWorkbench(environment: IWindowConfiguration, workspace: IWorkspace, options: IOptions): winjs.TPromise<void> {
const eventService = new EventService(); const eventService = new EventService();
const environmentService = new EnvironmentService(environment, environment.execPath); const environmentService = new EnvironmentService(environment, environment.execPath);
const contextService = new LegacyWorkspaceContextService(eventService, workspace, options); const contextService = new LegacyWorkspaceContextService(workspace, options);
const configurationService = new ConfigurationService(contextService, eventService, environmentService); const configurationService = new ConfigurationService(contextService, eventService, environmentService);
// Since the configuration service is one of the core services that is used in so many places, we initialize it // Since the configuration service is one of the core services that is used in so many places, we initialize it
......
...@@ -5,14 +5,11 @@ ...@@ -5,14 +5,11 @@
'use strict'; 'use strict';
import {IOptions} from 'vs/workbench/common/options'; import {IOptions} from 'vs/workbench/common/options';
import {EventType, OptionsChangeEvent} from 'vs/workbench/common/events';
import {IEventService} from 'vs/platform/event/common/event';
import {IWorkspace, WorkspaceContextService} from 'vs/platform/workspace/common/workspace'; import {IWorkspace, WorkspaceContextService} from 'vs/platform/workspace/common/workspace';
export class LegacyWorkspaceContextService extends WorkspaceContextService { export class LegacyWorkspaceContextService extends WorkspaceContextService {
constructor( constructor(
private eventService: IEventService,
workspace: IWorkspace, workspace: IWorkspace,
private options: IOptions private options: IOptions
) { ) {
...@@ -22,11 +19,4 @@ export class LegacyWorkspaceContextService extends WorkspaceContextService { ...@@ -22,11 +19,4 @@ export class LegacyWorkspaceContextService extends WorkspaceContextService {
public getOptions(): IOptions { public getOptions(): IOptions {
return this.options; return this.options;
} }
public updateOptions(key: string, value: any): void {
let oldValue = this.options[key];
this.options[key] = value;
this.eventService.emit(EventType.WORKBENCH_OPTIONS_CHANGED, new OptionsChangeEvent(key, oldValue, value));
}
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册