/// <summary> /// Initializes a new instance of the <c>JsonClassificationTypeProvider</c> class. /// </summary> /// <param name="targetRegistry">The <see cref="IHighlightingStyleRegistry"/> to use when registering classification types and highlighting styles.</param> public JsonClassificationTypeProvider(IHighlightingStyleRegistry targetRegistry) { if ((targetRegistry != null)) registryValue = targetRegistry; else registryValue = AmbientHighlightingStyleRegistry.Instance; }
/// <summary> /// Initializes a new instance of the <c>JsonClassificationTypeProvider</c> class. /// </summary> /// <param name="targetRegistry">The <see cref="IHighlightingStyleRegistry"/> to use when registering classification types and highlighting styles.</param> public JsonClassificationTypeProvider(IHighlightingStyleRegistry targetRegistry) { if ((targetRegistry != null)) { registryValue = targetRegistry; } else { registryValue = AmbientHighlightingStyleRegistry.Instance; } }
/// <summary> /// Initializes a new instance of the <c>SyntaxEditorStepBroClassificationTypeProvider</c> class. /// </summary> /// <param name="targetRegistry">The <see cref="IHighlightingStyleRegistry"/> to use when registering classification types and highlighting styles.</param> public SyntaxEditorStepBroClassificationTypeProvider(IHighlightingStyleRegistry targetRegistry) { if ((targetRegistry != null)) { this.registryValue = targetRegistry; } else { this.registryValue = AmbientHighlightingStyleRegistry.Instance; } }
public ExecutionTargetSelectorClassificationTypeProvider(IHighlightingStyleRegistry targetRegistry) { if ((targetRegistry != null)) { this.registryValue = targetRegistry; } else { this.registryValue = AmbientHighlightingStyleRegistry.Instance; } }
///////////////////////////////////////////////////////////////////////////////////////////////////// // OBJECT ///////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <c>FunctionContentProvider</c> class. /// </summary> /// <param name="highlightingStyleRegistry">The <see cref="IHighlightingStyleRegistry"/> to use for finding highlighting styles.</param> /// <param name="functionDecl">The function declaration.</param> /// <param name="includeImage">Whether to include images in the output.</param> /// <param name="backgroundColorHint">The content host's background color.</param> public FunctionContentProvider(IHighlightingStyleRegistry highlightingStyleRegistry, FunctionDeclaration functionDecl, bool includeImage, Color backgroundColorHint) { if (functionDecl == null) { throw new ArgumentNullException("functionDecl"); } // Initialize this.highlightingStyleRegistry = highlightingStyleRegistry; this.functionDecl = functionDecl; this.includeImage = includeImage; this.backgroundColorHint = backgroundColorHint; }
private static void AppendText(this StringBuilder sb, string text, IClassificationType classificationType, IHighlightingStyleRegistry highlightingStyleRegistry) { var highlightingStyle = highlightingStyleRegistry[classificationType]; var styleBuilder = new StringBuilder(); styleBuilder.AppendStyle(highlightingStyle); var hasStyle = styleBuilder.Length > 0; if (hasStyle) { sb.Append(@"<span style="""); sb.Append(styleBuilder); sb.Append(@""">"); } sb.Append(HtmlContentProvider.Escape(text)); if (hasStyle) { sb.Append(@"</span>"); } }
private static void AppendNode(this StringBuilder sb, SymbolMarkupToken token, INQueryClassificationTypes classificationTypes, IHighlightingStyleRegistry highlightingStyleRegistry) { var classificationType = GetClassificationType(token.Kind, classificationTypes); sb.AppendText(token.Text, classificationType, highlightingStyleRegistry); }
private static void AppendMarkup(this StringBuilder sb, SymbolMarkup symbolMarkup, INQueryClassificationTypes classificationTypes, IHighlightingStyleRegistry highlightingStyleRegistry) { foreach (var node in symbolMarkup.Tokens) { sb.AppendNode(node, classificationTypes, highlightingStyleRegistry); } }
public static string GetHtml(Glyph glyph, SymbolMarkup symbolMarkup, INQueryClassificationTypes classificationTypes, IHighlightingStyleRegistry highlightingStyleRegistry) { var sb = new StringBuilder(); sb.AppendGlyph(glyph); sb.AppendMarkup(symbolMarkup, classificationTypes, highlightingStyleRegistry); return(sb.ToString()); }
public static HtmlContentProvider Create(Glyph glyph, SymbolMarkup symbolMarkup, INQueryClassificationTypes classificationTypes, IHighlightingStyleRegistry highlightingStyleRegistry) { var htmlSnippet = HtmlMarkupEmitter.GetHtml(glyph, symbolMarkup, classificationTypes, highlightingStyleRegistry); return(new HtmlContentProviderWithGlyph(htmlSnippet)); }
public static void RegisterAll(this INQueryClassificationTypes classificationTypes, IHighlightingStyleRegistry registry) { registry.Register(classificationTypes.WhiteSpace, new HighlightingStyle()); registry.Register(classificationTypes.Comment, new HighlightingStyle(Brushes.Green)); registry.Register(classificationTypes.Keyword, new HighlightingStyle(Brushes.Blue)); registry.Register(classificationTypes.Punctuation, new HighlightingStyle(new SolidColorBrush(Colors.DarkCyan))); registry.Register(classificationTypes.Identifier, new HighlightingStyle(Brushes.Black)); registry.Register(classificationTypes.StringLiteral, new HighlightingStyle(new SolidColorBrush(Colors.Maroon))); registry.Register(classificationTypes.NumberLiteral, new HighlightingStyle(Brushes.Black)); registry.Register(classificationTypes.SchemaTable, new HighlightingStyle(new SolidColorBrush(Colors.DarkBlue))); registry.Register(classificationTypes.DerivedTable, new HighlightingStyle(new SolidColorBrush(Colors.DarkBlue))); registry.Register(classificationTypes.CommonTableExpression, new HighlightingStyle(new SolidColorBrush(Colors.DarkBlue))); registry.Register(classificationTypes.Column, new HighlightingStyle(new SolidColorBrush(Colors.Purple))); registry.Register(classificationTypes.Method, new HighlightingStyle(new SolidColorBrush(Colors.DarkCyan))); registry.Register(classificationTypes.Property, new HighlightingStyle(new SolidColorBrush(Colors.DarkCyan))); registry.Register(classificationTypes.Function, new HighlightingStyle(new SolidColorBrush(Colors.Fuchsia))); registry.Register(classificationTypes.Aggregate, new HighlightingStyle(new SolidColorBrush(Colors.OrangeRed))); registry.Register(classificationTypes.Operator, new HighlightingStyle(new SolidColorBrush(Colors.DarkCyan))); registry.Register(classificationTypes.Variable, new HighlightingStyle(new SolidColorBrush(Colors.DarkCyan))); registry.Register(classificationTypes.Unnecessary, new HighlightingStyle(new SolidColorBrush(Colors.Gray))); }
///////////////////////////////////////////////////////////////////////////////////////////////////// // OBJECT ///////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <c>CustomContentProvider</c> class. /// </summary> /// <param name="highlightingStyleRegistry">The <see cref="IHighlightingStyleRegistry"/> to use for finding highlighting styles.</param> /// <param name="type">The <see cref="Type"/> for which to provide content.</param> public CustomContentProvider(IHighlightingStyleRegistry highlightingStyleRegistry, Type type) { // Initialize this.highlightingStyleRegistry = highlightingStyleRegistry; this.type = type; }