Exemple #1
0
 protected override void BuildLanguageBlockCollection()
 {
     LanguageBlocks.Clear();
     foreach (var artifact in EditorTree.RootNode.Tree.ArtifactCollection.OfType <CodeLineArtifact>())
     {
         var contentType = contentTypeRegistry.FromFriendlyName(artifact.BlockInfo.Language).ToEmbeddableContentType();
         if (contentType != null)
         {
             LanguageBlocks.AddBlock(new ArtifactLanguageBlock(artifact, contentType));
         }
     }
     LanguageBlocks.SortByPosition();
 }
        protected override void RegenerateBuffer()
        {
            if (ProjectionBufferManager == null)
            {
                return;
            }

            foreach (var language in EditorTree.RootNode.Tree.ArtifactCollection
                     .OfType <BlockBoundaryArtifact>()
                     .Select(b => b.BlockInfo)
                     .Distinct()
                     .GroupBy(b => contentTypeRegistry.FromFriendlyName(b.Language).ToEmbeddableContentType()))
            {
                if (language.Key == null)
                {
                    continue;                        // If we can't identify the language, just use normal artifacts.
                }
                PopulateLanguageBuffer(language.Key, language.SelectMany(b => b.CodeLines));
            }
        }