[Lazarus] Problem with Record Helpers and Identifier completion

Michael Ring mail at michael-ring.org
Sun Jan 5 16:06:25 CET 2014


Hi!

in the past I have not used Lazarus that much, currently I am developing 
some code for embedded platforms based on fpc and I would like to make 
this code as usable as possible in Lazarus.

I am currently extending the record definitions for embedded controllers 
with Record Helpers. (The reason is that this approach uses less 
precious flash storage than objects or classes and it looks cleaner to 
me than to redefine the records again).

Problem with this approach seems to be that identifier completion does 
not have a clue about the extra procedures defined in the Record Helper.

Here's an example:

In stm32f10x_cl I have this code

type
    TGPIO_Registers = record
     CRL : longword;
     CRH : longword;
     ....
   end;

Then I have a helper Unit defining some extra procedures:
unit
   gpioHelper;
uses
   stm32f10x_cl; // necessary to make indentifier completion work at all
type
   TGPIO_RegistersHelper = record helper for TGPIO_Registers
     procedure setConfig(bit : TGPIO_Bit; config : TGPIO_Config);
     procedure setConfig(bit : TGPIO_BitSet; config : TGPIO_Config);
     ....
  end;

In main Code I now have:
program test;
uses
   gpioHelper;

begin
   GPIOD.
end.


and hit Ctrl-Space after GPIOD.

The record elements show up in completion, all the procedures defined in 
the helper class are not visible. Is it me doing something wrong? Or is 
there something that I can do with my code to create hints/whatever so 
that the helper classes are visible? Or am I doomed and should bite in 
the sour apple and redefine all records that I need?

TnX,

Michael








More information about the Lazarus mailing list