Recent

Author Topic: Question about "Find declaration of ..."  (Read 245 times)

440bx

  • Hero Member
  • *****
  • Posts: 5805
Question about "Find declaration of ..."
« on: September 17, 2025, 07:10:19 am »
Hello,

Consider the following example program:
Code: Pascal  [Select][+][-]
  1. program _FindDeclaration;
  2.  
  3. type
  4.   TSOMETYPE32 = record
  5.  
  6.     { refer to TSOMETYPE64 for more information                               }
  7.  
  8.     Field1      : integer;
  9.   end;
  10.  
  11. type
  12.   TSOMETYPE64 = record
  13.  
  14.     { supposedly there is information here that applies to both, the 32 and   }
  15.     { 64 bit type                                                             }
  16.  
  17.     { a comment that contains the TSOMETYPE32 type                            }
  18.  
  19.     Field1      : integer;
  20.   end;
  21.  
  22. begin
  23.  
  24.   readln;
  25. end.                      
  26.  
right-clicking on TSOMETYPE64 in the TSOMETYPE32 definition comment and selecting Find declaration of TSOMETYPE64 causes an error from codetools. (error: identifier not found.)  This occurs even after a successful build.

right-clicking on TSOMETYPE32 in the TSOMETYPE64 definition and selecting Find declaration of TSOMETYPE32 works, codetools finds TSOMETYPE32 and goes there.

It is reasonable to presume that the reason it fails in the first case is because the ...64 definition follows the ...32 definition and as such codetools "hasn't seen it yet".  Is this how it really works or should codetools have found the identifier ?

The next question is: is there a way to make it work ? i.e, have codetools go to the definition of TSOMETYPE64 instead of erroring out ?

Thank you for your help

ETA:

added the action that must be done after right clicking, i.e, selecting "Find declaration of ... "




« Last Edit: September 17, 2025, 10:10:31 am by 440bx »
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018