SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => SlickEdit User Macros => Topic started by: MartyL on June 03, 2010, 03:33:33 pm

Title: ToDo List Toolbar (Updated for SE2017/SE2019)
Post by: MartyL on June 03, 2010, 03:33:33 pm
Current version: 1.1
Author: Marty Lewis

Important Note:
This feature has been modified to work with SlickEdit 22 and up, but appears to work okay back to SlickEdit 14. Back up your SlickEdit configuration directory prior to loading this module in case some kind of conflict occurs. Bug reports or additional feature requests can be posted in this thread.

This module implements a toolbar and methods for tracking "TODO:" statements in source code comments. It uses SlickEdit's search functionality to quickly parse through relevant code. It also makes use of several SlickEdit APIs to present a toolbar interface that attempts to match the look and feel of your existing SlickEdit interface. After loading, right-click in the toolbar to see the commands and options.

The following commands can be bound to keys or run from the SlickEdit command line:
Code: [Select]
// This command begins the process of searching all the source files in your
// workspace for TODO: statements.
// This is also in the right-click menu as Generate TODO List
_command void ToDo_GenerateList();

// This command takes the existing TODO: data and sorts it by project then filename.
// Future calls to ToDo_GenerateList() will default to this sort.
// This is also in the right-click menu under Sort By > Project
_command void ToDo_SortByProject();

// This command takes the existing TODO: data and sorts it just by filename.
// Future calls to ToDo_GenerateList() will default to this sort.
// This is also in the right-click menu under Sort By > File
_command void ToDo_SortByFile();

// This command toggles the TDML parsing on or off.
// This is also in the right-click menu under TDML > Use TDML
_command void ToDo_ToggleTDML();

// This command toggles the alternate TDML parsing on or off.
// This is also in the right-click menu under TDML > Use Alternate TDML
_command void ToDo_ToggleAltTDML();

// This command will take you to the file or todo statement currently selected
// in the toolbar. It opens an editor window containing the source file. If a
// todo statement was selected then it places the cursor on the correct line
// and column.
// This is also in the right-click menu as Goto TODO
// This can also be invoked by double-clicking an entry in the list
_command void ToDo_ViewSource();

One of the added values in this toolbar is the introduction of a simple syntax for setting the importance and/or name for a particular TODO statement. A single character indicates above average importance or high importance. Anything else before the colon indicates the title. For example:
Code: [Select]
// TODO! Really Important Task:
// TODO^ Fairly Important Task:
Those two items would show up in the toolbar with different icons indicating the importance level. The rest of the text preceding the colon would also show up in the toolbar as a name you specified by which to reference the particular TODO item.

If you turn on Alternate TDML parsing, the name text is pulled from the other side of the colon to the end of the line. For example:
Code: [Select]
// TODO: Important task
//           The rest of my description about this todo task

This would result in the name being "Important task". Alternate TDML parsing is likely to produce some strange TODO name's as most people will not have taken this into account when writing TODO statements.

Changelog:
Code: [Select]
Version 1.1:
  2017 compatibility - Handle boolean > bool change, handle deprecated maybe_quote_filename, handle naming change to _pic_ut_package_failure and _pic_ut_package_notrun - should still be backwards compatible

Version 1.0:
  Work around SlickEdit RegEx bug.

Version 0.9:
  Support for new tool window infrastructure in SE2015-SE2016.

Version 0.8:
  Be less picky about how a user starts their ToDo descriptions. Don't require alphanumeric.

Version 0.7:
  Fix for Shelku, error when executing ToDo_GenerateList outside of the toolbar context.

Version 0.6:
  Courtesy of Sandra, updated to work with SlickEdit 16

Version 0.5:
  Fixed an error that would occur when ToDo_GenerateList() was run while the toolbar was not visible
  Merged vivitron's Message List changes

Version 0.4:
  Made a minor code change to allow the module to load in SlickEdit 14

Version 0.3:
  Support for alternate TODO style (listing comment after TODO:)

