View previous topic :: View next topic |
Author |
Message |
Rahalph
Joined: 01 Mar 2014 Posts: 36
|
Posted: Sun Apr 20, 2014 9:18 am Post subject: Proper Indent |
|
|
Hi,
the new feature 'Proper Indent' is really great, thank you.
It saves a lot of work, but there are a few things that need to be improved:
1. The cases of a select case should not be indented. The 'case ...:' belongs to the 'select case', like the 'else' to the 'if'. This point might be debatable, so maybe as an option?
select case Anyvar
case 1:
__Blabla
case 2:
__Whatever
case else
__Nothing
end select
not:
select case Anyvar
__case 1:
____Blabla
__case 2:
____Whatever
__case else
____Nothing
end select
2. Comments which are placed at the start of the line should stay there if they next line is empty or a label. This point is a bit tricky. Example:
' DoAnyting does anything <- Correct
DoAnything:
__' Any comment <- This is okay
__SomeCode
__'return ' <--- This should stay at the start of the line
__' DoAnythingMore is for something else <--- Phew!
DoAnythingMore:
__SomeMoreCode
return
Thanks
Ralph
(BASCOM-AVR version : 2.0.7.7 ) |
|
Back to top |
|
|
Frankeman
Joined: 11 Aug 2004 Posts: 948 Location: the Netherlands
|
Posted: Sun Apr 20, 2014 9:51 am Post subject: |
|
|
I disagree with the Select case - case - end select.
Look at other programming IDE's they do it the same way as Bascom do.
Another thing i noticed:
Between a Label and a Return statement there are no lines drawn. |
|
Back to top |
|
|
PeterM
Joined: 09 Jun 2008 Posts: 118
|
Posted: Sun Apr 20, 2014 9:52 am Post subject: |
|
|
Rohalph
Yes debatable, I suppose depends how you look at it and your Age in Computing over the years.
Partly how you described it makes sense somewhat, BUT Traditionaly thats how its always been.
Select Case NOT part of Case
Case Else is part of Select Case
Code: | Select Case Anyvar
Case 1
Blabla
Case 2
Whatever
Case Else
Nothing
End Select |
Code: | If A > 0 Then
If A = 1 Then
Blabla
ElseIf A = 2 Then Whatever
... Lets have rest
End If
Else
Nothing
End If |
For each Major Statement is a Indent
If you look at most Source Code Beautifiers they follow the same model. _________________ Peter |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Sun Apr 20, 2014 11:26 pm Post subject: |
|
|
I am used to VB and they format similar. I understand that this is all a matter of how you are used to it.
Change for next update :
- comment will never be moved. i found it better to leave comment at the designed position _________________ Mark |
|
Back to top |
|
|
Rahalph
Joined: 01 Mar 2014 Posts: 36
|
Posted: Mon Apr 21, 2014 7:57 am Post subject: |
|
|
Hi Mark,
you're right. It's all a matter of what you are used to. I started with Delphi more than 20 years ago and that's how I thought it would make sense. When I got to VS and C# I simply changed the default setting for formatting. That's why I was asking for an option
The idea regarding the comments is great, thank you very much!
Regards
Ralph |
|
Back to top |
|
|
|