Recent

Author Topic: Any way to change the TODO comment?  (Read 4079 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1800
Any way to change the TODO comment?
« on: May 23, 2025, 10:19:31 am »
I can directly change the content. But is there any way to open it again in the small message box so that I can change "category"?

dsiders

  • Hero Member
  • *****
  • Posts: 1632
Re: Any way to change the TODO comment?
« Reply #1 on: May 23, 2025, 05:43:13 pm »
I can directly change the content. But is there any way to open it again in the small message box so that I can change "category"?

DId you try the View > TODO List menu option?

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4715
  • I like bugs.
Re: Any way to change the TODO comment?
« Reply #2 on: June 25, 2025, 10:43:36 am »
I can directly change the content. But is there any way to open it again in the small message box so that I can change "category"?
I guess you mean the "Insert a ToDo/Done/Note" dialog from editor's popup menu.
Indeed, it can only be used to add a new ToDo item but not to edit an existing one. Yes, there should be an Edit button in the ToDo List window.
I will add this task to my personal ToDo list.  :)
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

vangli

  • Jr. Member
  • **
  • Posts: 57
Re: Any way to change the TODO comment?
« Reply #3 on: June 25, 2025, 01:52:34 pm »
You may also change category in the code, like:

Code: Pascal  [Select][+][-]
  1. { #todo 3 -oBent -cDevelopement : Cloacked in release version until fully developed. }

You see the "-c". Just write new category instead of Developement as showed in my example, and in the todo view list just refresh view.
Regards Bent

MarkMLl

  • Hero Member
  • *****
  • Posts: 8572
Re: Any way to change the TODO comment?
« Reply #4 on: June 25, 2025, 02:04:28 pm »
You may also change category in the code, like:

OP's already said "I can directly change the content." which amounts to the same thing.

I'm in broad agreement that having some methodical way of editing this from the report box would be extremely useful, since apart from anything else it would eliminate the risk of inadvertently changing the format of the embedded text in a way that broke something.

Perhaps the most important thing is that it would also allow categories and owners to be split and merged to suit the resources available. Which also suggests that "multiply all priorities by ten" or "add five to all these priorities" would be useful.

(Posted hesitantly, since I'm not the one with the understanding of how to do the work :-)

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

n7800

  • Hero Member
  • *****
  • Posts: 707
  • Lazarus IDE contributor
    • GitLab profile
Re: Any way to change the TODO comment?
« Reply #5 on: June 25, 2025, 02:13:04 pm »
Then I will in turn ask for the possibility of group editing ))

So that it would be possible to select several items at once and specify one category/priority/etc for them.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4715
  • I like bugs.
Re: Any way to change the TODO comment?
« Reply #6 on: June 25, 2025, 06:00:32 pm »
OK, the latest suggested changes require some fancy GUI design.
From GUI point of view editing a single item is easy because it can reuse the same dialog.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4715
  • I like bugs.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

n7800

  • Hero Member
  • *****
  • Posts: 707
  • Lazarus IDE contributor
    • GitLab profile
Re: Any way to change the TODO comment?
« Reply #8 on: June 27, 2025, 10:26:01 pm »
OK, the latest suggested changes require some fancy GUI design.
From GUI point of view editing a single item is easy because it can reuse the same dialog.

I see a couple of options. The simplest of them is to add the following commands to the context menu:
* Edit type ...
* Edit category ...
* Edit priority ...
* Edit owner ...
* Edit text ...
Each will open something like an InputBox, and the entered value will be set for all selected elements.

It is even possible to specify all of them in the "Group editing >" submenu (of context menu), which will only appear with multiple selections. But now I see that there is no context menu at all, so this is not necessary for now.

A more complex option is, of course, to change the editing dialog so that it supports "group editing". More precisely, it should apply only those fields that the user has changed, and leave the rest untouched. But this is a separate topic...

n7800

  • Hero Member
  • *****
  • Posts: 707
  • Lazarus IDE contributor
    • GitLab profile
