private static ICollection <ILexSymbol> Build(ILexFile file)
        {
            var ret = new LexCacheBuilder();

            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) =>
                                   LexCacheBuilder.Write(data, writer));
            myPersistentCache.Dispose();
            myPersistentCache = null;
        }
示例#3
0
        public void SyncUpdate(bool underTransaction)
        {
            myShellLocks.AssertReadAccessAllowed();

            if (myDirtyFiles.Count > 0)
            {
                foreach (IPsiSourceFile projectFile in new List <IPsiSourceFile>(myDirtyFiles))
                {
                    using (WriteLockCookie.Create())
                    {
                        ICollection <ILexSymbol> ret = LexCacheBuilder.Build(projectFile);
                        if (ret != null)
                        {
                            ((ICache)this).Merge(projectFile, ret.ToList());
                        }
                        else
                        {
                            ((ICache)this).Merge(projectFile, null);
                        }
                    }
                }
            }
        }
示例#4
0
        public object Load(IProgressIndicator progress, bool enablePersistence)
        {
            if (!enablePersistence)
            {
                return(null);
            }

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

            using (ReadLockCookie.Create())
            {
                myPersistentCache = new LexPersistentCache <CacheData>(myShellLocks, VERSION, "LexCache", myPsiConfiguration);
            }

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

            if (myPersistentCache.Load(progress, myPersistentIdIndex,
                                       (file, reader) =>
            {
                using (ReadLockCookie.Create())
                {
                    return(LexCacheBuilder.Read(reader, file));
                }
            },
                                       (projectFile, psiSymbols) =>
            {
                if (projectFile != null)
                {
                    data[projectFile] = psiSymbols;
                }
            }) != LoadResult.OK)
            {
                return(data);
            }
            return(null);
        }
示例#5
0
 public object Build(IPsiSourceFile sourceFile, bool isStartup)
 {
     return(LexCacheBuilder.Build(sourceFile));
 }