Hi Flaviu,
> Is there any way one can get a CodeElement from the body of a VC++ (or
> even C#) function (local variable, function call etc.) using the
Automation and
> Extensibility API in VS .NET?
Do you mean is there an VS.NET Extensibility API similal to the
CodeElementFromPoint method or anything else, the usage of the
CodeElementFromPoint?
Thanks for your understanding!
Best regards,
Gary Chang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Flaviu Matan - 29 Dec 2004 12:33 GMT
Hi,
What I want to know is if CodeElementFromPoint can return a valid
CodeElement if the cursor is placed on the name of a local variable inside a
function body . Given the following piece of code:
int _tmain(int argc, _TCHAR* argv[])
{
int idx = 0;
return 0;
}
if the cursor is placed on "idx", CodeElementFromPoint called in my VC .NET
addin will return a vsCMElementFunction CodeElement coresponding to the
"_tmain" function (instead of a vsCMElementLocalDeclStmt I suppose).
Note: I called CodeElementFromPoint with every vsCMElement enum value, the
result being the same as mentioned above.
Please let me know if what I am trying to do is achiveable using
Extensibility API.
Thanks in advance,
Flaviu
> Hi Flaviu,
>
[quoted text clipped - 17 lines]
> This posting is provided "AS IS" with no warranties, and confers no rights.
> --------------------
Gary Chang[MSFT] - 30 Dec 2004 10:01 GMT
Hi Flaviu,
>What I want to know is if CodeElementFromPoint can return a valid
>CodeElement if the cursor is placed on the name of a local variable
>inside a function body
Do you mean a vsCMElementLocalDeclStmt here?
If so, I think it is impossible. A CodeFunction object only has the
CodeParameter elements, so you colud not retrieve a
vsCMElementLocalDeclStmt object from a function...
Thanks!
Best regards,
Gary Chang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------