internal static HtmlIntellisenseController GetOrCreateController(IComponentModel model, ITextView textView)
        {
            HtmlIntellisenseController controller;

            if (!textView.Properties.TryGetProperty <HtmlIntellisenseController>(typeof(HtmlIntellisenseController), out controller))
            {
                var intellisenseControllerProvider = (
                    from export in model.DefaultExportProvider.GetExports <IIntellisenseControllerProvider, IContentTypeMetadata>()
                    from exportedContentType in export.Metadata.ContentTypes
                    where exportedContentType.Equals("HTML", StringComparison.OrdinalIgnoreCase) && export.Value.GetType() == typeof(HtmlIntellisenseControllerProvider)
                    select export.Value
                    ).First();
                controller = new HtmlIntellisenseController((HtmlIntellisenseControllerProvider)intellisenseControllerProvider, textView);
                textView.Properties.AddProperty(typeof(HtmlIntellisenseController), controller);
            }
            return(controller);
        }
        public IIntellisenseController TryCreateIntellisenseController(ITextView textView, IList <ITextBuffer> subjectBuffers)
        {
            HtmlIntellisenseController controller = null;

            if (!textView.Properties.TryGetProperty <HtmlIntellisenseController>(typeof(HtmlIntellisenseController), out controller))
            {
                foreach (var buffer in subjectBuffers)
                {
                    if (buffer.Properties.ContainsProperty(typeof(TemplateProjectionBuffer)))   // it's one of our buffers
                    {
                        controller = new HtmlIntellisenseController(this, textView);
                        textView.Properties.AddProperty(typeof(HtmlIntellisenseController), controller);
                    }
                }
            }

            return(controller);
        }