private static @NotNull String computeCompletionPrefix(CompletionParameters parameters) {
      PsiElement position = parameters.getPosition();
      String textWithInsertedPart = parameters.getPosition().getText();
      int positionInRange = parameters.getOffset() - position.getTextRange().getStartOffset();
      if (positionInRange < 0) {
        positionInRange = 0;
      }
      else if (positionInRange > textWithInsertedPart.length()) {
        positionInRange = textWithInsertedPart.length();
      }

      boolean startsWithQuote = YAMLElementTypes.SCALAR_QUOTED_STRING.equals(position.getParent().getNode().getElementType());
      return textWithInsertedPart.substring(startsWithQuote ? "'".length() : 0, positionInRange);
    }
private static @NotNull String computeCompletionPrefix(CompletionParameters parameters)