Re: [fpc-pascal] CodeTools complete code

2022-10-05 Thread Hairy Pixels via fpc-pascal


> On Oct 5, 2022, at 7:19 PM, Bart via fpc-pascal 
>  wrote:
> 
> Ok, that makes me kinf of curious wether you and I mean the same when
> we refer to CodeTools.
> I mean the part of the Lazarus IDE that does code completion etc.
> Since you don;t use Lazarus, you must mean something else?

I have a Language Server for 3rd party IDE’s that uses the library so I use it 
like that.

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] CodeTools complete code

2022-10-05 Thread Bart via fpc-pascal
On Wed, Oct 5, 2022 at 2:17 PM Hairy Pixels via fpc-pascal
 wrote:

> > CodeTools is part of Lazarus.
...
>
> Ok thanks. I’m not a Lazarus user so I don’t really follow those forums.
>
Ok, that makes me kinf of curious wether you and I mean the same when
we refer to CodeTools.
I mean the part of the Lazarus IDE that does code completion etc.
Since you don;t use Lazarus, you must mean something else?


-- 
Bart
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] CodeTools complete code

2022-10-05 Thread Hairy Pixels via fpc-pascal


> On Oct 5, 2022, at 4:23 PM, Bart via fpc-pascal 
>  wrote:
> 
> On Wed, Oct 5, 2022 at 8:33 AM Hairy Pixels via fpc-pascal
>  wrote:
> 
>> Does CodeTools not understand generic class function calls? Here is the 
>> class in question:
> 
> CodeTools is part of Lazarus.
> So, better ask on the Lazarus ML.
> (And yes, CodeTools has problems with generics.)

Ok thanks. I’m not a Lazarus user so I don’t really follow those forums.

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] CodeTools complete code

2022-10-05 Thread Bart via fpc-pascal
On Wed, Oct 5, 2022 at 8:33 AM Hairy Pixels via fpc-pascal
 wrote:

> Does CodeTools not understand generic class function calls? Here is the class 
> in question:

CodeTools is part of Lazarus.
So, better ask on the Lazarus ML.
(And yes, CodeTools has problems with generics.)


-- 
Bart
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] CodeTools complete code

2022-10-05 Thread Hairy Pixels via fpc-pascal
Testing now and I found a potential bug in CodeTools. With this code here:

  Request := specialize TLSPStreaming.ToJSON(Params);

I get the error "illegal qualifier . found" @ 146:53.

Does CodeTools not understand generic class function calls? Here is the class 
in question:

  generic TLSPStreaming = class
class function ToObject(const JSON: TJSONData): T; static;
  end;

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] CodeTools complete code

2022-10-04 Thread Mattias Gaertner via fpc-pascal
On Tue, 4 Oct 2022 14:47:29 +0700
Hairy Pixels via fpc-pascal  wrote:

> > On Oct 4, 2022, at 2:40 PM, Mattias Gaertner via fpc-pascal
> >  wrote:
> > 
> > If you don't want the comment above the class, use
> > 
> > with CodeToolBoss.SourceChangeCache.BeautifyCodeOptions do 
> > begin
> >  ClassHeaderComments:=false;
> >  ClassImplementationComments:=false;
> > end;
> >   
> Great thanks.
> 
> > New procedure bodies are added behind global variables, so they can
> > access them.  
> 
> Ok so this must apply to program files only.

You can define private classes in unit implementations as well.

> I can live with that I guess. It’s maybe best to make it an option. What do 
> you think?

A separate option where to start new classes is a good idea.

> Just
> because it’s an assumption the global variable will be used at all.

Codetools can't know that, so it needs manual help here.
In a unit implementation usually all global variables are at the
beginning and the classes follow. 


> There can also be many global variable sections so that confuses the
> concept some also.

That is a confusing concept anyway. Aka bad coding style?

 
Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] CodeTools complete code

2022-10-04 Thread Hairy Pixels via fpc-pascal


> On Oct 4, 2022, at 2:40 PM, Mattias Gaertner via fpc-pascal 
>  wrote:
> 
> If you don't want the comment above the class, use
> 
> with CodeToolBoss.SourceChangeCache.BeautifyCodeOptions do 
> begin
>  ClassHeaderComments:=false;
>  ClassImplementationComments:=false;
> end;
> 
Great thanks.

> New procedure bodies are added behind global variables, so they can
> access them.

Ok so this must apply to program files only. I can live with that I guess. It’s 
maybe best to make it an option. What do you think? Just because it’s an 
assumption the global variable will be used at all. There can also be many 
global variable sections so that confuses the concept some also.

> 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

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] CodeTools complete code

2022-10-04 Thread Mattias Gaertner via fpc-pascal
On Tue, 4 Oct 2022 14:10:29 +0700
Hairy Pixels via fpc-pascal  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
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] CodeTools complete code

2022-10-04 Thread Hairy Pixels via fpc-pascal
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?

Starting text:

/

type
  TMyClass = class
procedure MyProcedure;
  end;

var
  i: integer;

Modified text:

/

type
  
  { TMyClass }

  TMyClass = class
procedure MyProcedure;
  end;

var
  i: integer;

procedure TMyClass.MyProcedure;
begin

end;


Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal