jimjim
jimjim

Reputation: 2503

How to automate Find in files feature of Visual Studio?

How can I pragmatically automate Find in Files feature from outside/inside VS? For example I want to

  1. Programmaticaly run a find in files

  2. Save the results into a file Programtically after doing some processing on the results.

I be happy with just number 2 only.

Is this the correct way to do it? or Should I be hooking into another extension point that provides the search functionality for VS instead of hooking into VS's own Find and search results itself?

I have been able to find many examples about text editor extensiblity , displaying icons images in the text, but nothing for hooking into serach and results extension points.

Upvotes: 0

Views: 171

Answers (1)

Sergey Vlasov
Sergey Vlasov

Reputation: 27890

You can use the DTE.Find object to specify search options and run a query with DTE.Find.Execute(). Then use DTE.ActiveDocument selection to get search result. See "6. Prompt for a search string and list all matching lines from the current file" sample from Visual Commander commands.

Upvotes: 1

Related Questions