Skip to content

Commit 7e52589

Browse files
authored
1 parent 5b310b5 commit 7e52589

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,7 @@ class ProfileNameRenderer extends ProfilePropertyRenderer {
847847

848848
constructor(
849849
@IUserDataProfilesService private readonly userDataProfilesService: IUserDataProfilesService,
850+
@IContextViewService private readonly contextViewService: IContextViewService,
850851
) {
851852
super();
852853
}
@@ -860,7 +861,7 @@ class ProfileNameRenderer extends ProfilePropertyRenderer {
860861
append(nameContainer, $('.profile-label-element', undefined, localize('name', "Name")));
861862
const nameInput = new InputBox(
862863
nameContainer,
863-
undefined,
864+
this.contextViewService,
864865
{
865866
inputBoxStyles: getInputBoxStyle({
866867
inputBorder: settingsTextInputBorder
@@ -872,12 +873,15 @@ class ProfileNameRenderer extends ProfilePropertyRenderer {
872873
if (!value) {
873874
return {
874875
content: localize('name required', "Profile name is required and must be a non-empty value."),
875-
type: MessageType.ERROR
876+
type: MessageType.WARNING
876877
};
877878
}
878879
if (profileElement?.root.disabled) {
879880
return null;
880881
}
882+
if (!profileElement?.root.shouldValidateName()) {
883+
return null;
884+
}
881885
const initialName = profileElement?.root.getInitialName();
882886
value = value.trim();
883887
if (initialName !== value && this.userDataProfilesService.profiles.some(p => p.name === value)) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export abstract class AbstractUserDataProfileElement extends Disposable {
175175

176176
validate(): void {
177177
if (!this.name) {
178-
this.message = localize('profileNameRequired', "Profile name is required.");
178+
this.message = localize('name required', "Profile name is required and must be a non-empty value.");
179179
return;
180180
}
181181
if (this.shouldValidateName() && this.name !== this.getInitialName() && this.userDataProfilesService.profiles.some(p => p.name === this.name)) {
@@ -884,7 +884,7 @@ export class UserDataProfilesEditorModel extends EditorModel {
884884
if (e.disabled || e.message) {
885885
previewProfileAction.enabled = createAction.enabled = !this.newProfileElement?.disabled && !this.newProfileElement?.message;
886886
}
887-
if (e.name) {
887+
if (e.name || e.copyFrom) {
888888
if (this.newProfileElement?.copyFrom && this.userDataProfilesService.profiles.some(p => p.name === this.newProfileElement?.name)) {
889889
createAction.label = localize('replace', "Replace");
890890
} else {

0 commit comments

Comments
 (0)