Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #49790 from usernamehw/raw_settings
Browse files Browse the repository at this point in the history
Add command to open raw user settings.json
  • Loading branch information
roblourens authored May 14, 2018
2 parents fc710af + c81dfe7 commit f92a162
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/vs/workbench/parts/preferences/browser/preferencesActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@ export class OpenRawDefaultSettingsAction extends Action {
}
}

export class OpenRawUserSettingsAction extends Action {

public static readonly ID = 'workbench.action.openRawUserSettings';
public static readonly LABEL = nls.localize('openRawUserSettings', "Open Raw Global User Settings");

constructor(
id: string,
label: string,
@IPreferencesService private preferencesService: IPreferencesService
) {
super(id, label);
}

public run(event?: any): TPromise<any> {
return this.preferencesService.openRawUserSettings();
}
}

export class OpenSettings2Action extends Action {

public static readonly ID = 'workbench.action.openSettings2';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { PreferencesEditor } from 'vs/workbench/parts/preferences/browser/prefer
import { SettingsEditor2 } from 'vs/workbench/parts/preferences/browser/settingsEditor2';
import { DefaultPreferencesEditorInput, PreferencesEditorInput, KeybindingsEditorInput, SettingsEditor2Input } from 'vs/workbench/services/preferences/common/preferencesEditorInput';
import { KeybindingsEditor } from 'vs/workbench/parts/preferences/browser/keybindingsEditor';
import { OpenRawDefaultSettingsAction, OpenSettingsAction, OpenGlobalSettingsAction, OpenGlobalKeybindingsFileAction, OpenWorkspaceSettingsAction, OpenFolderSettingsAction, ConfigureLanguageBasedSettingsAction, OPEN_FOLDER_SETTINGS_COMMAND, OpenGlobalKeybindingsAction, OpenSettings2Action } from 'vs/workbench/parts/preferences/browser/preferencesActions';
import { OpenRawDefaultSettingsAction, OpenSettingsAction, OpenGlobalSettingsAction, OpenGlobalKeybindingsFileAction, OpenWorkspaceSettingsAction, OpenFolderSettingsAction, ConfigureLanguageBasedSettingsAction, OPEN_FOLDER_SETTINGS_COMMAND, OpenGlobalKeybindingsAction, OpenSettings2Action, OpenRawUserSettingsAction } from 'vs/workbench/parts/preferences/browser/preferencesActions';
import {
IKeybindingsEditor, IPreferencesSearchService, CONTEXT_KEYBINDING_FOCUS, CONTEXT_KEYBINDINGS_EDITOR, CONTEXT_KEYBINDINGS_SEARCH_FOCUS, KEYBINDINGS_EDITOR_COMMAND_DEFINE, KEYBINDINGS_EDITOR_COMMAND_REMOVE, KEYBINDINGS_EDITOR_COMMAND_SEARCH,
KEYBINDINGS_EDITOR_COMMAND_COPY, KEYBINDINGS_EDITOR_COMMAND_RESET, KEYBINDINGS_EDITOR_COMMAND_COPY_COMMAND, KEYBINDINGS_EDITOR_COMMAND_SHOW_SIMILAR, KEYBINDINGS_EDITOR_COMMAND_FOCUS_KEYBINDINGS, KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS
Expand Down Expand Up @@ -190,6 +190,7 @@ Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactor
const category = nls.localize('preferences', "Preferences");
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenRawDefaultSettingsAction, OpenRawDefaultSettingsAction.ID, OpenRawDefaultSettingsAction.LABEL), 'Preferences: Open Raw Default Settings', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenRawUserSettingsAction, OpenRawUserSettingsAction.ID, OpenRawUserSettingsAction.LABEL), 'Preferences: Open Raw User Settings', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettingsAction, OpenSettingsAction.ID, OpenSettingsAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.US_COMMA }), 'Preferences: Open Settings', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenSettings2Action, OpenSettings2Action.ID, OpenSettings2Action.LABEL), 'Preferences: Open Settings (Experimental)', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(OpenGlobalSettingsAction, OpenGlobalSettingsAction.ID, OpenGlobalSettingsAction.LABEL), 'Preferences: Open User Settings', category);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ export class PreferencesService extends Disposable implements IPreferencesServic
return this.editorService.openEditor({ resource: this.defaultSettingsRawResource }, EditorPosition.ONE) as TPromise<any>;
}

openRawUserSettings(): TPromise<void> {
return this.editorService.openEditor({ resource: this.userSettingsResource }) as TPromise<any>;
}

openSettings(): TPromise<IEditor> {
const editorInput = this.getActiveSettingsEditorInput() || this.lastOpenedSettingsInput;
const resource = editorInput ? editorInput.master.getResource() : this.userSettingsResource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export interface IPreferencesService {
createPreferencesEditorModel<T>(uri: URI): TPromise<IPreferencesEditorModel<T>>;

openRawDefaultSettings(): TPromise<void>;
openRawUserSettings(): TPromise<void>;
openSettings(): TPromise<IEditor>;
openSettings2(): TPromise<IEditor>;
openGlobalSettings(options?: IEditorOptions, position?: Position): TPromise<IEditor>;
Expand Down

0 comments on commit f92a162

Please sign in to comment.