Ejemplo n.º 1
0
        public int[] Build(IPsiSourceFile sourceFile, SeldomInterruptChecker interruptChecker)
        {
            using (UnsafeWriter.Cookie unsafeWriterCookie = UnsafeWriter.NewThreadLocalWriter())
            {
                TrigramIndexEntryBuilder indexEntryBuilder = new TrigramIndexEntryBuilder(unsafeWriterCookie);
                foreach (TrigramToken trigramToken in new BufferTrigramSource(new StringBuffer(ASSET_REFERENCE_IDENTIFIER)))
                {
                    indexEntryBuilder.Add(trigramToken);
                }

                UnsafeIntArray entryData = indexEntryBuilder.Build();
                return(entryData.ToIntArray());
            }
        }
        public int[] Build(IPsiSourceFile sourceFile, SeldomInterruptChecker interruptChecker)
        {
            var file = sourceFile.GetDominantPsiFile <UnityYamlLanguage>() as IYamlFile;

            if (file == null)
            {
                return(null);
            }

            using (UnsafeWriter.Cookie unsafeWriterCookie = UnsafeWriter.NewThreadLocalWriter())
            {
                TrigramIndexEntryBuilder indexEntryBuilder = new TrigramIndexEntryBuilder(unsafeWriterCookie);
                foreach (var yamlDocument in file.Documents)
                {
                    foreach (TrigramToken trigramToken in new BufferTrigramSource(yamlDocument.GetTextAsBuffer()))
                    {
                        indexEntryBuilder.Add(trigramToken);
                    }
                }

                UnsafeIntArray entryData = indexEntryBuilder.Build();
                return(entryData.ToIntArray());
            }
        }