Skip to content

Commit

Permalink
fix: transformLabelWithCodicon white space (#2600)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricbet authored Apr 18, 2023
1 parent 33b63b0 commit f4f1b85
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/core-browser/src/utils/label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export function transformLabelWithCodicon(
const generateIconStyle = (icon?: string, styleProps?: CSSProperties | string) =>
typeof styleProps === 'string' ? { className: clx(icon, styleProps) } : { className: icon, style: styleProps };

return label.split(SEPERATOR).map((e, index) => {
const splitLabel = label.split(SEPERATOR);
const length = splitLabel.length;

return splitLabel.map((e, index) => {
if (!transformer) {
return e;
}
Expand All @@ -45,7 +48,12 @@ export function transformLabelWithCodicon(
} else if (ICON_ERROR_REGX.test(e)) {
return transformLabelWithCodicon(e.replaceAll(ICON_ERROR_REGX, ''), iconStyleProps, transformer, renderText);
} else {
return isFunction(renderText) ? renderText(e, index) : <span key={`${index}-${e}`}>{e}</span>;
const withSeperator = e + (index === length - 1 ? '' : SEPERATOR);
return isFunction(renderText) ? (
renderText(withSeperator, index)
) : (
<span key={`${index}-${e}`}>{withSeperator}</span>
);
}
});
}
1 change: 1 addition & 0 deletions packages/status-bar/src/browser/status-bar.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
.popover_item {
display: flex;
align-items: center;
white-space: pre;
}

.popover_content,
Expand Down

0 comments on commit f4f1b85

Please sign in to comment.