locked
How do I restrict a context menu item created using a VsPackage VSCT Command Table to be visible only in the F# Code Editor ? RRS feed

  • Question

  • Hi,

    I created a context menu item in the VS2010 Editor using a VSPackage and the VSCT CommandTable xml.

    I would like to restrict visibility of this command to only the F# Editor.

    Is there an easy way to do this ?

    Cheers,

    Edmondo

    Sunday, May 8, 2011 10:13 AM

Answers

  • Got it :)

    DynamicVisibility in the VSCT and them implement:

     int IOleCommandTarget.QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
                       
     prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_ENABLED;

     

    Cheers,

    Edmondo

    Sunday, May 8, 2011 3:24 PM

All replies

  • Got it :)

    DynamicVisibility in the VSCT and them implement:

     int IOleCommandTarget.QueryStatus(ref Guid pguidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText)
                       
     prgCmds[0].cmdf = (uint)OLECMDF.OLECMDF_SUPPORTED | (uint)OLECMDF.OLECMDF_ENABLED;

     

    Cheers,

    Edmondo

    Sunday, May 8, 2011 3:24 PM
  • That should work as long as your package is loaded, we don't load pacakges to perform a QueryStatus.  You could also have a VisibilityItem in your VSCT tied to the F# language service GUID, which is BC6DD5A5-D4D6-4dab-A00D-A51242DBAF1B.

    Ryan

    Sunday, May 8, 2011 10:36 PM
  • sorry for bringing up an old post.

    how can this be done with VisibilityItem? can you post the code?

    Monday, March 26, 2012 1:06 PM
  • Hi Ryan,

    I also apologise for piggy backing on this thread, but my question is related to information in your last reply.

    "tied to the F# language service GUID, which is BC6DD5A5-D4D6-4dab-A00D-A51242DBAF1B"

    Where can we get a list of these types of GUIDS?


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Wednesday, February 13, 2013 2:25 PM
  • There is no such list. That GUID specifically doesn't appear to be published anywhere.
    Wednesday, February 13, 2013 3:55 PM
  • "There is no such list"

    Well, that explains why we can't find one. :-)

    "That GUID specifically doesn't appear to be published anywhere"

    The information has to exist somewhere, in order for you guys to be able to work with them, so I guess what I'm asking for (& it would be extremely helpful to the VSX community) is could a list be compiled & made available?


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

    Thursday, February 14, 2013 3:20 AM