public class FSharpCacheProvider()

in ReSharper.FSharp/src/FSharp/FSharp.Psi/src/Impl/Cache2/FSharpCacheProvider.cs [15:69]


  public class FSharpCacheProvider(FcsCheckerService checkerService) : ILanguageCacheProvider, ILanguageCacheInvalidator
  {
    public void BuildCache(IFile file, ICacheBuilder builder)
    {
      using var cookie = ProhibitTypeCheckCookie.Create();

      var sourceFile = file.GetSourceFile();
      Assertion.AssertNotNull(sourceFile);

      var declarationProcessor = new FSharpCacheDeclarationProcessor(builder, checkerService);
      (file as IFSharpFile)?.Accept(declarationProcessor);
    }

    public ProjectFilePart LoadProjectFilePart(IPsiSourceFile sourceFile, ProjectFilePartsTree tree, IReader reader) =>
      new FSharpProjectFilePart(sourceFile, reader, sourceFile.GetFSharpFileKind());

    public Part ReadPart(byte tag, IReader reader) =>
      (FSharpPartKind) tag switch
      {
        FSharpPartKind.DeclaredNamespace => new DeclaredNamespacePart(reader),
        FSharpPartKind.QualifiedNamespace => new QualifiedNamespacePart(reader),
        FSharpPartKind.NamedModule => new NamedModulePart(reader),
        FSharpPartKind.NestedModule => new NestedModulePart(reader),
        FSharpPartKind.AnonModule => new AnonModulePart(reader),
        FSharpPartKind.Exception => new FSharpExceptionPart(reader),
        FSharpPartKind.Enum => new EnumPart(reader),
        FSharpPartKind.Record => new RecordPart(reader),
        FSharpPartKind.Union => new UnionPart(reader),
        FSharpPartKind.UnionCase => new UnionCasePart(reader),
        FSharpPartKind.Class => new ClassPart(reader),
        FSharpPartKind.Interface => new InterfacePart(reader),
        FSharpPartKind.Struct => new StructPart(reader),
        FSharpPartKind.StructRecord => new StructRecordPart(reader),
        FSharpPartKind.StructUnion => new StructUnionPart(reader),
        FSharpPartKind.ClassExtension => new ClassExtensionPart(reader),
        FSharpPartKind.StructExtension => new StructExtensionPart(reader),
        FSharpPartKind.Delegate => new DelegatePart(reader),
        FSharpPartKind.ObjectExpression => new ObjectExpressionTypePart(reader),
        FSharpPartKind.AbbreviationOrSingleCaseUnion => new TypeAbbreviationOrDeclarationPart(reader),
        FSharpPartKind.StructAbbreviationOrSingleCaseUnion => new StructTypeAbbreviationOrDeclarationPart(reader),
        FSharpPartKind.ILAssemblyAbbreviation => new ILAssemblyTypeAbbreviationPart(reader),
        FSharpPartKind.ModuleAbbreviation => new FSharpModuleAbbreviationPart(reader),
        _ => throw new SerializationError("Unknown tag:" + tag)
      };

    public bool NeedCacheUpdate(ITreeNode elementContainingChanges, PsiChangedElementType type) => true;
    public bool IsCaseSensitive(IPsiModule module) => true;

    public IEnumerable<IPsiSourceFile> GetAffectedOnPsiModulePropertiesChange(IPsiModule module) =>
      EmptyList<IPsiSourceFile>.Instance; // todo: check this

    public void BuildCache(ISandBox sandBox, ICacheBuilder builder)
    {
    }
  }