Skip to content

Commit b313a17

Browse files
authored
1 parent 77323c8 commit b313a17

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ class ProfileNameRenderer extends ProfilePropertyRenderer {
859859

860860
const nameContainer = append(parent, $('.profile-row-container'));
861861
append(nameContainer, $('.profile-label-element', undefined, localize('name', "Name")));
862-
const nameInput = new InputBox(
862+
const nameInput = disposables.add(new InputBox(
863863
nameContainer,
864864
this.contextViewService,
865865
{
@@ -894,7 +894,8 @@ class ProfileNameRenderer extends ProfilePropertyRenderer {
894894
}
895895
}
896896
}
897-
);
897+
));
898+
disposables.add(this.userDataProfilesService.onDidChangeProfiles(() => nameInput.validate()));
898899
nameInput.onDidChange(value => {
899900
if (profileElement && value) {
900901
profileElement.root.name = value;

src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -883,11 +883,14 @@ export class UserDataProfilesEditorModel extends EditorModel {
883883
[[createAction], [cancelAction, previewProfileAction]],
884884
[[cancelAction], []],
885885
));
886-
if (this.newProfileElement?.copyFrom && this.userDataProfilesService.profiles.some(p => p.name === this.newProfileElement?.name)) {
887-
createAction.label = localize('replace', "Replace");
888-
} else {
889-
createAction.label = localize('create', "Create");
890-
}
886+
const updateCreateActionLabel = () => {
887+
if (this.newProfileElement?.copyFrom && this.userDataProfilesService.profiles.some(p => p.name === this.newProfileElement?.name)) {
888+
createAction.label = localize('replace', "Replace");
889+
} else {
890+
createAction.label = localize('create', "Create");
891+
}
892+
};
893+
updateCreateActionLabel();
891894
disposables.add(this.newProfileElement.onDidChange(e => {
892895
if (e.preview) {
893896
previewProfileAction.checked = !!this.newProfileElement?.previewProfile;
@@ -896,13 +899,13 @@ export class UserDataProfilesEditorModel extends EditorModel {
896899
previewProfileAction.enabled = createAction.enabled = !this.newProfileElement?.disabled && !this.newProfileElement?.message;
897900
}
898901
if (e.name || e.copyFrom) {
899-
if (this.newProfileElement?.copyFrom && this.userDataProfilesService.profiles.some(p => p.name === this.newProfileElement?.name)) {
900-
createAction.label = localize('replace', "Replace");
901-
} else {
902-
createAction.label = localize('create', "Create");
903-
}
902+
updateCreateActionLabel();
904903
}
905904
}));
905+
disposables.add(this.userDataProfilesService.onDidChangeProfiles((e) => {
906+
updateCreateActionLabel();
907+
this.newProfileElement?.validate();
908+
}));
906909
this._profiles.push([this.newProfileElement, disposables]);
907910
this._onDidChange.fire(this.newProfileElement);
908911
}

0 commit comments

Comments
 (0)