Skip to content

Commit 359a67e

Browse files
authored
1 parent 8697f84 commit 359a67e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { ThemeIcon } from 'vs/platform/theme/common/themeService';
2727
import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
2828
import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
2929
import { joinPath } from 'vs/base/common/resources';
30+
import { Codicon } from 'vs/base/common/codicons';
3031

3132
export class UserDataProfilesWorkbenchContribution extends Disposable implements IWorkbenchContribution {
3233

@@ -188,7 +189,17 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
188189
value: that.userDataProfileService.getShortName(profile),
189190
title: localize('change short name', "Change Short Name..."),
190191
validateInput: async (value: string) => {
191-
if (profile.shortName !== value && !ThemeIcon.fromString(value) && charCount(value) > 2) {
192+
if (profile.shortName === value) {
193+
return undefined;
194+
}
195+
const themeIcon = ThemeIcon.fromString(value);
196+
if (themeIcon) {
197+
if (Codicon.getAll().some(c => c.id === themeIcon.id)) {
198+
return undefined;
199+
}
200+
return localize('invalid codicon', "Invalid codicon. Please use a valid codicon id.");
201+
}
202+
if (charCount(value) > 2) {
192203
return localize('invalid short name', "Short name should be at most 2 characters long.");
193204
}
194205
return undefined;

0 commit comments

Comments
 (0)