Code alignment
Blitz3D Forums/Blitz3D Programming/Code alignment
| ||
Hey peeps- Anyone know of a tool that will sort my unorganised looping out? Ive typed code like such: For.... yada yada if yada yada endif next and i need it turned into For Yada Yada if Yada Yada endif next Etc etc.... Please help- i need to type in some code but ive lost where my codes going. at the moment my code is very clean and efficient but my indents arent right.... Cheers :D |
| ||
And the difference between the two is? |
| ||
oh--- HEHEH. Tabs-- this forum must have removed them....... |
| ||
:) I dont think there is a tool that auto indents code for you. You may end up having to go through your code bit by bit and indenting as you see. Have you tried the code arcs? I know theres some code in there that cleans up code but I dont know if there is an Auto formatter << for code. |
| ||
i wrote a code cleaner thatl remove all indents- i suppose i could just reindent after running.. oh well-- Someone could code this- i wouldnt know where to start realy! |
| ||
This sounded like an interesting challenge... So I did one! Code is not indented by intention! |
| ||
nice one! il go test it! [update] It doesnt seem to be detecting my Ifs. Yup, im using "Then" too :) nice start though! [update 2] This seems to work better: |
| ||
It won't indent if the 'if' line has a 'then' in it. If you want it to then just add 'if' to the indent list but this does mean it will go screwy if you've got any lines like: If a > 0 then a = a + 1 [edit] Just seen your update. That's fine as long as you don't have any comments or characters after the 'then'. |
| ||
This should be a feature of Some IDE, I know in JAVA and C this is common place features, many literly forcing the formatting of the code. :) Personally, I can't code anything without indents, I get way to confused way to quick. Why on earth would you not want to use them anyway? |
| ||
Just checked a bit more code with it and it WON'T work for if statements formed without 'Then' e.g. If a=false a=true I totally agree Strider, however, the blitz IDE is primitive, I'm sure the more expensive ones do. |
| ||
Better, but still wont fix the above error Rob Farley talked of.... |
| ||
It has to be said, If-Then is a bitch to indent! |
| ||
how about using an Eval statement from the code arcives on a line with an "if", but without a "then".. if the value cant be computed, then the If statement is single line... else, its multi line? theres prolly multiple holes here.... |
| ||
If there is a working scope system the intendion is not really hard ... just intend everything within the scope 1 level :) |
| ||
I REALLY want an IDE that does this automatically. I mean you cannot use the tab button. you cannot erase a tab. The code just automatically tabs to where it should be while you type. |
| ||
The code just automatically tabs to where it should be while you type. That CANT happen. The IDE has not better idea of how the final output should be than you do.For instance, say you want to add an IF statement into some already indented code. Does the IDE immediately indent EVERYTHING after that line or does it wait to see if an EndIF appears first? I'm not saying that it can't do it after your finished, but it can't really do anything WHILE you type in the code. |
| ||
wolron jaPBe, a PureBasic free IDE basing on Scintilla has this function for auto intend so actually it IS possible. The problem is there is no really working scope system in any of the Blitz editors ( at least none I've tested and used so far ) |
| ||
WHat about my last idea?! |
| ||
For instance, say you want to add an IF statement into some already indented code. Does the IDE immediately indent EVERYTHING after that line or does it wait to see if an EndIF appears first? no matter how large your code file is, it could be instantly tabbed. Tabs dont have to be actually inserted, it is just a matter of where it draws the text. |