@NotNull
  @Override
  public Collection<? extends CustomLiveTemplateLookupElement> getLookupElements(@NotNull PsiFile file,
                                                                                 @NotNull Editor editor,
                                                                                 int offset) {
    Collection<CustomLiveTemplateLookupElement> result = new HashSet<>();
    CustomTemplateCallback callback = new CustomTemplateCallback(editor, file);
    Disposable parentDisposable = Disposer.newDisposable();
    try {
      for (PostfixTemplateProvider provider : LanguagePostfixTemplate.LANG_EP.allForLanguage(getLanguage(callback))) {
        ProgressManager.checkCanceled();
        String key = computeTemplateKeyWithoutContextChecking(callback);
        if (key != null && editor.getCaretModel().getCaretCount() == 1) {
          Condition<PostfixTemplate> isApplicationTemplateFunction =
            createIsApplicationTemplateFunction(provider, key, file, editor, parentDisposable);
          for (PostfixTemplate postfixTemplate : PostfixTemplatesUtils.getAvailableTemplates(provider)) {
            ProgressManager.checkCanceled();
            if (isApplicationTemplateFunction.value(postfixTemplate)) {
              result.add(new PostfixTemplateLookupElement(this, postfixTemplate, postfixTemplate.getKey(), provider, false));
            }
          }
        }
      }
    }
    finally {
      Disposer.dispose(parentDisposable);
    }

    return result;
  }
@NotNull
  @Override
  public Collection<? extends CustomLiveTemplateLookupElement> getLookupElements(@NotNull PsiFile file,
                                                                                 @NotNull Editor editor,
                                                                                 int offset)