Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

How to change EnvDte.CodeFunction.Type (function returning type)?

$
0
0

Hello, i write a VS plugin (using C#), that parse opened solution (C++) and can make some changes there.

I need to change some variable and functions types.

I read this thread http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/82f7fab5-a638-4932-aa75-7e32297048e1/ and for variables its usefull, but when i try to change type of function using EditPoint.ReplaceText - it doesn't change function prototype.

for example i have this code:

class MyClass
{public: void get(int p);
}void MyClass::get(int p)
{
}

And i try to change it:

try
{
EditPoint2 startPoint = (EditPoint2)elem.GetStartPoint(vsCMPart.vsCMPartAttributes).CreateEditPoint();

TextPoint endPoint = elem.GetEndPoint(vsCMPart.vsCMPartBody);
String prototype = startPoint.GetText(endPoint);

//... Some actions with textBody, returning String newPrototype//newPrototype = "int MyClass::get(int p)\r\n{\r\n\tint a;\r\n\tint b;\r\n\tint c;\r\n";

startPoint.ReplaceText(endPoint, newPrototype, (int)vsEPReplaceTextOptions.vsEPReplaceTextAutoformat);
}
Thesechanges do notaffect the function prototype in the class.


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>