Improve auto-completion

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 538
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

Improve auto-completion

Post by Sicro »

For example, the end keyword should be added as soon as you press the enter key in the start keyword line.

Code: Select all

If a = 1{Enter}
should result in:

Code: Select all

If a = 1
  {Cursor position}
EndIf
The same for all the other commands:
While...Wend
Repeat...Until
For...Next
Procedure...EndProcedure
Module...EndModule
and so on

Edit:
My feature request as a animated gif image:
(Wait until the gif image is loaded)
Image
After ";seconds" I press the enter key.
Last edited by Sicro on Thu Sep 14, 2017 12:58 am, edited 2 times in total.
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Improve auto-completion

Post by davido »

Now, that would be nice.

+1
DE AA EB
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Improve auto-completion

Post by Little John »

In the Preferences of the IDE, under "Editor" > "Autocomplete", there is already this option:
[ ] Add matching 'End' keyword if insert is pressed twice
According to the explanation in the manual, we should not press [Insert] but [Tab] or [Enter] for this purpose. :-)
Add matching ‘End' keyword if Tab/Enter is pressed twice
If you press Tab or Enter twice, it will insert the corresponding end keyword (for example "EndSelect" to "Select" or "EndIf " to "If") to the keyword you have just inserted. The end keyword will be inserted after the cursor, so you can continue typing after the first keyword that was inserted.
However, this feature seems not to work here (PB 5.61 x64 on Windows 10).

BTW: Why twice? Pressing [Enter] once should be enough, no? :-)
User avatar
Bisonte
Addict
Addict
Posts: 1226
Joined: Tue Oct 09, 2007 2:15 am

Re: Improve auto-completion

Post by Bisonte »

Little John wrote:However, this feature seems not to work here (PB 5.61 x64 on Windows 10).
I not agree. This feature works. the first TAB to set the word from autocompletepopup and the second TAB to write the "end" keyword.
But the text in the preferences window of the ide says not TAB/Enter it says "insert", so the manual have to be updated to "the inserting key" or similiar...
PureBasic 6.04 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Improve auto-completion

Post by Little John »

Bisonte wrote:
Little John wrote:However, this feature seems not to work here (PB 5.61 x64 on Windows 10).
I not agree. This feature works. the first TAB to set the word from autocompletepopup and the second TAB to write the "end" keyword.
Thank you for the information!
Well, this is not how I expected it to work. :-(

I don't use autocompletion e.g. when I write If. I type If manuallly, and then press [Enter] once or twice, and EndIf is not inserted automatically. So autocompletion of the "opening" keyword and autocompletion of the "closing" keywored should be handled independent from each other, IMHO.
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Improve auto-completion

Post by davido »

I use this feature all the time, however, I think that, Sicro was requesting that this feature works even if code is added after the keyword.

My first thought was that this was subtly different. Hmm... not so sure now.
DE AA EB
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

Re: Improve auto-completion

Post by chi »

Little John wrote:I don't use autocompletion e.g. when I write If. I type If manuallly, and then press [Enter] once or twice, and EndIf is not inserted automatically
You can 'kinda' do this with my IDE Tool. Type If and press Shift+Return...
Et cetera is my worst enemy
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 538
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

Re: Improve auto-completion

Post by Sicro »

@all
I added an animated GIF image to my first post that hopefully will make my request clearer.

@Little John
I know that such a similar function is already integrated in the IDE. But it's ugly when I write "If" and after pressing the TAB key twice, the "EndIf" hangs behind the text cursor as long as I keep writing.

@chi
Nice IDE tool. Unfortunately, it doesn't support Linux and autocomplete only if nothing is written after the "If".
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Improve auto-completion

Post by Little John »

@Sicro:
I absolutely agree with you. I didn't make that clear previously, sorry!
What you are demonstrating above is exactly the way how I am writing code.
I would appreciate this suggested feature very much!
+1
Post Reply