Recent

Author Topic: Hints for method name missing comments  (Read 2224 times)

dbannon

  • Hero Member
  • *****
  • Posts: 3410
    • tomboy-ng, a rewrite of the classic Tomboy
Hints for method name missing comments
« on: June 19, 2025, 01:09:15 pm »
I have just noticed a rather sad change between Lazarus_4_0 and its predecessors.  I'm hoping I'm doing something silly.

See the attached images, one taken in Lazarus 3.6, one in Lazarus 4.0, same code, same project etc. In both cases, the mouse pointer is over a method name under implementation. I have a few lines of comments immediately above the method declaration. Lazarus 4.0 has declined to show the comments. I cannot see a relevant setting (and why would we want one ?).

Any thoughts ?

 
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11456
  • Debugger - SynEdit - and more
    • wiki
Re: Hints for method name missing comments
« Reply #1 on: June 19, 2025, 02:52:53 pm »
Maybe https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/14384

Though yours don't seem to have fpdoc info...

bobby100

  • Sr. Member
  • ****
  • Posts: 291
    • Malzilla
Re: Hints for method name missing comments
« Reply #2 on: June 19, 2025, 04:06:48 pm »
It seems related to https://forum.lazarus.freepascal.org/index.php/topic,70369.msg548794.html#msg548794
Previous Lazarus versions used the comments from source files as info

MarkMLl

  • Hero Member
  • *****
  • Posts: 8453
Re: Hints for method name missing comments
« Reply #3 on: June 19, 2025, 04:13:51 pm »
I might be barking (and slavering up the wrong tree :-) but in the past (v2 and older, v3 untested) I've noticed that inline comments weren't presented as hints if the first line of the unit was formatted unexpectedly.

I mention this because there's a possibility that a change in the way that the v4 IDE is processing the start of the unit might have inadvertently messed up the hinting:

Code: Pascal  [Select][+][-]
  1. // unit THIS LINE NEEDED FOR DECLARATION HINTING TO WORK
  2. (* Return either a static or a dynamic representation of the Asound embedding
  3.   library (libasound.a or similar). In this case it is static.
  4. *)
  5. unit test;
  6.  
  7. (********************************************************************************)
  8. (*                                                                              *)
  9. (* WARNING: This is a machine-generated file and manual changes will be lost.   *)
  10. (*                                                                              *)
  11. (********************************************************************************)
  12.  
  13. {$mode objfpc}{$H+}
  14. {$packrecords C}
  15. ...
  16.  

What's happening there is that the unit (a .pas file) was generated from a .inc, and there was a comment at the start of the .inc saying what it was intended to do... which for reasons which were perfectly sensible at the time I was keeping as early as possible rather than shuffling the mechanically-generated unit line right to the start.

Updated: I almost certainly did it like that so that the unit name itself had a comment, which potentially showed up as a hint.

MarkMLl
« Last Edit: June 19, 2025, 04:36:25 pm by 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

dsiders

  • Hero Member
  • *****
  • Posts: 1453
Re: Hints for method name missing comments
« Reply #4 on: June 19, 2025, 05:32:57 pm »
I have just noticed a rather sad change between Lazarus_4_0 and its predecessors.  I'm hoping I'm doing something silly.

See the attached images, one taken in Lazarus 3.6, one in Lazarus 4.0, same code, same project etc. In both cases, the mouse pointer is over a method name under implementation. I have a few lines of comments immediately above the method declaration. Lazarus 4.0 has declined to show the comments. I cannot see a relevant setting (and why would we want one ?).

Any thoughts ?

We do not see the comments which you expect in the pop-up. Is there any blank lines after the comment and before the symbol? That breaks the association with the following identifier.
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

dbannon

  • Hero Member
  • *****
  • Posts: 3410
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Hints for method name missing comments
« Reply #5 on: June 20, 2025, 03:40:28 am »
Thanks folks. I must emphasize this is not an issue with whats in my source. There is a clear difference between Lazarus 3.6 and Lazarus 4.0. Same source. It could be an IDE setting but  cannot find anything like it.

Attached are two new images, again 3.6 and 4.0. Its just a "new Application" form, one event, FormClick added, a comment applied to the method definition, it shows in 3.6 but not 4.  (Whitespace removed to make for smaller images).

No Don, the comments have no whitespace between comment and declaration line. See new images.

Mark, I copied and pasted the comments from your example to the top of my simple test. No better.

Hmm, Bobby100, that apears similar. But I do have a space between '//' and text of comment, as seen in attached mages.

Martin no, I am not using fpdoc. And my problem is not duplicate comments, its no comments !

Attached two simplistic demos. Also a third image that shows it working correctly on a comment consisting of the declaration ! How weird is that ?

Are other people not experiencing this ?

Davo
 
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

MarkMLl

  • Hero Member
  • *****
  • Posts: 8453
Re: Hints for method name missing comments
« Reply #6 on: June 20, 2025, 02:17:23 pm »
Does this only affect method names (i.e. being declared in the context of a class) or does it also apply to ordinary functions?

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

