public static String getPrefix(int offset, PsiFile file) {
    if (offset > 0) {
      offset--;
    }
    final String text = file.getText();
    StringBuilder prefixBuilder = new StringBuilder();
    while(offset > 0) {
      final PsiElement element = file.findElementAt(offset);
      if (element != null && element.getNode().getElementType() == RestTokenTypes.EXPLISIT_MARKUP_START)
        break;
      final char charAt = text.charAt(offset);
      prefixBuilder.insert(0, charAt);
      if (charAt == '_' || charAt == '[' || charAt == '|' || charAt == '\n') {
        break;
      }
      offset--;
    }
    return prefixBuilder.toString();
  }
public static String getPrefix(int offset, PsiFile file)