Skip to content

Commit

Permalink
Respect inlayhint padding (#1089)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: rubenporras <43636626+rubenporras@users.noreply.github.com>
  • Loading branch information
BoykoAlex and rubenporras authored Aug 29, 2024
1 parent 7ac6cfc commit d4be7b8
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,19 @@ public LSPLineContentCodeMining(InlayHint inlayHint, IDocument document,

@Override
public void setLabel(final @Nullable String label) {
if (label == null || label.isEmpty() || Character.isWhitespace(label.charAt(label.length() - 1)))
if (label == null) {
super.setLabel(label);
else
super.setLabel(label + " "); //$NON-NLS-1$
} else {
StringBuilder sb = new StringBuilder();
if (Boolean.TRUE.equals(inlayHint.getPaddingLeft())) {
sb.append(' ');
}
sb.append(label);
if (Boolean.TRUE.equals(inlayHint.getPaddingRight())) {
sb.append(' ');
}
super.setLabel(sb.toString());
}
}

protected static @Nullable String getInlayHintString(InlayHint inlayHint) {
Expand Down

0 comments on commit d4be7b8

Please sign in to comment.