public void Invalidate(IPsiModule psiModule)
 {
     lock (myLock)
     {
         PsiModulesCaches.Remove(psiModule);
         if (psiModule.IsValid())
         {
             InvalidateReferencingModules(psiModule);
         }
     }
 }
        public void Drop(IPsiSourceFile sourceFile)
        {
            lock (myLock)
            {
                if (PsiModulesCaches.IsEmpty())
                {
                    return;
                }

                Invalidate(sourceFile);
            }
        }
        protected virtual void Invalidate(IPsiSourceFile sourceFile)
        {
            var psiModule = sourceFile.PsiModule;

            if (!psiModule.IsValid())
            {
                Invalidate(psiModule);
                return;
            }

            if (PsiModulesCaches.TryGetValue(psiModule, out var moduleResolvedSymbols))
            {
                moduleResolvedSymbols.Invalidate(sourceFile);
            }

            InvalidateReferencingModules(psiModule);
        }
        private void InvalidateReferencingModules(IPsiModule psiModule)
        {
            if (PsiModulesCaches.IsEmpty())
            {
                return;
            }

            // todo: reuse FcsProjectProvider references
            using (CompilationContextCookie.GetOrCreate(psiModule.GetContextFromModule()))
            {
                var resolveContext = CompilationContextCookie.GetContext();
                foreach (var psiModuleReference in PsiModules.GetReverseModuleReferences(psiModule, resolveContext))
                {
                    if (PsiModulesCaches.TryGetValue(psiModuleReference.Module, out var moduleSymbols))
                    {
                        moduleSymbols.Invalidate();
                    }
                }
            }
        }