Re: Any way to change the TODO comment?
« Reply #9 on: June 27, 2025, 10:58:06 pm »
I added an Edit button in
 https://gitlab.com/freepascal.org/lazarus/lazarus/-/commit/87f0aec5708434c230bec1b0b89dda6830b0f3c3
Please test.

And I added shortcuts ))

A small problem is that to use the button in the toolbar, you first need to somehow select the item in the list. Although when you click it, it immediately opens it in the Source Editor. You have to open the window again and then click "Edit" in toolbar (or you can use [F2] after my commit).

Or select with right-click, but theoretically it should open the context menu. So menu should be added so that you can select "Edit ..." in it.

n7800

  • Hero Member
  • *****
  • Posts: 707
  • Lazarus IDE contributor
    • GitLab profile
Re: Any way to change the TODO comment?
« Reply #10 on: June 27, 2025, 10:59:07 pm »
It's probably time for the next feature request...

When the cursor is inside a todo comment, it makes sense to show in the Source Editor context menu command "Edit ToDo ..." (or "Done"/"Note", depending on the current type) instead of "Insert a ToDo/Done/Note".

This will allow to immediately call the editor of the current element, rather than searching for it in a huge window list.

It will also fix the bug, since now it try inserts a comment right inside another comment.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4715
  • I like bugs.
Re: Any way to change the TODO comment?
« Reply #11 on: June 28, 2025, 11:37:24 am »
When the cursor is inside a todo comment, it makes sense to show in the Source Editor context menu command "Edit ToDo ..." (or "Done"/"Note", depending on the current type) instead of "Insert a ToDo/Done/Note".
Yes. How to do that? I guess it needs a new callback which the ToDoList package can register.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4715
  • I like bugs.
Re: Any way to change the TODO comment?
« Reply #12 on: June 28, 2025, 03:13:44 pm »
OK, I managed to implement it. Please test.
TIDESpecialCommand has OnRequestCaptionHint which works perfectly.
The ToDoList window must be open for this feature to work which is not ideal. Solving it is not trivial. All ToDo items should be scanned when a menu is opened, and stored in some new structure. Now they are stored in the ListView's ListItem.Data.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

n7800

  • Hero Member
  • *****
  • Posts: 707
  • Lazarus IDE contributor
    • GitLab profile
Re: Any way to change the TODO comment?
« Reply #13 on: June 29, 2025, 07:58:44 pm »
Thanks, the implementation has begun ))

The ToDoList window must be open for this feature to work which is not ideal.

I haven't looked at the code, but it seems to also require constant updating of the list when comments change? I was able to insert a "todo" inside a comment by simply adding spaces at the end of it...

Solving it is not trivial. All ToDo items should be scanned when a menu is opened, and stored in some new structure.

Scanning the entire list can create a large delay when opening the menu, which is certainly not good (even if the list is cached).

I don't know CodeTools. Is it possible to get information from it whether the cursor is currently inside a comment? If outside it, then there is no need to check further, and IDE can immediately show "Insert todo" in the menu. If it is a comment, then see if it contains "todo:". If it does not, then IDE can again show "Insert todo". Otherwise, "Edit todo" may be shown.

If this is possible, then IDE can work only with the current code, without accessing the list (and window).

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4715
  • I like bugs.
Re: Any way to change the TODO comment?
« Reply #14 on: June 29, 2025, 08:13:15 pm »
I don't know CodeTools. Is it possible to get information from it whether the cursor is currently inside a comment? If outside it, then there is no need to check further, and IDE can immediately show "Insert todo" in the menu. If it is a comment, then see if it contains "todo:". If it does not, then IDE can again show "Insert todo". Otherwise, "Edit todo" may be shown.

If this is possible, then IDE can work only with the current code, without accessing the list (and window).
Yes, I will make a dedicated parser for the purpose. Codetools will not be needed then, and the ToDo list does not need to be open.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018