Recent

Author Topic: TODO ToDoesn't  (Read 1057 times)

Bazzao

  • Full Member
  • ***
  • Posts: 145
  • Pies are squared.
TODO ToDoesn't
« on: July 06, 2019, 05:43:50 am »
TODO seems to work in unit1.pas and sometimes elsewhere.

I have placed some TODOs in other units / classes / includes, but they do not appear, even when refreshing.  >:D

Is this a bug, or is there some setting that needs to be tweaked?

Bazza
Bazza

Lazarus 1.6.4 r54278 FPC 3.0.2 x86_64-win64-win32/win64
Windows 10.

Handoko

  • Hero Member
  • *****
  • Posts: 3156
  • My goal: build my own game engine using Lazarus
Re: TODO ToDoesn't
« Reply #1 on: July 06, 2019, 05:54:54 am »
Mine seems to work correctly. I'm using Lazarus 2.0.2 Linux.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5631
    • wiki
Re: TODO ToDoesn't
« Reply #2 on: July 06, 2019, 10:42:46 am »
Are the other units part of the project (listed in the project inspector)?

Or part of any package? Not sure how, but IIRC there should be a way to get todo for a package.

lucamar

  • Hero Member
  • *****
  • Posts: 2018
Re: TODO ToDoesn't
« Reply #3 on: July 06, 2019, 12:33:25 pm »
Or part of any package? Not sure how, but IIRC there should be a way to get todo for a package.

Not for a package but for all used packages. Just tick the "Packages" checkbox in the Todo viewer.

Note that to be listed the "todos" must be either:
  • Listed in the project inspector/package editor;
  • Used in the main source file;
  • Opened in the editor; or
  • Like 1 and 2 but in some package used in the project.
and, of course, the corresponding checkbox in the viewer must be ticked..
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

Thaddy

  • Hero Member
  • *****
  • Posts: 8911
