microsoft / VS-Macros

An extension for Visual Studio 2013+ that enables the use of macros in the IDE. The extension can record most of the features in Visual Studio including text editing operations.
Other
131 stars 41 forks source link

Search and replace by regex. #66

Closed DasOhmoff closed 4 years ago

DasOhmoff commented 4 years ago

Hello, I would like to create a macro that searches and replaces text by regex. At the moment this is what I could come up with (in a javascript file):

dte.ExecuteCommand("Edit.Find");
dte.Find.FindWhat = "test";
dte.Find.ReplaceWith = "test";
//dte.Find.Target = dte.vsFindTarget.vsFindTargetCurrentDocument;
//dte.Find.PatternSyntax  = dte.vsFindPatternSyntax.vsFindPatternSyntaxRegExpr;

The last 2 lines give me errors (the lines where I try to set the target to the current document and the search type to a registry expression). How can I fix this and how can I make this work?

DasOhmoff commented 4 years ago

I just used the numbers in the enum instead of the enum itself.