提交 d7c48a2f 编写于 作者: B Benjamin Pasero

fix default keybindings appearance

上级 672315c0
......@@ -163,7 +163,17 @@ 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.defaultKeybindingsResource, URI.file(this.environmentService.appKeybindingsPath), emptyContents).then(() => null);
const editableKeybindings = URI.file(this.environmentService.appKeybindingsPath);
// Create as needed and open in editor
return this.createIfNotExists(editableKeybindings, emptyContents).then(() => {
return this.editorService.openEditors([
{ input: { resource: this.defaultKeybindingsResource, options: { pinned: true }, label: nls.localize('defaultKeybindings', "Default Keybindings"), description: '' }, position: Position.ONE },
{ input: { resource: editableKeybindings, options: { pinned: true } }, position: Position.TWO },
]).then(() => {
this.editorGroupService.focusGroup(Position.TWO);
});
});
}
private doOpenSettings(configurationTarget: ConfigurationTarget, checkToOpenDefaultSettings: boolean = true): TPromise<void> {
......@@ -222,18 +232,6 @@ export class PreferencesService extends Disposable implements IPreferencesServic
return null;
}
private openTwoEditors(leftHandDefault: URI, editableResource: URI, defaultEditableContents: string): TPromise<void> {
// Create as needed and open in editor
return this.createIfNotExists(editableResource, defaultEditableContents).then(() => {
return this.editorService.openEditors([
{ input: { resource: leftHandDefault, options: { pinned: true } }, position: Position.ONE },
{ input: { resource: editableResource, options: { pinned: true } }, position: Position.TWO },
]).then(() => {
this.editorGroupService.focusGroup(Position.TWO);
});
});
}
private createIfNotExists(resource: URI, contents: string): TPromise<boolean> {
return this.fileService.resolveContent(resource, { acceptTextOnly: true }).then(null, error => {
if ((<IFileOperationResult>error).fileOperationResult === FileOperationResult.FILE_NOT_FOUND) {
......
......@@ -210,7 +210,7 @@ export class WorkbenchEditorService implements IWorkbenchEditorService {
if (resourceSideBySideInput.masterResource && resourceSideBySideInput.detailResource) {
return this.createInput({ resource: resourceSideBySideInput.masterResource }).then(masterInput => {
return this.createInput({ resource: resourceSideBySideInput.detailResource }).then(detailInput => {
return new SideBySideEditorInput(resourceSideBySideInput.label || masterInput.getName(), resourceSideBySideInput.description || masterInput.getDescription(), detailInput, masterInput);
return new SideBySideEditorInput(resourceSideBySideInput.label || masterInput.getName(), typeof resourceSideBySideInput.description === 'string' ? resourceSideBySideInput.description : masterInput.getDescription(), detailInput, masterInput);
});
});
}
......@@ -245,7 +245,7 @@ export class WorkbenchEditorService implements IWorkbenchEditorService {
return TPromise.as(this.instantiationService.createInstance(
ResourceEditorInput,
resourceInput.label || basename(resourceInput.resource.fsPath),
resourceInput.description || dirname(resourceInput.resource.fsPath),
typeof resourceInput.description === 'string' ? resourceInput.description : dirname(resourceInput.resource.fsPath),
resourceInput.resource
));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册