#pragma warning restore 649


        #region IClassifierProvider

        /// <summary>
        /// Gets a classifier for the given text buffer.
        /// </summary>
        /// <param name="buffer">The <see cref="ITextBuffer"/> to classify.</param>
        /// <returns>A classifier for the text buffer, or null if the provider cannot do so in its current state.</returns>
        public IClassifier GetClassifier(ITextBuffer buffer)
        {
            // only return a classifier when this is really our document
            if (!factory.IsXSharpDocument( buffer))
                return null;
            return buffer.Properties.GetOrCreateSingletonProperty<XSharpClassifier>(creator: () => XSharpClassifier.GetColorizer(buffer, this.classificationRegistry, this.factory));
        }
Exemplo n.º 2
0
        internal IClassificationTypeRegistryService ClassificationRegistry = null; // Set via MEF

        public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag
        {
            //create a single tagger for each buffer.
            if (!factory.IsXSharpDocument(buffer))
            {
                return(null);
            }
            ITagger <T> outliner = buffer.Properties.GetOrCreateSingletonProperty <ITagger <T> >(
                () => new XSharpOutliningTagger(buffer, aggregator, ClassificationRegistry) as ITagger <T>);

            return(outliner);
        }