private void highlightTemplateVariables(@NotNull Template template) {
    if (myHighlighters != null) { // can be null if finish is called during testing
      Map<TextRange, TextAttributes> rangesToHighlight = new HashMap<>();
      TemplateState templateState = TemplateManagerImpl.getTemplateState(myEditor);
      if (templateState != null) {
        EditorColorsManager colorsManager = EditorColorsManager.getInstance();
        for (int i = 0; i < templateState.getSegmentsCount(); i++) {
          TextRange segmentOffset = templateState.getSegmentRange(i);
          TextAttributes attributes = getAttributes(colorsManager, template.getSegmentName(i));
          if (attributes != null) {
            rangesToHighlight.put(segmentOffset, attributes);
          }
        }
      }
      addHighlights(rangesToHighlight, myHighlighters);
    }
  }
private void highlightTemplateVariables(@NotNull Template template)