private static ICollection <IPsiSymbol> Build(IPsiFile file)
        {
            var ret = new PsiCacheBuilder();

            file.ProcessDescendants(ret);
            return(ret.GetSymbols());
        }
示例#2
0
        public void Save(IProgressIndicator progress, bool enablePersistence)
        {
            if (!enablePersistence)
            {
                return;
            }

            Assertion.Assert(myPersistentCache != null, "myPersistentCache != null");
            myPersistentCache.Save(progress, myPersistentIdIndex, (writer, file, data) =>
                                   PsiCacheBuilder.Write(data, writer));
            myPersistentCache.Dispose();
            myPersistentCache = null;
        }
示例#3
0
        public object Load(IProgressIndicator progress, bool enablePersistence)
        {
            if (!enablePersistence)
            {
                return(null);
            }

            Assertion.Assert(myPersistentCache == null, "myPersistentCache == null");

            using (ReadLockCookie.Create())
            {
                myPersistentCache = new PsiPersistentCache <CachePair>(myShellLocks, VERSION, "PsiCache", myPsiConfiguration);
            }

            var data = new Dictionary <IPsiSourceFile, CachePair>();

            if (myPersistentCache.Load(progress, myPersistentIdIndex,
                                       (file, reader) =>
            {
                using (ReadLockCookie.Create())
                {
                    return(PsiCacheBuilder.Read(reader, file));
                }
            },
                                       (projectFile, psiSymbols) =>
            {
                if (projectFile != null)
                {
                    data[projectFile] = psiSymbols;
                }
            }) != LoadResult.OK)


            {
                // clear all...
                ((ICache)this).Release();
                return(null);
            }
            return(data);
        }
示例#4
0
        public void SyncUpdate(bool underTransaction)
        {
            myShellLocks.AssertReadAccessAllowed();

            if (myDirtyFiles.Count > 0)
            {
                foreach (IPsiSourceFile projectFile in new List <IPsiSourceFile>(myDirtyFiles))
                {
                    using (WriteLockCookie.Create())
                    {
                        ICollection <IPsiSymbol> ret = PsiCacheBuilder.Build(projectFile);
                        if (ret != null)
                        {
                            ((ICache)this).Merge(projectFile, ret.ToList());
                        }
                        else
                        {
                            ((ICache)this).Merge(projectFile, null);
                        }
                    }
                }
            }
        }
示例#5
0
 public object Build(IPsiSourceFile sourceFile, bool isStartup)
 {
     return(PsiCacheBuilder.Build(sourceFile));
 }
 private static ICollection<IPsiSymbol> Build(IPsiFile file)
 {
   var ret = new PsiCacheBuilder();
   file.ProcessDescendants(ret);
   return ret.GetSymbols();
 }