[fpc-pascal] CodeTools complete code

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Oct 4 09:40:55 CEST 2022


On Tue, 4 Oct 2022 14:10:29 +0700
Hairy Pixels via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:

> I’m trying to use the CompleteCode function in the CodeTools library
> and doing some formatting I don’t want.
> 
> Calling it over the “MyProcedure” method in the class it added a
> comment and moved the declaration under the variable section instead
> of directly under the class declaration like I would have expected.
> Basically I would just like the most minimal amount of changes to
> implement the method instead of reformatting things.
> 
> I see there is a beautifier class but it could it be used for this
> and if so how may that look?

If you don't want the comment above the class, use

with CodeToolBoss.SourceChangeCache.BeautifyCodeOptions do 
begin
  ClassHeaderComments:=false;
  ClassImplementationComments:=false;
end;

New procedure bodies are added behind global variables, so they can
access them.
At the moment when a class has no method body yet, codetools uses the
setting for the procedures. (It would be better, if this has a separate
setting).

ForwardProcBodyInsertPolicy

Mattias


More information about the fpc-pascal mailing list