Wish Code completion / injection

Jim Brown

Active Member
Licensed User
One very nice feature I have come across before in other language IDEs is the code completion or code injection. This is a great time saver for quickly entering common code blocks into your source code.
A bit like the time saving Sub <TAB> key feature for injecting events.

My idea is that you press a key combo (say Ctrl+J) to bring up a popup menu containing common code blocks. The pasted block is then injecting at the current cursor position. It should be nicely formatted with indented lines where applicable and the cursor positioned where you would expect to start typing from.

List of common code blocks

If Then
B4X:
If * Then    ' cursor finishes at * position
    |        ' tabbed indent
End If
If Then Else
B4X:
If * Then    ' cursor finishes at * position
    |        ' tabbed indent
Else
    |        ' tabbed indent
End If
Sub
B4X:
Sub *        ' cursor finishes at * position
    |        ' tabbed indent
End Sub
For
B4X:
For *= To     ' cursor finishes at * position
    |        ' tabbed indent
Next

Another idea, have an option in the IDE to 'Auto Complete code block' where any 'block' type code is automatically completed (i.e, If / Do / Sub / For).
So, if the programmer types If MyVar=10 Then followed by <RETURN> the IDE completes the block and moves the cursor into the indented line:
B4X:
If MyVar=10 Then
    *        ' cursor position * (at tabbed indent)
End If
 

sorex

Expert
Licensed User
I think the first time I used such feature was about 10 years ago in AnyEdit.

nice feature but you forget about it easily because you don't use it as much as copy/paste shortcuts.
 
Top