public static TemplateStateBase getTemplateState(@NotNull Editor editor) {
    UserDataHolder stateHolder = InjectedLanguageEditorUtil.getTopLevelEditor(editor);
    TemplateStateBase templateState = stateHolder.getUserData(TEMPLATE_STATE_KEY);
    if (templateState != null && templateState.isDisposed()) {
      setTemplateState(stateHolder, null);
      return null;
    }
    return templateState;
  }
public static TemplateStateBase getTemplateState(@NotNull Editor editor)