提交 2e77e6c9 编写于 作者: S Sandeep Somavarapu

Do not use new preferences editor for default keybindings

上级 60fc1aa4
......@@ -11,7 +11,8 @@ import { LinkedMap as Map } from 'vs/base/common/map';
import * as labels from 'vs/base/common/labels';
import { Disposable } from 'vs/base/common/lifecycle';
import { parseTree, findNodeAtLocation } from 'vs/base/common/json';
import { asFileEditorInput } from 'vs/workbench/common/editor';
import { asFileEditorInput, EditorInput } from 'vs/workbench/common/editor';
import { StringEditorInput } from 'vs/workbench/common/editor/stringEditorInput';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceConfigurationService, WORKSPACE_CONFIG_DEFAULT_PATH } from 'vs/workbench/services/configuration/common/configuration';
......@@ -28,10 +29,9 @@ import { IConfigurationEditingService, ConfigurationTarget, IConfigurationValue
import { IPreferencesService, IPreferencesEditorModel } from 'vs/workbench/parts/preferences/common/preferences';
import { SettingsEditorModel, DefaultSettingsEditorModel, DefaultKeybindingsEditorModel } from 'vs/workbench/parts/preferences/common/preferencesModels';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { PreferencesEditorInput } from 'vs/workbench/parts/preferences/browser/preferencesEditor';
import { DefaultPreferencesEditorInput } from 'vs/workbench/parts/preferences/browser/preferencesEditor';
import { ITextModelResolverService } from 'vs/editor/common/services/resolverService';
const SETTINGS_INFO_IGNORE_KEY = 'settings.workspace.info.ignore';
interface IWorkbenchSettingsConfiguration {
......@@ -136,7 +136,11 @@ export class PreferencesService extends Disposable implements IPreferencesServic
openGlobalKeybindingSettings(): TPromise<void> {
const emptyContents = '// ' + nls.localize('emptyKeybindingsHeader', "Place your key bindings in this file to overwrite the defaults") + '\n[\n]';
return this.openTwoEditors(this.instantiationService.createInstance(PreferencesEditorInput, PreferencesService.DEFAULT_KEY_BINDINGS_URI, false), URI.file(this.environmentService.appKeybindingsPath), emptyContents).then(() => null);
return this.createDefaultPreferencesEditorModel(PreferencesService.DEFAULT_KEY_BINDINGS_URI)
.then(editorModel => {
const defaultKeybindingsInput = this.instantiationService.createInstance(StringEditorInput, nls.localize('keybindingsEditorName', "Default Keyboard Shortcuts"), '', editorModel.content, 'json', true);
this.openTwoEditors(defaultKeybindingsInput, URI.file(this.environmentService.appKeybindingsPath), emptyContents);
});
}
private openEditableSettings(configurationTarget: ConfigurationTarget, showVisibleEditor: boolean = false): TPromise<IEditor> {
......@@ -237,12 +241,12 @@ export class PreferencesService extends Disposable implements IPreferencesServic
if (openDefaultSettings) {
const emptySettingsContents = this.getEmptyEditableSettingsContent(configurationTarget);
const settingsResource = this.getEditableSettingsURI(configurationTarget);
return this.openTwoEditors(this.instantiationService.createInstance(PreferencesEditorInput, PreferencesService.DEFAULT_SETTINGS_URI, true), settingsResource, emptySettingsContents).then(() => null);
return this.openTwoEditors(this.instantiationService.createInstance(DefaultPreferencesEditorInput, PreferencesService.DEFAULT_SETTINGS_URI, true), settingsResource, emptySettingsContents).then(() => null);
}
return this.openEditableSettings(configurationTarget).then(() => null);
}
private openTwoEditors(leftHandDefaultInput: PreferencesEditorInput, editableResource: URI, defaultEditableContents: string): TPromise<IEditor[]> {
private openTwoEditors(leftHandDefaultInput: EditorInput, editableResource: URI, defaultEditableContents: string): TPromise<IEditor[]> {
// Create as needed and open in editor
return this.createIfNotExists(editableResource, defaultEditableContents).then(() => {
return this.editorService.createInput({ resource: editableResource }).then(typedRightHandEditableInput => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册