Bug? Formatting elseif

kohle

Active Member
Licensed User
Longtime User
when i code elseif lines in the editor, it formats :

B4X:
    If wDirection="r" Then
        wDirection="l"
        else if wDirection="l" Then
            wDirection="r"
            else if wDirection="t" Then
                wDirection="b"
                Else If wDirection="b" Then
                    wDirection="t"
                   
    End If


Should it not be like this :


B4X:
if wDirection="r" then
     wDirection="l" 
Else if wDirection="l" Then
     wDirection="r" 
else if wDirection="t" then
     wDirection="b"
Else if wDirection="b" Then
     wDirection="t"
end If

and for every end if I type I must click 2 times enter, because of this auto....
This editor slows me so much down. I typing now in notepad++ and copy the text
to get some speed.
 

DonManfred

Expert
Licensed User
Longtime User
if you pres ENTER after each THEN it would be formatted correctly. Ok, may be only when you paste the variable from clipboard. If i write such a code like yours i usually have the variable copied...
so i´ll write IF[space][pressing STRG-V to include the variable]
it gets reformatted due to the pasted variable,

You also can press ALT-F to force a new formatting at any time.

If you copy the code from above and paste it into your app code it is formatted correctly too.
 

sorex

Expert
Licensed User
Longtime User
doesn't pressing alt-f solve the formatting issue?

I get what you're after with the endif. It would be nice if a linefeed could be assigned to some single line commands.

you can optimize your code like this aswell

B4X:
Dim dir As String="b"
Dim oDir As String="lrltbt"
Log(oDir.CharAt(oDir.IndexOf(dir)+1))

output: t
 

kohle

Active Member
Licensed User
Longtime User
"if you pres ENTER after each THEN it would be formatted correctly"

No this dont solve the formatting of elseif !



Alt f works, but why cant this be automatically made after the last endif ?

code ALT + F
code ALT + F
code ALT + F ..... ????

and this :

At the "THEN" command :
if a=1 then (Here I must click always 2 x times ENTER , why ?????)

First ENTER it highlights the if and then and the second enter outs an end if

Normally you are used in other editors when you click enter you get in the next line.

Can this if then ... can be turned off ?
 

sorex

Expert
Licensed User
Longtime User
you only need to ALT-F once to reformat the current sub you're in.

the 2 enters is

1. confirm the autocomplete selection
2. add line feed

if you prefer 1 enter only you can use

1. confirm with TAB
2. add line feed with enter

but it remains 2 keypresses.

yes, you can turn it off with Tools > IDE > disable explicit autocomplete

but that disables everything related to the autocomplete and that makes coding even slower.

SHIFT+ENTER at the autocomplete seems to confirm and add a linefeed at once but you need to type THEN completely or it doesn't complete the word.
 
Last edited:

kohle

Active Member
Licensed User
Longtime User
ok. thanks.

when you work on a large code, like > 500 lines you have to use ALT + F more than once,
not only at the end of coding .

And if a variable is not declared first, and you try to type like a=3 , oh man, something comes out of the auto correction,
you need to click first esc ....

I think for beginners is this editor cool, but for a experience developer who works with different languages its tricky.

I dont need a auto complete for IF..THEN, FOR..NEXT or the other basic stuff.

Maybe a option in the configuration would be nice .
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…