Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect inlayhint padding #1089

Merged
merged 5 commits into from
Aug 29, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()) {
BoykoAlex marked this conversation as resolved.
Show resolved Hide resolved
sb.append(' ');
}
sb.append(label);
if (Boolean.TRUE.equals(inlayHint.getPaddingRight()) {
BoykoAlex marked this conversation as resolved.
Show resolved Hide resolved
sb.append(' ');
}
super.setLabel(sb.toString());
}
}

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