Prevent duplicate text in workspace folder picker when path has no parent (fix #183418) (#183427)

* Prevent duplicate text in workspace folder picker when path has no parent (fix #183418)

* Instead, blank description when it matched label

* Set `description` undefined when same as `label`
This commit is contained in:
John Murray 2023-05-26 07:31:26 +01:00 committed by GitHub
parent 2dfb838f49
commit fb335eb1a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,9 +117,12 @@ CommandsRegistry.registerCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, async functio
}
const folderPicks: IQuickPickItem[] = folders.map(folder => {
const label = folder.name;
const description = labelService.getUriLabel(dirname(folder.uri), { relative: true });
return {
label: folder.name,
description: labelService.getUriLabel(dirname(folder.uri), { relative: true }),
label,
description: description !== label ? description : undefined, // https://github.com/microsoft/vscode/issues/183418
folder,
iconClasses: getIconClasses(modelService, languageService, folder.uri, FileKind.ROOT_FOLDER)
};