locked
Comment and Uncomment in own Editor RRS feed

  • Question

  • Hi,

    How can Comment/Uncomment in my own Editor using MEF?
    The toolbar buttons to comment/uncomment are disabled.

    Rod


    Saturday, July 15, 2017 1:07 AM

Answers

  • Hi Rodrigo Bruscain,

    You could write a custom command menu to comment/uncomment code, which get the line of code and the selection of code, then add comment content to line or selection.

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 17, 2017 9:24 AM

All replies

  • Hi Rodrigo Bruscain,

    You could write a custom command menu to comment/uncomment code, which get the line of code and the selection of code, then add comment content to line or selection.

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 17, 2017 9:24 AM
  • Are the buttons disabled by choice or "Defalut?". I think, first you need to enabled them. As far as I know this can be done in the .vsct file.

    Or, alternatively, in the ViewFilter.QueryCommandStatus() methods, where you have to return

    (int)(OLECMDF.OLECMDF_SUPPORTED | OLECMDF.OLECMDF_ENABLED);

    Then, in your implementation of the Source class, override CommentSpan(...) and UncommentSpan(...) methods. This is for MPF rather then MEF (about which I know nothing at all), but maybe it helps anyway.

    Regards,

    f_max

    Saturday, July 22, 2017 7:59 PM