Re: TODO ToDoesn't
« Reply #4 on: July 06, 2019, 01:16:56 pm »
You can replace {%TODO} with {$ERROR}....... >:( >:( >:D

Freepascal also allows user defined errors or warnings.... Manuals....

Note % is Lazarus specific.....
« Last Edit: July 06, 2019, 01:25:14 pm by Thaddy »
Most people that want to use threading should learn to patch their jeans first: use a needle.

lucamar

  • Hero Member
  • *****
  • Posts: 2018
Re: TODO ToDoesn't
« Reply #5 on: July 06, 2019, 05:08:32 pm »
You can replace {%TODO} with {$ERROR}....... >:( >:( >:D

Freepascal also allows user defined errors or warnings.... Manuals....

Note % is Lazarus specific.....

Ah... he's, I think, referring to "normal" TODOs, as in:
Code: Pascal  [Select]
  1. {TODO 9 -olcm -cbase : Implement this method at once!}

In fact, now I think of it ... what is "%TODO"? I can't find it in the docs :-\
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

howardpc

  • Hero Member
  • *****
  • Posts: 3149
Re: TODO ToDoesn't
« Reply #6 on: July 06, 2019, 06:40:54 pm »
Some years ago you could insert "todo"s in the Lazarus IDE using the syntax
 {%todo a todo comment}
This functionality was removed (I don't recall when). Presumably it caused conflicts with other uses of %-based IDE directives. I don't think anyone noticed. Not a great loss.

You still have all these options:
Code: [Select]
{TODO todo text}
{#todo  todo text}
{ ToDo todo text}
// Todo: todo text
(* todo: todo text *)

Bazzao

  • Full Member
  • ***
  • Posts: 145
  • Pies are squared.
Re: TODO ToDoesn't
« Reply #7 on: July 10, 2019, 06:05:54 am »
Are the other units part of the project (listed in the project inspector)?

Or part of any package? Not sure how, but IIRC there should be a way to get todo for a package.

There were none includes listed.

I had wiped out all the todos, and then when I saw your reply just now, added the portions to the Inspector, but there was noting to show.

So I opened up another Project, added a dummy ToDo in each of the includes, ans they all showed, without being  included in the Inspector.

I can't explain it, but I now know to possibly include the file in the inspector.
Bazza

Lazarus 1.6.4 r54278 FPC 3.0.2 x86_64-win64-win32/win64
Windows 10.

Bazzao

  • Full Member
  • ***
  • Posts: 145
  • Pies are squared.
Re: TODO ToDoesn't
« Reply #8 on: July 10, 2019, 06:07:17 am »
Must be for a later version of Lazarus.

I think it's time I upgraded.

Bazza
Bazza

Lazarus 1.6.4 r54278 FPC 3.0.2 x86_64-win64-win32/win64
Windows 10.

Bazzao

  • Full Member
  • ***
  • Posts: 145
  • Pies are squared.
Re: TODO ToDoesn't
« Reply #9 on: July 10, 2019, 06:09:52 am »
You can replace {%TODO} with {$ERROR}....... >:( >:( >:D

Freepascal also allows user defined errors or warnings.... Manuals....

Note % is Lazarus specific.....

Ah... he's, I think, referring to "normal" TODOs, as in:
Code: Pascal  [Select]
  1. {TODO 9 -olcm -cbase : Implement this method at once!}

In fact, now I think of it ... what is "%TODO"? I can't find it in the docs :-\


"TODO 9 -olcm -cbase : Implement this method at once!" is the ToDo I am using.

Bazza
Bazza

Lazarus 1.6.4 r54278 FPC 3.0.2 x86_64-win64-win32/win64
Windows 10.

Thaddy

  • Hero Member
  • *****
  • Posts: 8911
Re: TODO ToDoesn't
« Reply #10 on: July 10, 2019, 09:38:36 am »
I actually mean something different: not a {todo}, but using user defined hints, warnings or errors.
Some todo's need a hint, {$hint this is not fully implemented}
Some todo's need a warning, {$warning this needs to be implemented or is a hack}
Some todo's must generate an error. {$error  this is not finished}

See?

If you use these very obvious tools, you can create a "todo'" that the compiler itself warns you for or even stop compiling if the code really needs to be completed.

E.g:
Code: Pascal  [Select]
  1. program testtodo;
  2. {$mode objfpc}
  3. uses
  4.   Sysutils,Classes;
  5. var
  6.   S: TStringList;
  7.  
  8. begin
  9.   {$hint need explanation}
  10.   S := TStringList.Create;
  11.   S.LoadFromFile('test.pas',TEncoding.Utf8);
  12.   writeln(S.Text);
  13.   {$warning no free yet}
  14.   S.Free;
  15.   {$error this is not finished yet, get back to work}
  16. end.

Outputs:
Code: Bash  [Select]
  1. Compiling test.pas
  2. test.pas(11,4) Hint: User defined: need explanation
  3. test.pas(15,4) Warning: User defined: no free yet
  4. test.pas(17,4) Error: User defined: this is not finished yet, get back to work
  5. test.pas(19) Fatal: There were 1 errors compiling module, stopping
  6. Fatal: Compilation aborted
  7.  

There's your todo's......

Toodles,

Thaddy
« Last Edit: July 10, 2019, 09:53:46 am by Thaddy »
Most people that want to use threading should learn to patch their jeans first: use a needle.

howardpc

  • Hero Member
  • *****
  • Posts: 3149
Re: TODO ToDoesn't
« Reply #11 on: July 10, 2019, 10:05:27 am »
If you use these very obvious tools, you can create a "todo'" that the compiler itself warns you for or even stop compiling if the code really needs to be completed.
The messages produced in this case are not the "compiler itself" warning you (except in some trivial mechanical way) but the programmer sending himself a warning, via a {$xxx } directive of a condition he was aware of as he wrote the code. I don't see how that adds much value compared to the use of a "// todo: you need to do..."

The IDE collects all these messages conveniently in one place so you can check off outstanding issues. It allows you to jump directly to the relevant line in the source, and also provides a way (// done) to dispose of the messages too as you deal with them at your convenience, while retaining a record of tasks completed.
« Last Edit: July 10, 2019, 10:09:22 am by howardpc »

Thaddy

  • Hero Member
  • *****
  • Posts: 8911
Re: TODO ToDoesn't
« Reply #12 on: July 10, 2019, 10:30:48 am »
The messages produced in this case are not the "compiler itself" warning you (except in some trivial mechanical way) but the programmer sending himself a warning, via a {$xxx } directive of a condition he was aware of as he wrote the code. I don't see how that adds much value compared to the use of a "// todo: you need to do..."
The crux of the question is not about commenting code, but about not forgetting something.
This is actually crucial in teams or larger projects. I just wanted to demonstrate that such features are available and very easy to use.
So it adds a lot of value in my opinion. That's why these features are there....
A comment will not show up in the compiler output.... My examples will...

I hope that changes your mind...
Most people that want to use threading should learn to patch their jeans first: use a needle.

lucamar

  • Hero Member
  • *****
  • Posts: 2018
Re: TODO ToDoesn't
« Reply #13 on: July 10, 2019, 02:10:24 pm »
I think both have its uses, depending on the circumstances. If you're not really happy with somethng you can add a:
Code: Pascal  [Select]
  1. { TODO : Not really happy with this; merits a little more thought for the revision}
but if you added a kluge somewhere because you were in a hurry a
Code: Pascal  [Select]
  1. {$WARNING Terrible kluge combined with magic here! Set to rights ASAP!}
might be more appropiate.

A question of point of view, I guess ;)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

Thaddy

  • Hero Member
  • *****
  • Posts: 8911
Re: TODO ToDoesn't
« Reply #14 on: July 10, 2019, 04:18:00 pm »
IA question of point of view, I guess ;)
Yes, the extra effort of typing a dollar sign can be a point of view?  :D :D :D :D
Most people that want to use threading should learn to patch their jeans first: use a needle.