pull/33510/head
Sandeep Somavarapu 2017-08-29 17:04:21 +02:00
parent e798d86fe8
commit 30b47ba11c
2 changed files with 13 additions and 3 deletions

View File

@ -209,7 +209,7 @@ export class PreferencesEditor extends BaseEditor {
private updateInput(oldInput: PreferencesEditorInput, newInput: PreferencesEditorInput, options?: EditorOptions): TPromise<void> {
const resource = toResource(newInput.master);
this.settingsTargetsWidget.setTarget(resource, this.getSettingsConfigurationTarget(resource));
this.settingsTargetsWidget.setTarget(this.getSettingsConfigurationTargetUri(resource), this.getSettingsConfigurationTarget(resource));
return this.sideBySidePreferencesWidget.setInput(<DefaultPreferencesEditorInput>newInput.details, <EditorInput>newInput.master, options).then(({ defaultPreferencesRenderer, editablePreferencesRenderer }) => {
this.preferencesRenderers.defaultPreferencesRenderer = defaultPreferencesRenderer;
@ -231,6 +231,17 @@ export class PreferencesEditor extends BaseEditor {
return null;
}
private getSettingsConfigurationTargetUri(resource: URI): URI {
if (this.preferencesService.userSettingsResource.fsPath === resource.fsPath) {
return resource;
}
if (this.preferencesService.workspaceSettingsResource.fsPath === resource.fsPath) {
return resource;
}
return this.workspaceContextService.getRoot(resource);
}
private switchSettings(resource: URI): void {
// Focus the editor if this editor is not active editor
if (this.editorService.getActiveEditor() !== this) {

View File

@ -349,13 +349,12 @@ export class SettingsTargetsWidget extends Widget {
}
if (this.workspaceContextService.hasMultiFolderWorkspace()) {
const currentRoot = this.uri instanceof URI ? this.workspaceContextService.getRoot(this.uri) : null;
actions.push(new Separator());
actions.push(...this.workspaceContextService.getWorkspace().roots.map((root, index) => {
return <IAction>{
id: 'folderSettingsTarget' + index,
label: getSettingsTargetName(ConfigurationTarget.FOLDER, root, this.workspaceContextService),
checked: currentRoot && currentRoot.fsPath === root.fsPath,
checked: this.uri.fsPath === root.fsPath,
enabled: true,
run: () => this.onTargetClicked(root)
};