Add comment programmatically && set the comment highlighted with different color

So far, I am able to add comment like this 

PsiComment comment = JavaPsiFacade.getElementFactory(project).createCommentFromText("/*aa*/", null);

//Have to write the comment via writeCommand
WriteCommandAction.runWriteCommandAction(project, new Runnable() {
public void run() {

Now I want to do something fancy, I want to do something like comment.setBackgroundColor()....

What API should I use?

1 comment

There is no any API for setting a background for individual PSI elements. Colors are set only for groups of elements of a certain type, for example, block comments.


Please sign in to leave a comment.