static TemplateStateBase clearTemplateState(@NotNull Editor editor) {
    TemplateStateBase prevState = getTemplateState(editor);
    if (prevState != null) {
      Editor stateEditor = prevState.getEditor();
      if (stateEditor != null) {
        setTemplateState(stateEditor, null);
      }
    }
    return prevState;
  }
static TemplateStateBase clearTemplateState(@NotNull Editor editor)