locked
Predefined TextMarkerTag RRS feed

  • Question

  • Hi,

    Where can I find a list of predefined types for TextMarkerTags? I've created a new brace matching tagger for my custom language and I would like to use the TextMarkerTag that corresponds to the Brace Matching (Rectangle) display item in Options -> Environment -> Fonts & Colors.

    Some samples use TextMarkerTag("bracehighlight") but it doesn't seem to work in my case.

    Thanks,

    -Martin


    Wednesday, July 10, 2013 6:39 PM

Answers

  • Hi Ego,

    I found what I was looking for thanks to MEF!

    Predefined EditorFormatDefinition (DisplayName = NameAttribute):

    'Disassembly File Name' = 'FileLineClassificationFormat'
    'Disassembly Text' = 'InstructionLineClassificationFormat'
    'Disassembly Source' = 'SourceLineClassificationFormat'
    'Disassembly Symbol' = 'SymbolLineClassificationFormat'
    '' = 'quickinfo-bold format'
    '' = 'MarkerPlaceHolder'
    'Highlighted Reference' = 'MarkerFormatDefinition/HighlightedReference'
    'XML Doc Comment' = 'XML Doc Comment'
    'XML Doc Tag' = 'XML Doc Tag'
    'Find Match Highlight' = 'MarkerFormatDefinition/FindHighlight'
    'Find Scope Highlight' = 'MarkerFormatDefinition/ScopeHighlight'
    '' = 'TextView Background'
    '' = 'SigHelpDocumenationFormat'
    '' = 'CurrentParameterFormat'
    'Comment' = 'Comment'
    'Excluded Code' = 'Excluded Code'
    'Identifier' = 'Identifier'
    'Keyword' = 'Keyword'
    'Preprocessor Keyword' = 'Preprocessor Keyword'
    'Operator' = 'Operator'
    'Literal' = 'Literal'
    'String' = 'String'
    'Number' = 'Number'
    'Symbol Definition' = 'SymbolDefinitionClassificationFormat'
    'Symbol Reference' = 'SymbolReferenceClassificationFormat'
    '' = 'NaturalLanguageClassificationFormat'
    '' = 'FormalLanguageClassificationFormat'
    '' = 'High Priority'
    '' = 'Default Priority'
    '' = 'Low Priority'
    'Highlight Current Line (Active)' = 'CurrentLineActiveFormat'
    'Highlight Current Line (Inactive)' = 'CurrentLineInactiveFormat'
    'Diff - Differences (Original)' = 'deltadiff.remove.line'
    'Diff - Differences (Latest)' = 'deltadiff.add.line'
    'Diff - Removed (Original)' = 'deltadiff.remove.word'
    'Diff - Added (Latest) ' = 'deltadiff.add.word'
    'Difference scrollbar color' = 'deltadiff.overview.color'
    '' = 'Indicator Margin'
    'Collapsible Region' = 'outlining.collapsehintadornment'
    'Outlining Margin Vertical Rule' = 'outlining.verticalrule'
    'Outlining Margin Square' = 'outlining.square'
    'Syntax Error' = 'syntax error'
    'Compiler Error' = 'compiler error'
    'Other Error' = 'other error'
    'Warning' = 'compiler warning'
    '' = 'bookmark'
    '' = 'breakpoint'
    '' = 'currentstatement'
    '' = 'returnstatement'
    '' = 'stepbackcurrentstatement'
    '' = 'vivid'
    '' = 'blue'
    '' = 'remove line'
    '' = 'add line'
    '' = 'remove word'
    '' = 'add word'
    '' = 'bracehighlight'
    'URL Hyperlink' = 'urlformat'
    'Line Number' = 'Line Number'
    '' = 'Caret'
    '' = 'Overwrite Caret'
    'Track Changes before save' = 'Track Changes before save'
    'Track Changes after save' = 'Track Changes after save'
    'Track reverted changes' = 'Track reverted changes'
    'Visible Whitespace' = 'Visible Whitespace'
    'Selected Text' = 'Selected Text'
    'Inactive Selected Text' = 'Inactive Selected Text'
    'CSS Keyword' = 'CSS Keyword'
    'CSS Comment' = 'CSS Comment'
    'CSS Selector' = 'CSS Selector'
    'CSS Property Name' = 'CSS Property Name'
    'CSS Property Value' = 'CSS Property Value'
    'CSS String Value' = 'CSS String Value'
    '' = 'HTML Priority Workaround'
    'HTML Attribute Name' = 'HTML Attribute'
    'HTML Attribute Value' = 'HTML Attribute Value'
    'HTML Comment' = 'HTML Comment'
    'HTML Element Name' = 'HTML Element Name'
    'HTML Entity' = 'HTML Entity'
    'HTML Operator' = 'HTML Operator'
    'HTML Server-Side Script' = 'HTML Server-Side Script'
    'HTML Tag Delimiter' = 'HTML Tag Delimiter'
    'VBScript Keyword' = 'VBScript Keyword'
    'VBScript Comment' = 'VBScript Comment'
    'VBScript Operator' = 'VBScript Operator'
    'VBScript Number' = 'VBScript Number'
    'VBScript String' = 'VBScript String'
    'VBScript Identifier' = 'VBScript Identifier'
    'VBScript Function Block Start' = 'VBScript Function Block Start'
    'Razor Code' = 'Razor Code'

    And here's how I did it:

    1) Import all the editor formats defined by MEF

    [ImportMany]
    IEnumerable<EditorFormatDefinition> EditorFormats { get; set; }

    ...

    2) Display the [Name] attribute along the DisplayName for each editor format

    static void PrintNameAttribute(Type t, string displayName) { NameAttribute MyAttribute = (NameAttribute)Attribute.GetCustomAttribute(t, typeof(NameAttribute)); if (MyAttribute == null) { Trace.WriteLine(String.Format("'{0}' = null", displayName)); } else { Trace.WriteLine(String.Format("'{0}' = '{1}'", displayName, MyAttribute.Name)); } }

    And enumerate the formats:

                Trace.WriteLine("Predefined EditorFormatDefinition");
                foreach (EditorFormatDefinition element in EditorFormats)
                {
                    PrintNameAttribute(element.GetType(), element.DisplayName);
                }
                Trace.WriteLine("Done!");
    

    That's it!

     

    Tuesday, July 16, 2013 1:19 PM

