locked
How to set IGlyphFactoryProvider Order? RRS feed

  • Question

  • Hi,

    I've been following this how-to sample http://msdn.microsoft.com/en-us/library/ee361745.aspx.

    I had several issues that I would like somebody to clarify for me.

    First there is a use of a magic string to specify order: "VsTextMarker" What other internal VS names exist for this scenario (except what was used by the user).

    I've investigated this further, I've inspected the visual tree with snoop, I could see there are a few canvases created on the margin. If my order is before VsTextMarker I'm being located on the first canvas, if I'm after VsTextMarker I'm being located on the third canvas, so I can safely assume VsTextMarker is taken by the 2nd canvas. But who is located on the 1st? or it is just created so there would be a "before" for he VsTextMarker. Anyway this is purey guesses and no documentation at all.

    Second, Problems arises when there is another plugin that also created a margin, such as resharper, as far as I can tell whenever resharper is installed it gets a new canvas and as a result it takes a 4th canvas and my stuff can be on the 1st or 3rd. What happend is the last child is on top (ZOrder) and gets all mouse events, so my glyphs do not show tooltips anymore for example.

    I've peeked with resharper dlls using reflector and found the name it uses for his margin control, If I specified I want to be after it, it was OK, but this is a serious issue, I can not assume my plugin will be used together with resharper, and what would happen if another plugin will get installed and will push me out of the way, it will break my functionality.

    As I said I need a serious clarifications. :)

    Thanks

    Ariel


    אריאל www.CodeValue.net טוייטר: arielbh@ בלוג: http://blogs.microsoft.co.il/blogs/arielbh/
    Tuesday, February 1, 2011 7:49 AM

Answers

  • Hello Ariel,

    Thanks for your feedback.

    There are only limited built-in extension names are publicly documented, see: PredefinedMarginNames, PredefinedtAdornmentLayers and PredefinedTextViewRoles. However, there is no document which contains all of the extension names including the margin glyphs. You can submit a request to http://connect.microsoft.com to add such documentation.

    AFAIK, VsTextMarker is the only buit-in margin graph which is imported by the extension method, but I am not clear about others.

    I don't know any perfect method to prevent the situation you have. VS extension will use the extension's load sequence to determine its order if they are in the same level. In this case, Refactor is loaded after your extension. In order to avoid it, You have to specify Refactor's extension name. You can specify multiple order attribute to set both VSTextMark and refactor's name. (I know that this is a bad workaround.)

    Actually, this should be a design issue. It is hard for VS to determine which glyph should appear on top of others which are all developed by 3rd parties. The correct way is to let the user to select, however the current design of margin glyph doesn't support this. You may also submit a request via connect to product group.


    Hongye Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by ArielBH Thursday, February 3, 2011 10:47 AM
    Wednesday, February 2, 2011 8:21 AM

All replies

  • Hello Ariel,

    Thanks for your feedback.

    There are only limited built-in extension names are publicly documented, see: PredefinedMarginNames, PredefinedtAdornmentLayers and PredefinedTextViewRoles. However, there is no document which contains all of the extension names including the margin glyphs. You can submit a request to http://connect.microsoft.com to add such documentation.

    AFAIK, VsTextMarker is the only buit-in margin graph which is imported by the extension method, but I am not clear about others.

    I don't know any perfect method to prevent the situation you have. VS extension will use the extension's load sequence to determine its order if they are in the same level. In this case, Refactor is loaded after your extension. In order to avoid it, You have to specify Refactor's extension name. You can specify multiple order attribute to set both VSTextMark and refactor's name. (I know that this is a bad workaround.)

    Actually, this should be a design issue. It is hard for VS to determine which glyph should appear on top of others which are all developed by 3rd parties. The correct way is to let the user to select, however the current design of margin glyph doesn't support this. You may also submit a request via connect to product group.


    Hongye Sun [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by ArielBH Thursday, February 3, 2011 10:47 AM
    Wednesday, February 2, 2011 8:21 AM
  • FYI, I've logged it on Connect:

     

     

    1.   Documentation for "Magic" Strings: https://connect.microsoft.com/VisualStudio/feedback/details/641680/add-documentation-for-all-built-in-extension-names
    2.   Order issue between Margins: https://connect.microsoft.com/VisualStudio/feedback/details/641681/possible-design-issue-related-to-the-order-of-margin-glypgs-in-3rd-party-vs-add-ins

    Thanks all,
    Ariel

     

     

     


    אריאל www.CodeValue.net טוייטר: arielbh@ בלוג: http://blogs.microsoft.co.il/blogs/arielbh/
    Monday, February 7, 2011 10:17 AM