扩展接口
ICompletionProposalExtension6
支持样式化显示字符串。唯一的方法
getStyledDisplayString()
必须返回
StyledString
用于显示的。
而不是创建
CompletionProposal
你得自己动手
ICompletionProposal
它还实现了上述扩展。例如:
class StyledCompletionProposal
implements ICompletionProposal, ICompletionProposalExtension6
{
...
@Override
public StyledString getStyledDisplayString() {
return new StyledString("test").append(" [10%]", Styler.QUALIFIER_STYLER);
}
}
此外,内容助手必须配置为启用
彩色标签
是的。对于编辑来说,这通常是在
SourceViewerConfiguration::getContentAssistant
以下内容:
ContentAssistant contentAssistant = new ContentAssistant();
contentAssistant.enableColoredLabels(true);