eclipse / lsp4e

Language Server Protocol support in Eclipse IDE
Eclipse Public License 2.0
60 stars 53 forks source link

Inline type hints are missing spacing #981

Closed sebthom closed 3 months ago

sebthom commented 3 months ago

Currently inline type hints are rendered as follows missing any spacing to the variable name: image

Which esp. in line 17 becomes difficult to read. In the Java Editor inline hints are suffixed with a white space. If LSP4e behaves like this, the same code would look like this:

image

Responsible for inline type hints is org.eclipse.lsp4e.operations.inlayhint.LSPLineContentCodeMining

If I override the LineContentCodeMining#setLabel method and add a whitespace to the end of the label, I get the desired effect:

@Override
public void setLabel(String label) {
  if (label != null && !label.isEmpty() && !Character.isWhitespace(label.charAt(label.length() - 1)))
    label += " ";
  super.setLabel(label);
}

@mickaelistria @rubenporras Is this an adequate way to address this issue?