private static List<CompletionVariant> computeVariants(@NotNull final Editor editor,
                                                         CamelHumpMatcher matcher,
                                                         PsiFile file,
                                                         boolean includeWordsFromOtherFiles) {

    final ArrayList<CompletionVariant> words = new ArrayList<>();
    final List<CompletionVariant> afterWords = new ArrayList<>();

    if (includeWordsFromOtherFiles) {
      for(FileEditor fileEditor: FileEditorManager.getInstance(file.getProject()).getAllEditors()) {
        if (fileEditor instanceof TextEditor textEditor) {
          Editor anotherEditor = textEditor.getEditor();
          if (anotherEditor != editor) {
            addWordsForEditor(anotherEditor, matcher, words, afterWords, false);
          }
        }
      }
    } else {
      addWordsForEditor(editor, matcher, words, afterWords, true);
    }

    Set<String> allWords = new HashSet<>();
    List<CompletionVariant> result = new ArrayList<>();

    Collections.reverse(words);

    for (CompletionVariant variant : words) {
      if (!allWords.contains(variant.variant)) {
        result.add(variant);
        allWords.add(variant.variant);
      }
    }

    Collections.reverse(result);

    allWords.clear();
    for (CompletionVariant variant : afterWords) {
      if (!allWords.contains(variant.variant)) {
        result.add(variant);
        allWords.add(variant.variant);
      }
    }

    return result;
  }
private static List<CompletionVariant> computeVariants(@NotNull final Editor editor,
                                                         CamelHumpMatcher matcher,
                                                         PsiFile file,
                                                         boolean includeWordsFromOtherFiles)