Version 0.2:
  Support for Visual Studio projects
  Fixed a platform bug where I was using an explicit Windows path separator

Version 0.1:
  Initial release

This feature is based on a request found in the SlickEdit forum: http://community.slickedit.com/index.php?topic=6081.0
Special thanks to ehab for testing the toolbar in ways that I had not considered.
Extra thanks to vivitron for implementing an integration with the SlickEdit Message List toolbar to insert todo information.
Even more thanks to SlickEdit's Sandra for updating the macro to work with SlickEdit 16.

(Over 400 downloads!)
Title: Re: ToDo List Toolbar
Post by: evanratt on June 08, 2010, 05:30:51 pm
Very cool! One super-minor bug: if a user were to be *very* degenerate (not that I'd ever try to do anything like this) and call ToDo-GenerateList while the toolbar wasn't open, it results in a SlickC stack.
Title: Re: ToDo List Toolbar
Post by: vivitron on June 08, 2010, 05:56:06 pm
There is a new version that fixes that bug and adds the ability for the list to appear in the SE Message List window as well..

See this thread: http://community.slickedit.com/index.php?topic=6081.0
Title: Re: ToDo List Toolbar
Post by: MartyL on June 08, 2010, 06:42:20 pm
vivitron makes a very good point. I suppose that I need to update this thread.
Title: Re: ToDo List Toolbar
Post by: DomDom on May 17, 2011, 12:24:53 pm
Hi Marty,

Thanks for this macros, very useful, 

but can you consider to update it so it can run with the latest version 16 (It seems that in their newer version they change some of the function call)

Thanks,

Dom.
Title: Re: ToDo List Toolbar
Post by: LBCEi on June 21, 2011, 04:47:55 pm
According to Sandra in this post: http://community.slickedit.com/index.php?topic=6736.0 and a support case reply from Mike Cohen:

You need to make a change to a function call in todo.e:

On line 536, change:

if (GetProjectFilesArray(project, files) < 0)

to:

if (_getProjectFiles(_workspace_filename, project, files, 1))

I'm still in the process of trying this fix myself.
Title: Re: ToDo List Toolbar
Post by: Sandra on June 22, 2011, 02:07:00 pm
I have made a little tweak to the version that was posted in this thread to account for changing functions for v16.  This new version should work in both v16 and v15 (and whatever previous versions were supported before).
Title: Re: ToDo List Toolbar
Post by: MartyL on June 22, 2011, 04:40:35 pm
Thanks for the update Sandra. I haven't moved to 16 yet myself and had not checked this thread in a while!

Edit: Updated the macro in the original post with the changes. Thanks again!
Title: Re: ToDo List Toolbar
Post by: DomDom on June 28, 2011, 12:42:32 pm
Thanks Sandra and MartyL !!!

Works great!!

Dom.
Title: Re: ToDo List Toolbar
Post by: Shelku on December 01, 2011, 01:48:38 am
Wow - I just noticed this macro and it's great!

However, it only seems to work if I right-click on the ToDo window and generate the list from there. If I try to execute the command "ToDo_GenerateList" from a menu button or by hitting ESC and typing it I got the error

Code: [Select]
This property or method is not allowed on this object. file=todo.ex offset=998(SlickEdit 2011 v16.0.3.0 64-bit)
Title: Re: ToDo List Toolbar
Post by: MartyL on December 13, 2011, 04:48:57 pm
Hi Shelku,

I just noticed your bug report. I'm not sure how that one slipped through the cracks during testing. Posting up a fix right now.

Hope this helps!
Title: Re: ToDo List Toolbar
Post by: bkerske on January 19, 2012, 04:16:06 pm
This is a real simple question I hope.  I loaded the todo.e macro but can't figure out how to get a project to be recognized.  My Todo tab is empty?  How do you define projects or the project files that reside in the tab like some of the screen shots I've seen?
Thanks  [/size]
Title: Re: ToDo List Toolbar
Post by: MartyL on January 19, 2012, 04:29:13 pm
Hi bkerske,

It uses the projects that are in your current workspace. It's designed to show you the todo list for your current working area. After you open your workspace, right-click the toolbar and generate the list.

Hope this helps!
Marty
Title: Re: ToDo List Toolbar
Post by: bkerske on January 19, 2012, 08:17:20 pm
Marty,
Thanks, after reading your post I tried on a whim closing the workspace and reopening it and that seemed to work.  Closing my workspace out when I close SE is not typical for me (I did close SE all together several times) and it is something I didn't do (obviously) after I loaded the macro.
Title: Re: ToDo List Toolbar
Post by: MartyL on June 11, 2012, 11:33:28 pm
Tested on v17 today. Everything seems to be working, but docking in a tabgroup loses icon/title. Looks like a change in behavior. I'll see if I can iron it out.
Title: Re: ToDo List Toolbar
Post by: china_sundasheng on July 14, 2012, 09:47:23 am
In v17, the BMP files have changed to ICO, so modifing bmp to ico in todo.e is ok.
Title: Re: ToDo List Toolbar
Post by: ehab on September 03, 2012, 08:30:26 am
on SlickEdit 2012 (v17.0.2.0 64-bit) with hotfix_se1702_3_cumulative.zip (Revision: 3)

i had to change
Code: [Select]
_tbShow(_TBTODO, 200, 200, 3000, 6000);to
Code: [Select]
_tbShowDocked(_TBTODO);
so it will be docked every time i start SE since thats how i have todo window, otherwise it will keep showing up.
Title: Re: ToDo List Toolbar
Post by: bremenpl on March 12, 2014, 01:40:16 pm
Hello,
I have also tested this using version 18.0.1 and it seems to be working. I have a question though- Is it possible to run ToDo_GenerateList() everytime slickedit is opened?
Title: Re: ToDo List Toolbar
Post by: china_sundasheng on March 13, 2014, 01:20:27 am
Adding this func. When workspace is opened, it can scan automatically.
void _workspace_opened_GenTodoList()
{
  ToDo_UpdateList();
}
Title: Re: ToDo List Toolbar
Post by: Shelku on August 29, 2014, 09:52:08 pm
Hi MartyL!

I just tried this macro in SE 2014 beta1, but I can't seem to view the TODO tool window. It doesn't show up in the Tool Windows list and I can't manually bring it up either. When I try to manually run "ToDo-GenerateList", I get a Slick-C Error for 'Invalid object handle" (file=todo.ex offset=365) from trying to render the results.

I know this is getting old now, but I'd appreciate it if you could update it for the new version of SE!
Title: Re: ToDo List Toolbar
Post by: LBCEi on August 29, 2014, 10:25:44 pm
I noticed the same issue.  An update would be much appreciated.
Title: Re: ToDo List Toolbar
Post by: LBCEi on November 04, 2014, 08:31:20 am
Has anyone been able to get this very useful macro/toolbar(toolwindow?) to work in V19 beta/RC?

This is one of my favorite utilities and I would hate to think that it is beyond repair for working with V19.

Any help would be much appreciated.

Sandra contributed some useful help in getting this updated for a previous SE version update.  Could you take another look at this, Sandra?

I suspect it is something related to the major toolwindow/toolbar rework to allow for floating, etc.  (BTW - can someone point me to an explanation of the real differences between toolwindows and toolbars?)

Thanks
Title: Re: ToDo List Toolbar
Post by: Graeme on November 04, 2014, 11:01:49 pm
Has anyone been able to get this very useful macro/toolbar(toolwindow?) to work in V19 beta/RC?

This is one of my favorite utilities and I would hate to think that it is beyond repair for working with V19.

Any help would be much appreciated.

Sandra contributed some useful help in getting this updated for a previous SE version update.  Could you take another look at this, Sandra?

I suspect it is something related to the major toolwindow/toolbar rework to allow for floating, etc.  (BTW - can someone point me to an explanation of the real differences between toolwindows and toolbars?)

Thanks

I'll have a look at it this coming weekend if no-one else does.  Can you tell me what this thing is all about?  Could you use one of the new floating windows with its own docked search results window and a "TODO" layout.  What does the TODO toolwindow give you?
Title: Re: ToDo List Toolbar
Post by: LBCEi on November 05, 2014, 02:03:30 am
Here are some screenshots from SE V18 where this macro works just fine.

It generates a toolwindow with a context menu (see Capture1) that allows you to set some options and then 'generate' the ToDo list.  This list shows up in the ToDo toolwindow in a by-file tree view (see Capture2) and, optionally, in the Message List (see Capture3).  You can then double-click to navigate to the source file where the ToDo comment appears (see Capture4).

I normally keep it docked at the bottom of my main window along with Search Results, Preview, Build, Message List, and Output.

Very handy.  Especially if you annotate your 'ToDo' comments to indicate what type of issue/change it refers to such as a temporary change due to testing a new feature.

The macro loads (apparently successfully) in V19 but the toolwindow never appears.

I haven't seen any posts from the original author of this macro in a couple of years.

Edit: BTW, I use another macro (CodeMarkup.e by chrisant, see this thread http://community.slickedit.com/index.php/topic,3633.msg17197.html#msg17197 (http://community.slickedit.com/index.php/topic,3633.msg17197.html#msg17197)) that highlights the 'ToDo' comments in the source code.  Also very nice.  This one works just fine in V19.
Title: Re: ToDo List Toolbar
Post by: Graeme on November 05, 2014, 12:05:38 pm
Is the latest version of todo.e the one that Sandra posted in this thread - in 2011?

If I can't get it working I'll ask slickedit support to help me - it should be easy for them...

The help file needs some information on how to create your own toolwindows.  I had some help from Rodney here who explained you need to call tw_register_form to register a toolwindow.
http://community.slickedit.com/index.php/topic,10236.msg43243.html#msg43243 (http://community.slickedit.com/index.php/topic,10236.msg43243.html#msg43243)

BTW - the help file says toolbars have only command buttons and toolwindows have all kinds of stuff, more or less.
Title: Re: ToDo List Toolbar
Post by: Graeme on November 06, 2014, 02:37:12 pm
Hi LBCEi
Can you try this please and let me know if anything isn't working correctly.
Title: Re: ToDo List Toolbar
Post by: Shelku on November 06, 2014, 05:09:50 pm
Hi LBCEi
Can you try this please and let me know if anything isn't working correctly.
Awesome! It looks like it works in both SE13 (v18.0.1.2 64-bit) and SE14 RC4 (v19.0.0.13 64-bit)! Thanks a lot Graeme!

Do you know if there's a way to have it automatically generate the ToDo list whenever a workspace/project is loaded?
Title: Re: ToDo List Toolbar
Post by: LBCEi on November 06, 2014, 06:46:06 pm
Thank you, Graeme!

Seems to work just fine.

Much appreciated.

HP++
Title: Re: ToDo List Toolbar
Post by: Graeme on November 07, 2014, 12:07:17 am

Do you know if there's a way to have it automatically generate the ToDo list whenever a workspace/project is loaded?

Add these functions.  You may not need the second function.

Code: [Select]
void _workspace_opened_todo_list()
{
   ToDo_GenerateList();
}

void _project_opened_todo_list()
{
   ToDo_GenerateList();
}
Title: Re: ToDo List Toolbar
Post by: LBCEi on September 23, 2016, 04:49:28 pm
Has anyone else noticed that this macro no longer displays the descriptions for the TODO items in SE2015 and later?

I've attached example screenshots from SE2014 (19.02) and SE2016beta5.  Note that the screenshot from SE2014 shows descriptions for each of the TODO items that are extracted from the TODO comments in the source code, while the screenshot from SE2016beta15 only shows the line and column.  I tried in SE2015 (20.0.3) and it doesn't show the descriptions either.

If anyone has any idea on how to fix this, it would be much appreciated.
Title: Re: ToDo List Toolbar
Post by: MartyL on September 23, 2016, 05:19:36 pm
It's been a while, but I just gave Sandra's most recent version a try in SE18 and the descriptions were working okay as long as I followed this format:
Code: [Select]
// TODO description: more info
I can't imagine that the regex broke in a new SE version, but the tree view could have changed.
Title: Re: ToDo List Toolbar
Post by: LBCEi on September 23, 2016, 05:25:58 pm
I have been using the "Alternate TDML" form.  For example:
Code: [Select]
//TODO: (LB) DMAenabled = TRUE;
Perhaps the regex for this got broken?
Title: Re: ToDo List Toolbar
Post by: MartyL on September 23, 2016, 05:28:11 pm
The regex certainly doesn't seem to handle the parenthesis, that's for sure. Should be an easy enough fix.
Title: Re: ToDo List Toolbar
Post by: LBCEi on September 23, 2016, 05:32:48 pm
I don't always use the parentheses but I do almost always start the comment like this:

Code: [Select]
//TODO:
Title: Re: ToDo List Toolbar
Post by: MartyL on September 23, 2016, 05:35:50 pm
Give this one a try and let me know if it works better.
Title: Re: ToDo List Toolbar
Post by: LBCEi on September 23, 2016, 05:54:52 pm
When I try to load this in SE2015 or SE2016b5 I get this message in the status bar:

Expecting procedure name - identifier not found - import may be required

I didn't try it in SE2014.  It seems to be related to the _tbIsVisible call in this section of code

Code: [Select]
defload()
{
    if (_tbIsVisible(_TBTODO))
    {
tbHide(_TBTODO);
    }

Title: Re: ToDo List Toolbar
Post by: MartyL on September 23, 2016, 05:58:36 pm
Downloading 2016 RC3 to take a look at it.
Title: Re: ToDo List Toolbar
Post by: LBCEi on September 23, 2016, 05:59:51 pm
It does the same thing in 2015 (20.0.3)
Title: Re: ToDo List Toolbar
Post by: MartyL on September 23, 2016, 08:21:17 pm
It looks like somewhere between 18 and 21 (guessing 20), SlickEdit moved away from the toolbar type that this originally relied on. There's a whole new infrastructure for tool windows, instead.

Shouldn't be too bad to fix it but it isn't going to be backward compatible anymore.
Title: Re: ToDo List Toolbar
Post by: MartyL on September 23, 2016, 08:49:30 pm
Spoke too soon. Wasn't difficult to #ifdef between the versions. The new file should continue working on old editors.

Any chance you could try it on SE2015, LBCEi?
Title: Re: ToDo List Toolbar
Post by: Clark on September 23, 2016, 08:51:50 pm
Here's one that works for the newer APIs. I didn't try to make it work with older versions of SlickEdit.
Title: Re: ToDo List Toolbar
Post by: LBCEi on September 23, 2016, 10:14:15 pm
@MartyL

Your revised version loads successfully in SE15 and SE16b5 but it still does not populate the description fields in the ToDo toolwindow or the Message List.

I'm going to try Clark's version next and I'll report back.

Thanks,
Les
Title: Re: ToDo List Toolbar
Post by: LBCEi on September 23, 2016, 10:39:14 pm
Clark's version loads as well but also does not show the descriptions.

It looks like Marty put quite a bit of work into backward compatibility so, if we can fix the regex, I would vote for his version.  Personally, once SE16 is released, I doubt I'll use the older versions anymore but there are a lot of folks who are still using older versions (of course the number that use this macro with the Alternate TDML may be quite small).

There are some differences between Clark's version and the #if __VERSION__ >= 20 sections of Marty's version and I don't know which approach is best for these sections of the code.  There is a lot of commonality between the two sets of changes as well. 

Thank you both for looking into this
Les
Title: Re: ToDo List Toolbar
Post by: MartyL on September 23, 2016, 11:20:14 pm
Hopefully Clark drops back in here. It looks like someone broke SlickEdit Regular Expressions in 20/21. It looks like the actual bug is that a :b following a tagged expression breaks the tagged expression.

Consider the following test case:
Code: [Select]
// TODO: Simple test
The following two regexes produce different results:
Code: [Select]
{#0TODO}:b*
{#0TODO}[ \t]*

I'm modifying the file on the main post to work around this problem.
Title: Re: ToDo List Toolbar
Post by: Clark on September 24, 2016, 01:10:58 am
I fixed the regex. I have to admit that I don't know exactly what this code is supposed to do. I would have thought that the regex was supposed to pick up the todo message to the right of the colon but it definitely doesn't.
Title: Re: ToDo List Toolbar
Post by: LBCEi on September 24, 2016, 01:18:24 am
The "Alternate TDML" regex used to (in SE2014 and earlier) pick up the stuff to the right of the colon and put it into the Description field.
Title: Re: ToDo List Toolbar
Post by: Clark on September 24, 2016, 01:28:31 am
Ah..you have to toggle that option on.
Title: Re: ToDo List Toolbar
Post by: Clark on September 24, 2016, 01:29:43 am
The problem with the regex was the expression ":b*" and ":b@". Previously this worked and it is currently broken (simple fix).

Having said that, :b was really a bad idea for a built-in regex because it gets incorrectly used. Too bad is too late to change that. It's being incorrectly used in this regex. :b actually is [ \t]# and not just [ \t]. Putting a loop around a loop is very bad. You really don't want ([ \t]#)*. It makes the regex engine do way to may tries.
Title: Re: ToDo List Toolbar
Post by: MartyL on September 24, 2016, 03:44:53 am
Yeah, I fixed the regex earlier and re-uploaded the original post. I saw the nuance in :b while I was fixing the script earlier.

Hope everything is working better for you now, LBCEi!
Title: Re: ToDo List Toolbar
Post by: LBCEi on September 24, 2016, 04:10:27 am
The version at the top of this thread solved the problems.

Thank you so much Marty (and Clark).

I wonder if the other versions that are scattered throughout the thread could/should be cleaned up (removed) to avoid confusion for future visitors.

Les
Title: Re: ToDo List Toolbar
Post by: MartyL on September 24, 2016, 05:51:53 am
I wonder if the other versions that are scattered throughout the thread could/should be cleaned up (removed) to avoid confusion for future visitors.

Great plan. I just cleaned up my extras throughout. Glad to hear it's working again.
Title: Re: ToDo List Toolbar (Updated for SE2016)
Post by: nghate on October 25, 2017, 10:33:04 pm
Do we have an updated version of the todo List Tool bar for SE2017? I tried using a version from this thread (ver 0.8) and it does not seem to load. I am not a pro user so it will take me a while to figure out why it did not load...
Title: Re: ToDo List Toolbar (Updated for SE2016)
Post by: MartyL on October 25, 2017, 11:17:06 pm
Hey there nghate!

I downloaded 2017 this afternoon and fixed up the macro. You can find a version 1.1 in the first post that should work in 2017 and still be backward compatible. I don't have a Standard Edition license, so I wasn't able to test there. But it is working well in Pro.
Title: Re: ToDo List Toolbar (Updated for SE2017)
Post by: JimS on December 24, 2019, 02:44:33 am
This thread has not been updated in a couple years. Does anyone still use this script? Does anyone have an update that works with SE2019?
Title: Re: ToDo List Toolbar (Updated for SE2017)
Post by: LBCEi on December 24, 2019, 03:17:58 am
I'm still using it regularly.  If you get the version from the first post in this thread it should work up to the latest version of SE:

https://community.slickedit.com/index.php/topic,6129.msg25274.html#msg25274
Title: Re: ToDo List Toolbar (Updated for SE2017)
Post by: MartyL on January 06, 2020, 05:14:23 pm
I'll get SE 2019 downloaded to see if there's any issues.