diff --git a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/inlayhint/LSPLineContentCodeMining.java b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/inlayhint/LSPLineContentCodeMining.java index a5f4490e0..eff8ada15 100644 --- a/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/inlayhint/LSPLineContentCodeMining.java +++ b/org.eclipse.lsp4e/src/org/eclipse/lsp4e/operations/inlayhint/LSPLineContentCodeMining.java @@ -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) {