CM630

  • Hero Member
  • *****
  • Posts: 1436
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Hints for method name missing comments
« Reply #7 on: June 20, 2025, 04:03:50 pm »
It seems related to https://forum.lazarus.freepascal.org/index.php/topic,70369.msg548794.html#msg548794
Previous Lazarus versions used the comments from source files as info
I am still interested in that.
Лазар 4,0 32 bit (sometimes 64 bit); FPC3,2,2

dbannon

  • Hero Member
  • *****
  • Posts: 3410
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Hints for method name missing comments
« Reply #8 on: June 21, 2025, 02:54:54 am »
Does this only affect method names (i.e. being declared in the context of a class) or does it also apply to ordinary functions?

Yes Mark, applies to ordinary functions too. So, a function implemented in  implementation  section, declared and commented in interface section will not show the comment when mouse is hovered over the starting line of the function implementation. 

Now, interesting, if I add "//" in front of that starting line of the function implementation, so it becomes a comment, mouse hover shows what it should. But I have to remember to remove those "//" before compiling ! (Class method or stand alone function).

It is so very easy to demonstrate, I take it no one else can replicate this problem ?  Please say so ! I am starting to question my sanity.

  • Start Lazarus 4.0
  • Choose a new Project, Application (no need to save or compile).
  • Add an event to the form, eg OnClick
  • In the Interface, where the type is declared, add a comment immediately above the declaration of the event -
Code: Pascal  [Select][+][-]
  1.     TForm1 = class(TForm)
  2.                          // This is FormClick                      << add this comment !
  3.         procedure FormClick(Sender: TObject);
  4.     private

Now, hover the mouse over the "procedure TForm1.FormClick(Sender: TObject);" in implementation - do you see the comment ?

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dsiders

  • Hero Member
  • *****
  • Posts: 1453
Re: Hints for method name missing comments
« Reply #9 on: June 21, 2025, 03:56:15 am »
There are situations where it works, and some where it does not. Case in point: TStrings.TrailingLineBreak.

This topic does not exist in the 3.2.2 help file, so there is no XML content, It has an in-source comment. If you try to hover over it in the classesh.inc file where it is found... the comment does not appear in the code help. If you hover over a statement (in another unit) which uses that identifier, the comment does appear in the Code Help.

See attachments.

[ This is using the main branch ]
« Last Edit: June 21, 2025, 04:09:58 am by dsiders »
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

dbannon

  • Hero Member
  • *****
  • Posts: 3410
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Hints for method name missing comments
« Reply #10 on: June 21, 2025, 04:10:24 am »
There are situations where it works, and some where it does not. Case in point: TStrings.TrailingLineBreak.

This topic does not exist in the 3.2.2 help file, so there is no XML content, It has an in-source comment. If you try to hover over it in the classesh.inc file where it is found... the comment does not appear in the code help. If you hover over a statement (in another unit) which uses that identifier, the comment does appear in the Code Help.

See attachments.

Thanks Don, its not my imagination !  I'll check its a problem in trunk, try a few other platforms and log a bug report.  Seems to be limited to in source comments (good), I think its cute when looking at a method in my code, I cannot see my comments. But if the method name is used in a comment or debug statement (I do that a lot) I can see it !

Anyway, thats for that confirmation.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dsiders

  • Hero Member
  • *****
  • Posts: 1453
Re: Hints for method name missing comments
« Reply #11 on: June 21, 2025, 04:13:25 am »
There are situations where it works, and some where it does not. Case in point: TStrings.TrailingLineBreak.

This topic does not exist in the 3.2.2 help file, so there is no XML content, It has an in-source comment. If you try to hover over it in the classesh.inc file where it is found... the comment does not appear in the code help. If you hover over a statement (in another unit) which uses that identifier, the comment does appear in the Code Help.

See attachments.

Thanks Don, its not my imagination !  I'll check its a problem in trunk, try a few other platforms and log a bug report.  Seems to be limited to in source comments (good), I think its cute when looking at a method in my code, I cannot see my comments. But if the method name is used in a comment or debug statement (I do that a lot) I can see it !

Anyway, thats for that confirmation.

Davo

IMO, hovering on something in the same unit seems to be the snag.
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

cdbc

  • Hero Member
  • *****
  • Posts: 2256
    • http://www.cdbc.dk
Re: Hints for method name missing comments
« Reply #12 on: June 21, 2025, 09:54:03 am »
Hi
Quote
IMO, hovering on something in the same unit seems to be the snag.
+1
I've noticed that too.
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 3.6 up until Jan 2024 from then on it's both above &: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 4.99

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4599
  • I like bugs.
Re: Hints for method name missing comments
« Reply #13 on: June 21, 2025, 05:36:46 pm »
There was an uninitialized variable that may have prevented showing the source comments.
I fixed it in 95eaa30d4e. Please test. I merged it to fixes_4.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

dbannon

  • Hero Member
  • *****
  • Posts: 3410
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Hints for method name missing comments
« Reply #14 on: June 22, 2025, 02:31:35 am »
Yep, you have fixed it Juha, now works as it should !  Once again, I thank you !

Lets hear from CM630 ?

Thanks to all involved here, feels heaps better !  I guess I'll use fixes 4 for now, makes no difference to output files but my workflow is a lot more comfortable.

Davo

edit : wow, that issue has a history !  Your persistence paid off Juha.
« Last Edit: June 22, 2025, 02:37:27 am by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018