Refactor: Rename settings to Preferences

This commit is contained in:
Sandeep Somavarapu 2016-11-23 22:13:56 +01:00
parent 740457e881
commit ebb58dc7e6
12 changed files with 43 additions and 45 deletions

View file

@ -26,7 +26,7 @@ import 'vs/workbench/browser/actions/toggleSidebarVisibility';
import 'vs/workbench/browser/actions/toggleSidebarPosition';
import 'vs/workbench/browser/actions/toggleEditorLayout';
import 'vs/workbench/browser/actions/toggleZenMode';
import 'vs/workbench/parts/settings/browser/openSettings.contribution';
import 'vs/workbench/parts/preferences/browser/preferences.contribution';
import 'vs/workbench/browser/actions/configureLocale';
import 'vs/workbench/parts/quickopen/browser/quickopen.contribution';

View file

@ -38,7 +38,7 @@ import { InstallVSIXAction } from 'vs/workbench/parts/extensions/electron-browse
import { IExtensionManagementService, IExtensionGalleryService, IExtensionTipsService, SortBy, SortOrder, IQueryOptions, LocalExtensionType } from 'vs/platform/extensionManagement/common/extensionManagement';
import { ExtensionsInput } from 'vs/workbench/parts/extensions/common/extensionsInput';
import { Query } from '../common/extensionQuery';
import { OpenGlobalSettingsAction } from 'vs/workbench/parts/settings/browser/openSettingsActions';
import { OpenGlobalSettingsAction } from 'vs/workbench/parts/preferences/browser/preferencesActions';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';

View file