All replies

  • Hi Martin,

    Please view the thread below:

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/3e9f0fcf-a03f-4508-9a2a-5b0369377d14/how-to-prevent-a-markerformatdefinitions-values-being-overridden

    Can it help you?

    Best regards,


    Ego [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, July 12, 2013 6:25 AM
  • Hi Ego,

    This is the opposite of what I'm looking for. I want the name of the predefined MarkerDefinitionFormat for the "Brace Matching (Rectangle)" as defined in Tools -> Options... so I can refer to it in the constructor of a TextMarkerTag(type).  

    <img src="http://social.msdn.microsoft.com/Forums/getfile/308284" />


    • Edited by Martin_Filteau Monday, July 15, 2013 2:07 AM fix embedded image
    Monday, July 15, 2013 2:06 AM
  • Hi,

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
     
    Thank you for your understanding and support.

    Best regards,


    Ego [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 15, 2013 5:57 AM
  • Hi Ego,

    I found what I was looking for thanks to MEF!

    Predefined EditorFormatDefinition (DisplayName = NameAttribute):

    'Disassembly File Name' = 'FileLineClassificationFormat'
    'Disassembly Text' = 'InstructionLineClassificationFormat'
    'Disassembly Source' = 'SourceLineClassificationFormat'
    'Disassembly Symbol' = 'SymbolLineClassificationFormat'
    '' = 'quickinfo-bold format'
    '' = 'MarkerPlaceHolder'
    'Highlighted Reference' = 'MarkerFormatDefinition/HighlightedReference'
    'XML Doc Comment' = 'XML Doc Comment'
    'XML Doc Tag' = 'XML Doc Tag'
    'Find Match Highlight' = 'MarkerFormatDefinition/FindHighlight'
    'Find Scope Highlight' = 'MarkerFormatDefinition/ScopeHighlight'
    '' = 'TextView Background'
    '' = 'SigHelpDocumenationFormat'
    '' = 'CurrentParameterFormat'
    'Comment' = 'Comment'
    'Excluded Code' = 'Excluded Code'
    'Identifier' = 'Identifier'
    'Keyword' = 'Keyword'
    'Preprocessor Keyword' = 'Preprocessor Keyword'
    'Operator' = 'Operator'
    'Literal' = 'Literal'
    'String' = 'String'
    'Number' = 'Number'
    'Symbol Definition' = 'SymbolDefinitionClassificationFormat'
    'Symbol Reference' = 'SymbolReferenceClassificationFormat'
    '' = 'NaturalLanguageClassificationFormat'
    '' = 'FormalLanguageClassificationFormat'
    '' = 'High Priority'
    '' = 'Default Priority'
    '' = 'Low Priority'
    'Highlight Current Line (Active)' = 'CurrentLineActiveFormat'
    'Highlight Current Line (Inactive)' = 'CurrentLineInactiveFormat'
    'Diff - Differences (Original)' = 'deltadiff.remove.line'
    'Diff - Differences (Latest)' = 'deltadiff.add.line'
    'Diff - Removed (Original)' = 'deltadiff.remove.word'
    'Diff - Added (Latest) ' = 'deltadiff.add.word'
    'Difference scrollbar color' = 'deltadiff.overview.color'
    '' = 'Indicator Margin'
    'Collapsible Region' = 'outlining.collapsehintadornment'
    'Outlining Margin Vertical Rule' = 'outlining.verticalrule'
    'Outlining Margin Square' = 'outlining.square'
    'Syntax Error' = 'syntax error'
    'Compiler Error' = 'compiler error'
    'Other Error' = 'other error'
    'Warning' = 'compiler warning'
    '' = 'bookmark'
    '' = 'breakpoint'
    '' = 'currentstatement'
    '' = 'returnstatement'
    '' = 'stepbackcurrentstatement'
    '' = 'vivid'
    '' = 'blue'
    '' = 'remove line'
    '' = 'add line'
    '' = 'remove word'
    '' = 'add word'
    '' = 'bracehighlight'
    'URL Hyperlink' = 'urlformat'
    'Line Number' = 'Line Number'
    '' = 'Caret'
    '' = 'Overwrite Caret'
    'Track Changes before save' = 'Track Changes before save'
    'Track Changes after save' = 'Track Changes after save'
    'Track reverted changes' = 'Track reverted changes'
    'Visible Whitespace' = 'Visible Whitespace'
    'Selected Text' = 'Selected Text'
    'Inactive Selected Text' = 'Inactive Selected Text'
    'CSS Keyword' = 'CSS Keyword'
    'CSS Comment' = 'CSS Comment'
    'CSS Selector' = 'CSS Selector'
    'CSS Property Name' = 'CSS Property Name'
    'CSS Property Value' = 'CSS Property Value'
    'CSS String Value' = 'CSS String Value'
    '' = 'HTML Priority Workaround'
    'HTML Attribute Name' = 'HTML Attribute'
    'HTML Attribute Value' = 'HTML Attribute Value'
    'HTML Comment' = 'HTML Comment'
    'HTML Element Name' = 'HTML Element Name'
    'HTML Entity' = 'HTML Entity'
    'HTML Operator' = 'HTML Operator'
    'HTML Server-Side Script' = 'HTML Server-Side Script'
    'HTML Tag Delimiter' = 'HTML Tag Delimiter'
    'VBScript Keyword' = 'VBScript Keyword'
    'VBScript Comment' = 'VBScript Comment'
    'VBScript Operator' = 'VBScript Operator'
    'VBScript Number' = 'VBScript Number'
    'VBScript String' = 'VBScript String'
    'VBScript Identifier' = 'VBScript Identifier'
    'VBScript Function Block Start' = 'VBScript Function Block Start'
    'Razor Code' = 'Razor Code'

    And here's how I did it:

    1) Import all the editor formats defined by MEF

    [ImportMany]
    IEnumerable<EditorFormatDefinition> EditorFormats { get; set; }

    ...

    2) Display the [Name] attribute along the DisplayName for each editor format

    static void PrintNameAttribute(Type t, string displayName) { NameAttribute MyAttribute = (NameAttribute)Attribute.GetCustomAttribute(t, typeof(NameAttribute)); if (MyAttribute == null) { Trace.WriteLine(String.Format("'{0}' = null", displayName)); } else { Trace.WriteLine(String.Format("'{0}' = '{1}'", displayName, MyAttribute.Name)); } }

    And enumerate the formats:

                Trace.WriteLine("Predefined EditorFormatDefinition");
                foreach (EditorFormatDefinition element in EditorFormats)
                {
                    PrintNameAttribute(element.GetType(), element.DisplayName);
                }
                Trace.WriteLine("Done!");
    

    That's it!

     

    Tuesday, July 16, 2013 1:19 PM