Skip to content

Commit da26298

Browse files
committed
Bugfix for not showing badge/tooltip from parents
1 parent 3979eac commit da26298

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
> Nothing at the moment
1111
12+
## 0.1.2 - (2024-08-10)
13+
14+
- Bugfix: Fixed issue where badge/tooltip are not shown from parent folders
15+
1216
## 0.1.1 - (2024-08-09)
1317

1418
- Updated README, better documentation

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Folder Customization",
44
"publisher": "j3lte",
55
"description": "Customize your folder and subfolders based on a specific path. Set a color, text badge, emoji badge or tooltip for any folder in your workspace.",
6-
"version": "0.1.1",
6+
"version": "0.1.2",
77
"license": "MIT",
88
"icon": "resources/images/icon.png",
99
"galleryBanner": {

src/tools/folder-customization-provider.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,21 @@ export class FolderCustomizationProvider implements FileDecorationProvider {
8484
.sort((a, b) => b.path.length - a.path.length);
8585

8686
const firstMatchWithColor = matchFolders.find((folder) => folder.color);
87+
const firstMatchWithBadge = matchFolders.find((folder) => folder.badge);
88+
const firstMatchWithTooltip = matchFolders.find((folder) => folder.tooltip);
89+
8790
const firstMatch = matchFolders[0];
8891

8992
if (firstMatch) {
90-
// We find the color from the first match with a color
9193
const color = firstMatch.color && !isUriChanged ? firstMatch.color : undefined;
92-
// We might have a color up the tree (parent)
93-
const possibleColor = firstMatchWithColor?.color;
94-
// We set the color to either the first match or the possible color, if the uri has not changed (git)
95-
const fileDecorationColor = !isUriChanged ? color || possibleColor : undefined;
94+
const fileDecorationColor = !isUriChanged ? color || firstMatchWithColor?.color : undefined;
9695
const themeColor = fileDecorationColor ? new ThemeColor(fileDecorationColor) : undefined;
97-
return new FileDecoration(firstMatch.badge, firstMatch.tooltip, themeColor);
96+
97+
return new FileDecoration(
98+
firstMatch.badge || firstMatchWithBadge?.badge,
99+
firstMatch.tooltip || firstMatchWithTooltip?.tooltip,
100+
themeColor,
101+
);
98102
}
99103

100104
return undefined;

0 commit comments

Comments
 (0)