static @NotNull Set<String> extractEncodings(@NotNull Project project, @NotNull VirtualFile file) {
    Set<String> charsets = new HashSet<>();
    PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
    if (psiFile == null) {
      return charsets;
    }

    PsiRecursiveElementVisitor visitor = new PsiRecursiveElementVisitor() {
      @Override
      public void visitElement(@NotNull PsiElement element) {
        if (element instanceof PsiFile || element instanceof EditorConfigSection) {
          super.visitElement(element);
        }
        else if (element instanceof EditorConfigOption) {
          EditorConfigFlatOptionKey obj1 = ((EditorConfigOption)element).getFlatOptionKey();
          String keyName = obj1 == null ? null : obj1.getName();
          if (ConfigEncodingCharsetUtil.charsetKey.equals(keyName)) {
            EditorConfigOptionValueIdentifier obj = ((EditorConfigOption)element).getOptionValueIdentifier();
            String charsetStr = obj == null ? null : obj.getName();
            if (charsetStr != null) {
              charsets.add(charsetStr);
            }
          }
        }
      }
    };
    psiFile.accept(visitor);
    return charsets;
  }
static @NotNull Set<String> extractEncodings(@NotNull Project project, @NotNull VirtualFile file)