@Override
    protected void addCompletions(
        @NotNull CompletionParameters parameters,
        ProcessingContext context,
        @NotNull CompletionResultSet result) {

      for (String[] completion :
          RegExpLanguageHosts.getInstance().getPosixCharacterClasses(parameters.getPosition())) {
        result.addElement(
            LookupElementBuilder.create(completion[0])
                .withTypeText((completion.length > 1) ? completion[1] : null)
                .withIcon(emptyIcon)
                .withInsertHandler(
                    new InsertHandler<LookupElement>() {
                      @Override
                      public void handleInsert(InsertionContext context, LookupElement item) {
                        context.setAddCompletionChar(false);
                        final Editor editor = context.getEditor();
                        final Document document = editor.getDocument();
                        final int tailOffset = context.getTailOffset();
                        if (document.getTextLength() < tailOffset + 2
                            || !document
                                .getText(new TextRange(tailOffset, tailOffset + 2))
                                .equals(":]")) {
                          document.insertString(tailOffset, ":]");
                        }
                        editor.getCaretModel().moveCaretRelatively(2, 0, false, false, true);
                      }
                    }));
      }
    }
    @Override
    public void addCompletions(
        @NotNull final CompletionParameters parameters,
        final ProcessingContext context,
        @NotNull final CompletionResultSet result) {
      for (final String[] completion :
          RegExpLanguageHosts.getInstance().getKnownCharacterClasses(parameters.getPosition())) {
        addLookupElement(result, completion[0], completion[1], emptyIcon);
      }

      for (String[] stringArray :
          RegExpLanguageHosts.getInstance().getAllKnownProperties(parameters.getPosition())) {
        addLookupElement(
            result,
            "p{" + stringArray[0] + "}",
            stringArray.length > 1 ? stringArray[1] : null,
            PlatformIcons.PROPERTY_ICON);
      }
    }
 @Override
 public void addCompletions(
     @NotNull final CompletionParameters parameters,
     final ProcessingContext context,
     @NotNull final CompletionResultSet result) {
   for (String[] stringArray :
       RegExpLanguageHosts.getInstance().getAllKnownProperties(parameters.getPosition())) {
     result.addElement(
         TailTypeDecorator.withTail(
             createLookupElement(stringArray[0], null, emptyIcon),
             TailType.createSimpleTailType('}')));
   }
 }