Search code examples
visual-studiomefsmart-tags

List of Visual Studio's Built-In Smart Tags?


I frequently use the Show Smart Tag shortcut in Visual Studio 2010 (Ctrl + Period) when I want to generate using statements, implement interface methods, generate classes, etc.

I recently introduced this shortcut to my co-workers, and they love it.

Obviously, there is a host of contextual uses for this shortcut, and I feel like I've yet to find them all. Is there a central list of all the smart tags that come built-in with Visual Studio 2010? Or, is there a way for me to actually look at a list of smart tags that Visual Studio 2010 has loaded?

Thanks, Tedderz


Solution

  • There is nothing in the Visual Studio UI which will display the set of possible smart tags. You listed MEF in your tags though. If you are working with a MEF compontent it's very easy to query for this information at runtime. Simple import all uses of ISmartTagSourceProvider and query for the Name attribute

    [ImportMany]
    public List<ISmartTagSourceProvider> SmartTagProviders;
    
    void GetNames()
    {
      foreach (var provider in SmartTagProviders) { 
        var attrib = (NameAttribute)provider.GetType().GetAttribute(typeof(NameAttribute));
        attrib.Name;
      }
    }