how do I get the code indented right

BlitzMax Forums/BlitzMax Beginners Area/how do I get the code indented right

Najdorf(Posted 2005) [#1]
Is there are way to have the editor correct indentation automatically?????


Curtastic(Posted 2005) [#2]
I wish


Najdorf(Posted 2005) [#3]
Man why the hell isnt there? I mean wtf it doesnt seem hard to code! I cant waste 30 minutes to indent my project if it could be done in a sec!

<old man complaint since in my life I always wanted to have nicely indented code, but never had an ide that did it>


Perturbatio(Posted 2005) [#4]
It does of course maintain the tab level.


Najdorf(Posted 2005) [#5]
well thats useless since I dont indent in the first place. I mean, a "lazy programmer" tool like blitzmax MUST have it!!!!


Curtastic(Posted 2005) [#6]
One day I will make the ultimate blitz IDE...


PetBom(Posted 2005) [#7]
...since I dont indent in the first place


Well, there's your problem. Learn to indent correctly while you're coding!


Will(Posted 2005) [#8]
Even if you indent as you program, ive had to put if statements around things, or move large numbers of functions into types, and then it takes me about 5 minutes of tabbing to get everything back indented right.


Najdorf(Posted 2005) [#9]
yeah, or if you cut and paste stuff it's always a mess.


REDi(Posted 2005) [#10]
yeah, and when you click on the new page button, it should pop up already coded for ya, come on guys, mark sibly has put a lot of WORK into this brilliant language, and has a lot more still to do, without f'ing auto tabbing.

Do you really find it so hard to push the tab key?


bradford6(Posted 2005) [#11]
this is a joke, right?


Curtastic(Posted 2005) [#12]
We use "ctrl + ]" now. I hope you like it because apparently you shouldn't even suggest improvements


REDi(Posted 2005) [#13]
Okay I see your point "ctrl + ]" would be quite annoying.

apparently you shouldn't even suggest improvements

I don't see any suggestions in the posts above, only a question and then some insults.
Chill out :)


Najdorf(Posted 2005) [#14]
hey I didnt insult anybody. ok, i was a bit annoyed up there because I had never seen that feature before, then I saw it in a html editor and it made my life so much better, that's hard to describe, and I just dont get why such a terribly useful and apparently simple command is not put as a first thing in all code editors, it would have made my life a lot easier every time I coded something.

I dont indent by myself because the benefit of indenting (although big) is not worth the incredible amount of time you waste, since every time you change a little thing you often have to reindent everything and such.

it's like "retroactive pain" :)


Curtastic(Posted 2005) [#15]
One day people will wage war over things like this. In the year 2205 when everyone is a programmer...

I don't see any suggestions in the posts above, only a question and then some insults.
Chill out :)


hey good point. I just watched some TV then came back here and realized how stupid it felt.
chllin is good


Okay I see your point "ctrl + ]" would be quite annoying.


it IS. have you been coding with the new windows release of blitzmax much?


I dont indent by myself because the benefit of indenting (although big) is not worth the incredible amount of time you waste


Yes it is worth it! you can get fast at selecting a bunch of lines of code and hitting the tabber. ...unless the key combinations change


REDi(Posted 2005) [#16]
have you been coding with the new windows release of blitzmax much?

Just a few days, and I'm LOVING IT, OO in basic is brilliant!
I think they should rename it to "Blitz Object Orientated Basic" or "BOOB" err, maybe not :)


Curtastic(Posted 2005) [#17]
I like to make games with boob


MikeHart(Posted 2005) [#18]
hey I didnt insult anybody. ok, i was a bit annoyed up there because I had never seen that feature before, then I saw it in a html editor and it made my life so much better, that's hard to describe, and I just dont get why such a terribly useful and apparently simple command is not put as a first thing in all code editors, it would have made my life a lot easier every time I coded something.

Well, if you tried to code such a function yourself before, then you would see that it isn't that easy. Espercially if a language is flexible in some ways you can code. Want an example?
IF a=1 THEN b=1 : ENDIF

IF a=1 THEN B=1

IF a=1 THEN
   b=1
ENDIF

IF a=1
   b=1
ENDIF

I'm sure I missed one or two more ways of coding an IF structure with the blitz languages.
Or another good example from another language:
IF a=1 : /*Set b to 1*/ : b=1: ENDIF

Nested comments, well here you go. To finalize my statement,
as easy as it seams in the first place, the more open
a language is the more it becomes a nightmare to code
such a function.

Cheers
Michael


Curtastic(Posted 2005) [#19]
Ya it would need an expression evaluator to tell which 1 of these 2 should get a tab

IF a=1 b=5
IF a=0 or b=5


PetBom(Posted 2005) [#20]
The process of revising your code to indent it to reperesent the logical structure of the program, is really a lot more useful than making it look pretty. Whilst doing it you find things that you can make more efficent, decide to move things for the sake of order, spot errors, check if your naming convetions is coherent, etc.

Revising your code is essential. "Code and forget" doesn't work. When working you need to constantly revisit your code to make sure that everything is on track. Keeping your indenting in nice shape is part of this process. It's not time wasted, I promise.

Professionally I develop (mostly) using MS VS.NET. It has auto-indenting support, bút I still do most of my indenting by hand. It find it helps me think.

Poor code-indenting habits also suggest that you've never worked as part of a team, where some one else needs to use your code. Try leaving un-indented code to a colleague and see what happens. Don't be surprised if you're not invited to the christmas party...

My 0.02$

//PetBom


Rob Farley(Posted 2005) [#21]
I wrote this for Blitz3D in Blitz3D but I'm sure a BMax version could be quite easily knocked up using this as a basis.

http://www.blitzbasic.com/codearcs/codearcs.php?code=1229


Perturbatio(Posted 2005) [#22]

Okay I see your point "ctrl + ]" would be quite annoying.

it IS. have you been coding with the new windows release of blitzmax much?


I don't see his point, surely CTRL+[] is the same as CTRL+TAB excep that you use your right hand to do it?
Ok, I can see how it would be annoying if you only have one finger but that would be an exceptional circumstance where CTRL+TAB would also be annoying.


Curtastic(Posted 2005) [#23]
In other editors, you can just select a bunch of lines of code and press TAB to tab it. It even used to work in blitzmax.


REDi(Posted 2005) [#24]
I don't see his point, surely CTRL+[] is the same as CTRL+TAB excep that you use your right hand to do it?


On the Win32 version you only have to press the tab key no ctrl. ;)


bradford6(Posted 2005) [#25]

On the Win32 version you only have to press the tab key no ctrl. ;)




not true. if you highlight multiple lines of code and hit TAB, it erases them, you have to hit ctrl-] to indent multiple lines . ctrl-[ to de-dent (? is that a word)

I would much rather have tab indentions for multi-lines


Ziltch(Posted 2005) [#26]
I am creating my own editor for bmax/blitz/purebasic and auto indenting is harder than it sounds.
I thought it would be simple but it is the exceptions to the simple rules that make it tricky.
It is nice to have auto indenting and code reformating. And one of the many reasons why I finally decided to write a editor to my own tastes.