Loading ...
Sorry, an error occurred while loading the content.
 

Best way for an AddIn to Find in Files?

Expand Messages
  • n/a
    Hi, I want to add a method to my AddIn that will build a collection of file names and line numbers that contain my searchString. My idea is to populate a
    Message 1 of 3 , Aug 1, 2005
      Hi,

      I want to add a method to my AddIn that will build a collection of
      file names and line numbers that contain my searchString.

      My idea is to populate a collection with instances of a struct that
      contain the file name/line number pairs where each occurrence of my
      search string exists in the entire open solution.

      I suppose I could use DTE.Find and direct the results to
      vsFindResultsLocation.vsFindResults1, and then use some ugly code to
      select all the text in the FindResults1 window and parse it.

      However, I am hoping there is a more direct and efficient way to do
      it. Can anyone make a recommendation? Thanks.

      David
    • Thierry Miceli
      ... You could perform a regular expression search on the files without using Visual Studio automation. For C++ there is the boost regex library. ... Thierry
      Message 2 of 3 , Aug 1, 2005
        >I want to add a method to my AddIn that will build a collection of
        >file names and line numbers that contain my searchString.
        >
        >My idea is to populate a collection with instances of a struct that
        >contain the file name/line number pairs where each occurrence of my
        >search string exists in the entire open solution.
        >
        >I suppose I could use DTE.Find and direct the results to
        >vsFindResultsLocation.vsFindResults1, and then use some ugly code to
        >select all the text in the FindResults1 window and parse it.
        >
        >However, I am hoping there is a more direct and efficient way to do
        >it. Can anyone make a recommendation? Thanks.
        >
        You could perform a regular expression search on the files without using
        Visual Studio automation.
        For C++ there is the boost regex library.

        ----
        Thierry Miceli
        www.refpp.com
      • Quintero Vivar, Carlos Javier
        Hi David, If you want maximum performance, you have to skip the automation model and search directly on the files (similar to the Find in Files feature of VS).
        Message 3 of 3 , Aug 8, 2005
          Hi David,

          If you want maximum performance, you have to skip the automation model and
          search directly on the files (similar to the Find in Files feature of VS).
          The drawback is that only searches commited changes to disk, not the actual
          source code.

          If you want to search the source code, for each ProjectItem, get its
          TextDocument, get the initial TextPoint, create EditPoint and use the
          EditPoint.FindPattern method. It will move to the initial editpoint of the
          match and it will return the final point of the match. Then you call it
          again, etc. No results window involved here.

          Best regards,

          Carlos J. Quintero

          MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
          You can code, design and document much faster.
          Free resources for add-in developers:
          http://www.mztools.com <http://www.mztools.com/>


          -----Mensaje original-----
          De: vsnetaddin@yahoogroups.com [mailto:vsnetaddin@yahoogroups.com] En nombre
          de n/a
          Enviado el: martes, 02 de agosto de 2005 02:22
          Para: vsnetaddin@yahoogroups.com
          Asunto: [vsnetaddin] Best way for an AddIn to Find in Files?


          Hi,

          I want to add a method to my AddIn that will build a collection of
          file names and line numbers that contain my searchString.

          My idea is to populate a collection with instances of a struct that
          contain the file name/line number pairs where each occurrence of my
          search string exists in the entire open solution.

          I suppose I could use DTE.Find and direct the results to
          vsFindResultsLocation.vsFindResults1, and then use some ugly code to
          select all the text in the FindResults1 window and parse it.

          However, I am hoping there is a more direct and efficient way to do
          it. Can anyone make a recommendation? Thanks.

          David



          Internet Email Confidentiality footer Este mensaje y cualquier fichero adjunto esta dirigido unicamente a sus destinatarios y pueden contener informacion confidencial. Si usted considera que ha recibido este correo electronico por error (por asunto, por remitente o por cualquier otra causa), le informamos que cualquier revision, alteracion, impresion copia o transmision de este mensaje o de cualquier fichero adjunto esta prohibida y puede constituir un acto ilegal. Por favor, notifiquele el error al remitente respondiendo a este e-mail y elimine el mensaje y su contenido inmediatamente.


          This e-mail and any files transmitted with it are intended soley for the use of the intended recipients and may contain confidential information. If it appears (from the subject matter or address information or otherwise) that you received this email in error, please note that any review, dissemination, disclosure, alteration, printing, copying or transmission of this e-mail or any file transmitted winth it is prohibited and may be unlawful. Please notify us by return email and delete this email and its contents immediately.


          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.