Author Topic: todo Macro  (Read 4525 times)

Zeev

  • New Community Member
  • Posts: 1
  • Hero Points: 0
todo Macro
« on: July 26, 2006, 03:03:18 pm »
I just downloaded from the site a macro that lists all todo(s) in a certain file.

Does anyone know if there is a macro to do the on a project level (or change the per file macro to a per project macro)

Appreciate any help
Zeev

hs2

  • Senior Community Member
  • Posts: 2737
  • Hero Points: 288
Re: todo Macro
« Reply #1 on: July 26, 2006, 04:58:09 pm »
I also used it, but it wasn't good enough for me too.
I make use of Slicks sophisticated search feature.
In fact I tailored my find_word_sel() macro I already posted here http://community.slickedit.com/index.php?topic=171.0.
The good thing: You can define your own patterns (cur_word) e.g. ZEEVDO ;)
The not-so-good thing: You've to invoke it manually (no auto-update).
But at least you can easily step thru all TODOs in the usual way (find-next / -prev).
Code: [Select]
// HS2: opt: c == current buffer, b == all buffers, p == project files, w == workspace files
_command int hf2,hs2_find_todo (_str opt = 'c') name_info (','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL|VSARG2_MARK)
{
   int status = 0;

   _str search_options = make_search_options (VSSEARCHFLAG_WORD |
                                              VSSEARCHFLAG_RE |
                                              VSSEARCHFLAG_HIDDEN_TEXT |
                                              VSSEARCHFLAG_NOSAVE_TEXT |
                                              VSSEARCHFLAG_FINDHILIGHT |
                                              VSSEARCHFLAG_GO, true);

   search_options = search_options :+ '@W:PCCF';

   // _str cur_word = '(TODO)|(HS2DO)|(HS2)|(TRACE)';
   _str cur_word = '(TODO)|(HS2DO)|(HS2)';

   clear_highlights ();

   // HS2: dbg
   // say ("search options: '" search_options "'");
   int mfff = MFFIND_THREADED | MFFIND_GLOBAL;
   int grep_id = 9;   // -> Search<9>

   if ( cur_word != '' )
   {
      switch ( opt )
      {
         case 'b':
            status=_mffind (cur_word, search_options, MFFIND_BUFFERS, "", mfff , false, false, '', '', true, grep_id);
            break;
         case 'p':
            status=_mffind (cur_word, search_options, MFFIND_PROJECT_FILES, "", mfff, true, false, '', '', true, grep_id);
            break;
         case 'w':
            status=_mffind (cur_word, search_options, MFFIND_WORKSPACE_FILES, "", mfff, false, true, '', '', true, grep_id);
            break;
         case 'c':
         default:
            status=_mffind (cur_word, search_options, MFFIND_BUFFER, "", mfff, false, false, '', '', true, grep_id);
      }

      hs2_activate_edit ();
   }
   return( status );
}

// (aliased) wrappers to be bound to keyboard shortcuts are to quickly call'em on cmdline
_command int hf2b,hs2_find_todo_buffers () name_info (','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL|VSARG2_MARK)
{
   return(hs2_find_todo ('b'));
}
_command int hf2p,hs2_find_todo_project () name_info (','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL|VSARG2_MARK)
{
   return(hs2_find_todo ('p'));
}
_command int hf2w,hs2_find_todo_wkspace () name_info (','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL|VSARG2_MARK)
{
   return(hs2_find_todo ('w'));
}

Hope this workaround is ok for you too, HS2