@ -13,18 +13,18 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { DefaultSettingsEditor, DefaultSettingsInput, DefaultKeybindingsInput } from 'vs/workbench/parts/settings/browser/defaultSettingsEditors';
import { OpenGlobalSettingsAction, OpenGlobalKeybindingsAction, OpenWorkspaceSettingsAction } from 'vs/workbench/parts/settings/browser/openSettingsActions';
import { IOpenSettingsService } from 'vs/workbench/parts/settings/common/openSettings';
import { OpenSettingsService } from 'vs/workbench/parts/settings/browser/openSettingsService';
import { DefaultSettingsEditor, DefaultSettingsInput, DefaultKeybindingsInput } from 'vs/workbench/parts/preferences/browser/preferencesEditor';
import { OpenGlobalSettingsAction, OpenGlobalKeybindingsAction, OpenWorkspaceSettingsAction } from 'vs/workbench/parts/preferences/browser/preferencesActions';
import { IPreferencesService } from 'vs/workbench/parts/preferences/common/preferences';
import { PreferencesService } from 'vs/workbench/parts/preferences/browser/preferencesService';
registerSingleton(IOpenSettingsService, OpenSettingsService);
registerSingleton(IPreferencesService, PreferencesService);
(<IEditorRegistry>Registry.as(EditorExtensions.Editors)).registerEditor(
new EditorDescriptor(
DefaultSettingsEditor.ID,
nls.localize('defaultSettingsEditor', "Default Settings Editor"),
'vs/workbench/parts/settings/browser/defaultSettingsEditors',
'vs/workbench/parts/preferences/browser/preferencesEditor',
'DefaultSettingsEditor'
),
[

View file

@ -7,7 +7,7 @@
import { TPromise } from 'vs/base/common/winjs.base';
import * as nls from 'vs/nls';
import { Action } from 'vs/base/common/actions';
import { IOpenSettingsService } from 'vs/workbench/parts/settings/common/openSettings';
import { IPreferencesService } from 'vs/workbench/parts/preferences/common/preferences';
export class OpenGlobalSettingsAction extends Action {
@ -17,13 +17,13 @@ export class OpenGlobalSettingsAction extends Action {
constructor(
id: string,
label: string,
@IOpenSettingsService private openSettingsService: IOpenSettingsService
@IPreferencesService private preferencesService: IPreferencesService
) {
super(id, label);
}
public run(event?: any): TPromise<void> {
return this.openSettingsService.openGlobalSettings();
return this.preferencesService.openGlobalSettings();
}
}
@ -35,13 +35,13 @@ export class OpenGlobalKeybindingsAction extends Action {
constructor(
id: string,
label: string,
@IOpenSettingsService private openSettingsService: IOpenSettingsService
@IPreferencesService private preferencesService: IPreferencesService
) {
super(id, label);
}
public run(event?: any): TPromise<any> {
return this.openSettingsService.openGlobalKeybindingSettings();
return this.preferencesService.openGlobalKeybindingSettings();
}
}
@ -53,12 +53,12 @@ export class OpenWorkspaceSettingsAction extends Action {
constructor(
id: string,
label: string,
@IOpenSettingsService private openSettingsService: IOpenSettingsService
@IPreferencesService private preferencesService: IPreferencesService
) {
super(id, label);
}
public run(event?: any): TPromise<void> {
return this.openSettingsService.openWorkspaceSettings();
return this.preferencesService.openWorkspaceSettings();
}
}

View file

@ -21,7 +21,7 @@ import * as editorCommon from 'vs/editor/common/editorCommon';
import { StringEditor } from 'vs/workbench/browser/parts/editor/stringEditor';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IFoldingController, ID as FoldingContributionId } from 'vs/editor/contrib/folding/common/folding';
import { IOpenSettingsService, ISettingsGroup, ISetting } from 'vs/workbench/parts/settings/common/openSettings';
import { IPreferencesService, ISettingsGroup, ISetting } from 'vs/workbench/parts/preferences/common/preferences';
import { editorContribution } from 'vs/editor/browser/editorBrowserExtensions';
import { ICodeEditor, IEditorMouseEvent } from 'vs/editor/browser/editorBrowser';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
@ -57,9 +57,9 @@ export class AbstractSettingsInput extends StringEditorInput {
export class DefaultSettingsInput extends AbstractSettingsInput {
private static INSTANCE: DefaultSettingsInput;
public static getInstance(instantiationService: IInstantiationService, openSettingsService: IOpenSettingsService): DefaultSettingsInput {
public static getInstance(instantiationService: IInstantiationService, preferencesService: IPreferencesService): DefaultSettingsInput {
if (!DefaultSettingsInput.INSTANCE) {
const defaultSettings = openSettingsService.defaultSettings;
const defaultSettings = preferencesService.defaultSettings;
DefaultSettingsInput.INSTANCE = instantiationService.createInstance(DefaultSettingsInput, nls.localize('defaultName', "Default Settings"), null, defaultSettings.content, defaultSettings.uri, 'application/json', false);
}
return DefaultSettingsInput.INSTANCE;
@ -69,9 +69,9 @@ export class DefaultSettingsInput extends AbstractSettingsInput {
export class DefaultKeybindingsInput extends AbstractSettingsInput {
private static INSTANCE: DefaultKeybindingsInput;
public static getInstance(instantiationService: IInstantiationService, openSettingsService: IOpenSettingsService): DefaultKeybindingsInput {
public static getInstance(instantiationService: IInstantiationService, preferencesService: IPreferencesService): DefaultKeybindingsInput {
if (!DefaultKeybindingsInput.INSTANCE) {
const defaultKeybindings = openSettingsService.defaultKeybindings;
const defaultKeybindings = preferencesService.defaultKeybindings;
DefaultKeybindingsInput.INSTANCE = instantiationService.createInstance(DefaultKeybindingsInput, nls.localize('defaultKeybindings', "Default Keyboard Shortcuts"), null, defaultKeybindings.content, defaultKeybindings.uri, 'application/json', false);
}
@ -146,7 +146,7 @@ export class DefaultSettingsContribution extends Disposable implements editorCom
constructor(private editor: ICodeEditor,
@IInstantiationService private instantiationService: IInstantiationService,
@IOpenSettingsService private openSettingsService: IOpenSettingsService
@IPreferencesService private preferencesService: IPreferencesService
) {
super();
this._register(editor.onDidChangeModel(() => this.onModelChanged()));
@ -167,14 +167,14 @@ export class DefaultSettingsContribution extends Disposable implements editorCom
return;
}
if (model.uri.fsPath === this.openSettingsService.defaultSettings.uri.fsPath) {
if (model.uri.fsPath === this.preferencesService.defaultSettings.uri.fsPath) {
this.styleDefaultSettings(model);
}
}
private canHandle(model: editorCommon.IModel) {
if (model) {
if (model.uri.fsPath === this.openSettingsService.defaultSettings.uri.fsPath) {
if (model.uri.fsPath === this.preferencesService.defaultSettings.uri.fsPath) {
return true;
}
}
@ -187,7 +187,7 @@ export class DefaultSettingsContribution extends Disposable implements editorCom
private renderDecorations(model: editorCommon.IModel) {
this.settingsActions = this.instantiationService.createInstance(SettingsActionsDecorators, this.editor);
this.settingsActions.render(this.openSettingsService.defaultSettings.settingsGroups);
this.settingsActions.render(this.preferencesService.defaultSettings.settingsGroups);
}
}
@ -196,7 +196,7 @@ export class SettingsActionsDecorators extends Disposable {
private decorationIds: string[] = [];
constructor(private editor: ICodeEditor,
@IOpenSettingsService private settingsService: IOpenSettingsService,
@IPreferencesService private settingsService: IPreferencesService,
@IContextMenuService private contextMenuService: IContextMenuService
) {
super();

View file

@ -2,7 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/openSettings';
import 'vs/css!./media/preferences';
import { TPromise } from 'vs/base/common/winjs.base';
import * as nls from 'vs/nls';
import URI from 'vs/base/common/uri';
@ -25,13 +25,13 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import * as editorCommon from 'vs/editor/common/editorCommon';
import { IConfigurationEditingService, ConfigurationTarget, IConfigurationValue } from 'vs/workbench/services/configuration/common/configurationEditing';
import { IOpenSettingsService, IDefaultSettings, IDefaultKeybindings } from 'vs/workbench/parts/settings/common/openSettings';
import { DefaultSettings, DefaultKeybindings } from 'vs/workbench/parts/settings/common/defaultSettings';
import { IPreferencesService, IDefaultSettings, IDefaultKeybindings } from 'vs/workbench/parts/preferences/common/preferences';
import { DefaultSettings, DefaultKeybindings } from 'vs/workbench/parts/preferences/common/preferencesModels';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { ITextModelContentProvider } from 'vs/editor/common/services/resolverService';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IModeService } from 'vs/editor/common/services/modeService';
import { DefaultSettingsInput, DefaultKeybindingsInput } from 'vs/workbench/parts/settings/browser/defaultSettingsEditors';
import { DefaultSettingsInput, DefaultKeybindingsInput } from 'vs/workbench/parts/preferences/browser/preferencesEditor';
const SETTINGS_INFO_IGNORE_KEY = 'settings.workspace.info.ignore';
@ -44,7 +44,7 @@ interface IWorkbenchSettingsConfiguration {
};
}
export class OpenSettingsService extends Disposable implements IOpenSettingsService {
export class PreferencesService extends Disposable implements IPreferencesService {
_serviceBrand: any;
@ -257,7 +257,7 @@ export class OpenSettingsService extends Disposable implements IOpenSettingsServ
export class SettingsContentProvider implements ITextModelContentProvider {
constructor(
@IOpenSettingsService private openSettingsService: IOpenSettingsService,
@IPreferencesService private preferencesService: IPreferencesService,
@IModelService private modelService: IModelService,
@IModeService private modeService: IModeService
) {
@ -267,12 +267,12 @@ export class SettingsContentProvider implements ITextModelContentProvider {
if (uri.scheme !== 'vscode') {
return null;
}
const defaultSettings = this.openSettingsService.defaultSettings;
const defaultSettings = this.preferencesService.defaultSettings;
if (defaultSettings.uri.fsPath === uri.fsPath) {
let mode = this.modeService.getOrCreateMode('application/json');
return TPromise.as(this.modelService.createModel(defaultSettings.content, mode, uri));
}
const defaultKeybindings = this.openSettingsService.defaultKeybindings;
const defaultKeybindings = this.preferencesService.defaultKeybindings;
if (defaultKeybindings.uri.fsPath === uri.fsPath) {
let mode = this.modeService.getOrCreateMode('application/json');
return TPromise.as(this.modelService.createModel(defaultKeybindings.content, mode, uri));

View file

@ -33,8 +33,6 @@ export interface IDefaultSettings {
uri: URI;
content: string;
settingsGroups: ISettingsGroup[];
// filterSettings(filter: string): ISettingsGroup[];
}
export interface IDefaultKeybindings {
@ -42,9 +40,9 @@ export interface IDefaultKeybindings {
content: string;
}
export const IOpenSettingsService = createDecorator<IOpenSettingsService>('openSettingsService');
export const IPreferencesService = createDecorator<IPreferencesService>('preferencesService');
export interface IOpenSettingsService {
export interface IPreferencesService {
_serviceBrand: any;
defaultSettings: IDefaultSettings;

View file

@ -9,7 +9,7 @@ import * as strings from 'vs/base/common/strings';
import URI from 'vs/base/common/uri';
import { Registry } from 'vs/platform/platform';
import { IConfigurationNode, IConfigurationRegistry, Extensions } from 'vs/platform/configuration/common/configurationRegistry';
import { IDefaultSettings, IDefaultKeybindings, ISettingsGroup, ISetting } from 'vs/workbench/parts/settings/common/openSettings';
import { IDefaultSettings, IDefaultKeybindings, ISettingsGroup, ISetting } from 'vs/workbench/parts/preferences/common/preferences';
import { IWorkspaceConfigurationService } from 'vs/workbench/services/configuration/common/configuration';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';

View file

@ -18,7 +18,7 @@ import { SearchResult, Match, FileMatch, FileMatchOrMatch } from 'vs/workbench/p
import { IReplaceService } from 'vs/workbench/parts/search/common/replace';
import * as Constants from 'vs/workbench/parts/search/common/constants';
import { CollapseAllAction as TreeCollapseAction } from 'vs/base/parts/tree/browser/treeDefaults';
import { IOpenSettingsService } from 'vs/workbench/parts/settings/common/openSettings';
import { IPreferencesService } from 'vs/workbench/parts/preferences/common/preferences';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
@ -450,7 +450,7 @@ export class ReplaceAction extends AbstractSearchAndReplaceAction {
export class ConfigureGlobalExclusionsAction extends Action {
constructor( @IOpenSettingsService private openSettingsService: IOpenSettingsService) {
constructor( @IPreferencesService private preferencesService: IPreferencesService) {
super('configureGlobalExclusionsAction');
this.label = nls.localize('ConfigureGlobalExclusionsAction.label', "Open Settings");
@ -459,6 +459,6 @@ export class ConfigureGlobalExclusionsAction extends Action {
}
public run(): TPromise<void> {
return this.openSettingsService.openGlobalSettings().then(null, errors.onUnexpectedError);
return this.preferencesService.openGlobalSettings().then(null, errors.onUnexpectedError);
}
}

View file

@ -24,7 +24,7 @@ import { FindInput } from 'vs/base/browser/ui/findinput/findInput';
import { ITree } from 'vs/base/parts/tree/browser/tree';
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
import { Scope } from 'vs/workbench/common/memento';
import { IOpenSettingsService } from 'vs/workbench/parts/settings/common/openSettings';
import { IPreferencesService } from 'vs/workbench/parts/preferences/common/preferences';
import { IEditorGroupService } from 'vs/workbench/services/group/common/groupService';
import { getOutOfWorkspaceEditorResources } from 'vs/workbench/common/editor';
import { FileChangeType, FileChangesEvent, EventType as FileEventType } from 'vs/platform/files/common/files';
@ -104,7 +104,7 @@ export class SearchViewlet extends Viewlet {
@IKeybindingService private keybindingService: IKeybindingService,
@IReplaceService private replaceService: IReplaceService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IOpenSettingsService private openSettingsService: IOpenSettingsService
@IPreferencesService private preferencesService: IPreferencesService
) {
super(Constants.VIEWLET_ID, telemetryService);
@ -878,7 +878,7 @@ export class SearchViewlet extends Viewlet {
}).on(dom.EventType.CLICK, (e: MouseEvent) => {
dom.EventHelper.stop(e, false);
this.openSettingsService.openWorkspaceSettings().done(() => null, errors.onUnexpectedError);
this.preferencesService.openWorkspaceSettings().done(() => null, errors.onUnexpectedError);
});
}
} else {

View file

@ -26,7 +26,7 @@ import { ShowAllCommandsAction } from 'vs/workbench/parts/quickopen/browser/comm
import { Parts, IPartService } from 'vs/workbench/services/part/common/partService';
import { StartAction } from 'vs/workbench/parts/debug/browser/debugActions';
import { FindInFilesActionId } from 'vs/workbench/parts/search/common/constants';
import { OpenGlobalKeybindingsAction } from 'vs/workbench/parts/settings/browser/openSettingsActions';
import { OpenGlobalKeybindingsAction } from 'vs/workbench/parts/preferences/browser/preferencesActions';
import { ToggleTerminalAction } from 'vs/workbench/parts/terminal/electron-browser/terminalActions';
import { SelectColorThemeAction } from 'vs/workbench/parts/themes/electron-browser/themes.contribution';