Color picker for string token

已回答

How create ColorPicker in my custom language string token? ElementColorProvider return only one color, but string can contain any number of colors.

s = “#ff00ff one #ffaaff two…” 

1

Hi,

Try the annotator approach:
https://github.com/JetBrains/intellij-community/blob/master/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/refs/JavaFxAnnotator.java#L115-L178

It annotates each color occurrence with a silent annotation that adds a gutter icon with the color picker.

1

Strings can contain very many colors. In your example, it is not clear what part of the string is given a color in the chooseColor method.

0

You should compute ranges of colors and add an annotation for each range with com.intellij.lang.annotation.AnnotationBuilder#range(com.intellij.openapi.util.TextRange).

1

When there are many colors in one line, it is not clear which icon is responsible for which color. The ideal solution would be to add an icon to the row. As it is implemented in VSCode.

0

I think this might already be possible - doesn't the debugger do this for its inline breakpoints?

0

Looks like com.intellij.xdebugger.impl.breakpoints.InlineBreakpointInlayRenderer/Manager, but it doesn't look easy to extend right now.

0

请先登录再写评论。