Recent

Author Topic: How tell auto-completion to insert spaces around :=  (Read 1614 times)

ssawgift

  • New Member
  • *
  • Posts: 10
    • My Personal Website
How tell auto-completion to insert spaces around :=
« 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 :=.

Zvoni

  • Hero Member
  • *****
  • Posts: 598
Re: How tell auto-completion to insert spaces around :=
« Reply #1 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
One System to rule them all, One IDE to find them,
One Code to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
People call me crazy, because i'm jumping out of perfectly fine aircraft

ssawgift

  • New Member
  • *
  • Posts: 10
    • My Personal Website
Re: How tell auto-completion to insert spaces around :=
« Reply #2 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...

lucamar

  • Hero Member
  • *****
  • Posts: 4009
Re: How tell auto-completion to insert spaces around :=
« Reply #3 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.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

ssawgift

  • New Member
  • *
  • Posts: 10
    • My Personal Website
Re: How tell auto-completion to insert spaces around :=
« Reply #4 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.

lucamar

  • Hero Member
  • *****
  • Posts: 4009
Re: How tell auto-completion to insert spaces around :=
« Reply #5 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).
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

ssawgift

  • New Member
  • *
  • Posts: 10
    • My Personal Website
Re: How tell auto-completion to insert spaces around :=
« Reply #6 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