@Override
  public @Nullable Charset getEncoding(@Nullable VirtualFile virtualFile, boolean useParentDefaults) {
    if (virtualFile != null) {
      for (FileEncodingProvider encodingProvider : FileEncodingProvider.EP_NAME.getIterable()) {
        Charset encoding = encodingProvider.getEncoding(virtualFile, myProject);
        if (encoding != null) return encoding;
      }
    }
    if (!myMapping.isEmpty()) {
      VirtualFile parent = virtualFile;
      while (parent != null) {
        Charset charset = myMapping.get(new LightFilePointer(parent.getUrl()));
        if (charset != null || !useParentDefaults) return charset;
        parent = parent.getParent();
      }
    }

    return getDefaultCharset();
  }
@Override
  public @Nullable Charset getEncoding(@Nullable VirtualFile virtualFile, boolean useParentDefaults)