Lazarus

Using the Lazarus IDE => Options => Topic started by: ssawgift on June 01, 2021, 01:06:04 pm

Title: How tell auto-completion to insert spaces around :=
Post by: ssawgift on June 01, 2021, 01:06:04 pm
Is there an existing option that tell auto-completion to insert spaces around :=?
For example, when I auto-complete the following line:
Code: Pascal  [Select][+][-]
  1. self.Caption
I always get:
Code: Pascal  [Select][+][-]
  1. self.Caption:=

When I format using Jedi, it automatically inserts one space before and after :=.
Title: Re: How tell auto-completion to insert spaces around :=
Post by: Zvoni on June 01, 2021, 01:11:53 pm
In IDE --> Tools - Options - Codetools - Blanks (German Lazarus here, so i'm translating on the Fly)

Check both "Symbol" in "Insert blank before" and "Insert blank after"
Nota Bene: That inserts a blank before/after each Symbol
You can see it in the sample-window
Title: Re: How tell auto-completion to insert spaces around :=
Post by: ssawgift on June 01, 2021, 02:09:48 pm
In IDE --> Tools - Options - Codetools - Blanks (German Lazarus here, so i'm translating on the Fly)

Check both "Symbol" in "Insert blank before" and "Insert blank after"
Nota Bene: That inserts a blank before/after each Symbol
You can see it in the sample-window
Thanks for the tip. But the above option only affects Jedi formatting...
Title: Re: How tell auto-completion to insert spaces around :=
Post by: lucamar on June 01, 2021, 02:58:35 pm
Thanks for the tip. But the above option only affects Jedi formatting...

In fact they affect only CodeTools formatting (which includes auto-completion); note that there's a specific section for JCF Format Settings above it.
Title: Re: How tell auto-completion to insert spaces around :=
Post by: ssawgift on June 01, 2021, 03:12:36 pm
In fact they affect only CodeTools formatting (which includes auto-completion); note that there's a specific section for JCF Format Settings above it.
Okay, that means auto-completion should insert a space before :=, but it does not. The only way to achieve what I want is to hit SPACEBAR (instead of ENTER) when the correct symbol is highlighted in completion list.
Title: Re: How tell auto-completion to insert spaces around :=
Post by: lucamar on June 01, 2021, 03:24:07 pm
Strange; it works as it should here. For example, if you have:
Code: Pascal  [Select][+][-]
  1. var
  2.   Something: Integer;
  3. begin
  4.  |
  5. end;
an use autocompletion to insert "Something" at the caret's position, it adds the ":=" with the proper spaces around. But, of course, only if you have "Add assignment operator" checked in "Identifier completion" (right below "Space" in CodeTools options).
Title: Re: How tell auto-completion to insert spaces around :=
Post by: ssawgift on June 01, 2021, 04:53:24 pm
After some tries, it turned out that the codetools->Space setting works for auto-completion. I did not check two checkboxes for 'Symbol'.
TinyPortal © 2005-2018