Venkatesh
Venkatesh

Reputation: 1577

Visual studio extension : get name of right-clicked function

I want to create a Visual studio 2013 extension. When I right click on any function it should give options like "generate stub". On clicking on that option I should be able to generate some specific lines of code.

To be frank, I do not know which part of Visual studio SDK will be useful. The part of code that I want to generate needs to know which function has been clicked, along with its class name.

Which part of Visual Studio SDK should I refer to ?

Upvotes: 1

Views: 306

Answers (1)

Carlos Quintero
Carlos Quintero

Reputation: 4414

You need to use the automation model (EnvDTE).

First, get the EnvDTE.DTE instance from your package:

HOWTO: Get an EnvDTE.DTE instance from a Visual Studio package. http://www.visualstudioextensibility.com/articles/packages/

Second, see:

HOWTO: Get the code element at the cursor from a Visual Studio .NET macro or add-in. http://www.visualstudioextensibility.com/articles/add-ins/

Upvotes: 3

Related Questions