ScHpEnXeL Suspended 32613 Posts user info edit post |
i dl'd it the other day. need to spend some time in it 8/27/2009 9:40:40 AM |
Noen All American 31346 Posts user info edit post |
I can't wait to be able to show off the stuff I worked on 8/27/2009 1:30:19 PM |
LimpyNuts All American 16859 Posts user info edit post |
If you work on VS, then there's something that SERIOUSLY needs fixing.
Open up a VB project and type:
If True Then Debug.Print()
Put the cursor between "Then" and "Debug" and hit Enter. The result:
If True Then < cursor is here End If Debug.Print()
The automatic formatting just changed the logic of the code when all I did was make a formatting change.
Or maybe I want to convert a method call to a With block:
With Debug{Insert line break here}.Print()
Result is invalid code:
With Debug < cursor is here End With .Print() ]8/27/2009 8:47:56 PM |
ScHpEnXeL Suspended 32613 Posts user info edit post |
blah blah blah 8/27/2009 8:58:24 PM |
qntmfred retired 40726 Posts user info edit post |
you can fix that serious problem by using C# 8/27/2009 9:01:31 PM |
LimpyNuts All American 16859 Posts user info edit post |
C# can blow me. It compiles to the exact same IL. I like programming languages with words in them and putting {}'s everywhere is annoying because I hardly ever hit them otherwise.] 8/27/2009 9:21:35 PM |
ScHpEnXeL Suspended 32613 Posts user info edit post |
NO, YOU CAN BLOW YOURSELF, SIR. 8/27/2009 9:46:22 PM |
LimpyNuts All American 16859 Posts user info edit post |
What do you think I'm doing right now?! 8/27/2009 10:06:01 PM |
ScHpEnXeL Suspended 32613 Posts user info edit post |
trying to blow yourself and then finding out your cock is too small to reach? 8/27/2009 11:19:06 PM |
Noen All American 31346 Posts user info edit post |
Quote : | "If you work on VS, then there's something that SERIOUSLY needs fixing.
Open up a VB project and type:
If True Then Debug.Print()
Put the cursor between "Then" and "Debug" and hit Enter. The result: If True Then < cursor is here End If Debug.Print()" |
That isn't a bug. VB require explicit closure of conditionals.
You HAVE to place a End If to ensure the code will work properly. It's saving your ass from unexpected behavior. That's the price you pay for not having to deal with those fancy {'s, }'s and ;'s8/28/2009 1:25:46 AM |
Wolfmarsh What? 5975 Posts user info edit post |
I have written literally millions of lines of code in VB, and never once found a problem with the auto-formatter that I considered a bug. 8/28/2009 8:39:43 AM |
qntmfred retired 40726 Posts user info edit post |
oh hell yeah, i use that line all the time
it's not a bug...it's a feature! 8/28/2009 9:12:22 AM |
LimpyNuts All American 16859 Posts user info edit post |
Warning: WORDS. In this post I try to elaborate on why this behavior causes a problem and the fact that the C# formatter does not fuck up your code in the exact same situation. If there is a simple way to turn a single-line statement into a block in VB without cutting and pasting code, let me hear it.
Quote : | "You HAVE to place a End If to ensure the code will work properly. It's saving your ass from unexpected behavior. That's the price you pay for not having to deal with those fancy {'s, }'s and ;'s" |
Yeah, I know the End If is required. I've been programming in VB since 1998. However, the auto formatter is taking everything to the right of the cursor and putting it outside the newly created block. I can't think of a single situation where that is a desirable behavior.
Imagine you have a single-line If. Then you realize you need to add a few actions under that same condition.
In old versions of VS, you put the line break where it's needed, hit the down arrow, type your new statements, hit enter, type "End If", and hit Enter.
With the new VS, it's: line break, down, down, home, shift+end, ctrl+x, {shift+home, backspace, backspace to remove the extra blank line}, up, up, ctrl+v, enter, new statements. (Or you can cut the code at the end of the line, hit enter and paste it, which is still ridiculous) It's like entering a god damn video game cheat code.
And you have to do the same thing to break Class(Expression).Method out into a With block.
You know what the formatter does in the same situation in C#? Nothing. Take a single line if in C# and insert {[enter] in the appropriate place. It doesn't insert the } before whatever statement was on the end of the line. You'll notice this behavior is different from what it does when there are no statements after the { (it will add the closing bracket). So in C#, I can do exactly what I did in VS6: line break, down arrow, new statements, closing bracket. Why does the formatter for VB behave differently?
The desirable behavior is either put the code to the right of the cursor inside the block, or do nothing at all when there's something to the right of the cursor like it does in C#.
Quote : | "I have written literally millions of lines of code in VB, and never once found a problem with the auto-formatter that I considered a bug." |
I have no idea how many lines I've written, but that has no bearing on the fact that the formatter turns a simple task into a disaster.8/28/2009 10:24:51 AM |
Noen All American 31346 Posts user info edit post |
Quote : | "Imagine you have a single-line If." |
You cannot have a single line "if" statement in VB.
It MUST be formatted:
If then
End If
You are writing bad code, plain and simple. There's nothing wrong with the formatter, the behavior is correct. The auto-formatting is there to ASSIST good practices.
With the new VS (and old for that matter) you just write the code in the proper structure and this is never, ever an issue.8/31/2009 11:37:38 PM |