[Lazarus] Smart Cut/Paste Spacing of declared variables and contants...

Mattias Gärtner nc-gaertnma at netcologne.de
Wed Oct 20 16:15:37 CEST 2010


Zitat von Andrew Brunner <andrew.t.brunner at gmail.com>:

> var
>   iCount                            : Integer;
>   Commands                     : TDatabaseCommands;
>   iLcv,iWhatEver                : Integer;
>
> When I declare variables I tend declare them one per line but not always.
> I also place my ":" at column 34.
>
> When I cut/paste variables and they move from one level to another
> inside a method I find the smart feature starts them off properly but
> does not adjust the left side.  To be REALLY smart and for
> declarations only, it would cool if the editor could remove some white
> space (if possible) between the end of the last declared variable and
> the colon.
>
> procedure Test;
> var
>   iInt1,iInt2           : Integer;
>   Test2                 : string;
>
>   procedure SubTest1;
>   var
>      iInt1,iInt2        : Integer;
>      Test2              : string;
>   begin
>   end;
> begin
>
> end;
>
> Notice that when I take declarations from one spot I want the colons
> to be in alignment.  If I could get that when I copy/cut paste I would
> be totally impressed :-)

The paste (without replace) only indents.
Note: With elastic tabs the above would work automatically.
There is the idea to run the jcf formatter on pasted code.
I'm not sure how good the jcf formatter works on snippets.

For automatic variable declaration it should be easy to implement. For  
example:

var
   i    : integer;
begin
   j:=1;  // ctrl+shift+c

var
   i    : integer;
   j    : integer;
begin
   j:=1;

You can create a feature request if you want.


Mattias







More information about the Lazarus mailing list