private static boolean isInCasePattern(@NotNull Editor editor, ShSemanticEditorPosition position) {
    CharSequence docChars = editor.getDocument().getCharsSequence();
    int lineStart = CharArrayUtil.shiftBackwardUntil(docChars, position.getStartOffset(), "\n") + 1;
    if (lineStart >= 0) {
      ShSemanticEditorPosition possiblePatternPosition = getPosition(editor, lineStart);
      possiblePatternPosition.moveAfterOptionalMix(ShTokenTypes.WHITESPACE);
      possiblePatternPosition.moveAfterOptionalMix(ShTypes.WORD);
      possiblePatternPosition.moveAfterOptionalMix(ShTokenTypes.WHITESPACE);
      return possiblePatternPosition.isAt(ShTypes.RIGHT_PAREN);
    }
    return false;
  }
private static boolean isInCasePattern(@NotNull Editor editor, ShSemanticEditorPosition position)