@Nullable
    private static Set<Language> getPreferredLanguages(@NotNull PsiFile file, int offset) {
      Set<Language> languages = new HashSet<>();
      int currOffset = offset == file.getTextLength() && offset > 0 ? offset - 1 : offset;
      PsiElement contextElement = file.findElementAt(currOffset);
      if (contextElement != null) {
        EditorConfigHeader header = findHeader(contextElement);
        if (header != null) {
          String pattern = header.getText();
          pattern = StringUtil.trimEnd(StringUtil.trimStart(pattern, "["), "]").trim();
          if ("*".equals(pattern)) return null;
          for (FileType fileType : FileTypeManager.getInstance().getRegisteredFileTypes()) {
            if (fileType instanceof LanguageFileType) {
              String testName = "/a." + fileType.getDefaultExtension();
              // TODO verify that the pattern ends up being created from the same string
              //if (EditorConfig.filenameMatches("", pattern, testName)) {
              if (new Glob(pattern).match(Ec4jPath.Ec4jPaths.of(testName))) {
                languages.add(((LanguageFileType)fileType).getLanguage());
              }
            }
          }
        }
      }
      return languages;
    }
@Nullable
    private static Set<Language> getPreferredLanguages(@NotNull PsiFile file, int offset)