public IHighlighter CreateHighlighter(IDocument document)
        {
            if (document.FileName == null)
            {
                return(new MultiHighlighter(document));
            }
            var def = HighlightingManager.Instance.GetDefinitionByExtension(Path.GetExtension(document.FileName));

            if (def == null)
            {
                return(new MultiHighlighter(document));
            }
            List <IHighlighter> highlighters = new List <IHighlighter>();
            var textDocument     = document as TextDocument;
            var readOnlyDocument = document as ReadOnlyDocument;

            if (textDocument != null)
            {
                highlighters.Add(new DocumentHighlighter(textDocument, def));
            }
            else if (readOnlyDocument != null)
            {
                highlighters.Add(new DocumentHighlighter(readOnlyDocument, def));
            }
            // add additional highlighters
            highlighters.AddRange(SD.AddInTree.BuildItems <IHighlighter>(HighlighterDoozer.AddInPath, document, false));
            var multiHighlighter = new MultiHighlighter(document, highlighters.ToArray());

            return(new CustomizingHighlighter(multiHighlighter, CustomizedHighlightingColor.FetchCustomizations(def.Name)));
        }
		public IHighlighter CreateHighlighter(IDocument document)
		{
			if (document.FileName == null)
				return new MultiHighlighter(document);
			var def = HighlightingManager.Instance.GetDefinitionByExtension(Path.GetExtension(document.FileName));
			if (def == null)
				return new MultiHighlighter(document);
			List<IHighlighter> highlighters = new List<IHighlighter>();
			var textDocument = document as TextDocument;
			var readOnlyDocument = document as ReadOnlyDocument;
			if (textDocument != null) {
				highlighters.Add(new DocumentHighlighter(textDocument, def));
			} else if (readOnlyDocument != null) {
				highlighters.Add(new DocumentHighlighter(readOnlyDocument, def));
			}
			// add additional highlighters
			highlighters.AddRange(SD.AddInTree.BuildItems<IHighlighter>(HighlighterDoozer.AddInPath, document, false));
			var multiHighlighter = new MultiHighlighter(document, highlighters.ToArray());
			return new CustomizingHighlighter(multiHighlighter, CustomizedHighlightingColor.FetchCustomizations(def.Name));
		}