Tabs vs Spaces
-
Doesn't svn just call out to diff? I know git does
Not sure behind the scenes. I'm talking about diff to an existing separate copy
-
Backspace always deletes exactly 1 character. Or the selection. Or nothing if there is nothing to delete.
Filed under: FUCKING HELL WHY DOES IT DELETE TWO CHARACTERS WHEN I PUSH BACKSPACE ONCE?
-
:set ts=4 sw=4 noet
:retab!Also note smarttab. When enabled, at the start of a line, tab inserts one indent level, and backspace will remove one indent level, regardless of how many characters need to be deleted (or added, in certain cases) for that.
Filed under: FUCKING HELL WHY DOES IT DELETE ONE CHARACTER AND ADD FOUR NEW ONES WHEN I PRESS BACKSPACE ONCE
-
Luckily the "lead" checks our work with "diff -w" so he rarely notices these changes. Using diff instead of the svn tools is a WTF for another day, though. (There's a push to move to git but I'm not sure if that will be better or worse in this case!)
(BeyondCompare for life)
FTFY
-
ReSharper doesn't even appear to do anything VS doesn't already do, except give a few (pedantic dickweed) suggestions on code style, and making the entire IDE (especially intellisense and the MS test runner) run like frozen syrup. I do not get the appeal. But we've had threads on this before.
I agree that Resharper got somewhat less useful after VS 2005 started poaching its most useful features and it has always slowed VS way down compared to vanilla. That said, you'll take my RS 2.x for VS 2003 from my cold dead hands. It's worth having a license just for that if you need to go back that far.
-
-
When I have the choice I use tabs. If I'm modifying or adding to existing code I keep whatever convention is there.
I used to work with someone who had his visual studio set to use tabs instead of spaces, and two character tabs. He used to auto format entire source files and commit hundreds of whitespace changes from the company standard of four spaces when changing a couple of lines of actual code. In annoyance levels, that's right up there with changing someone's brace style out of religious fervour. Have your preference but don't fuck with a company wide coding standard unilaterally.
-
Our standard says to never commit whitespace changes at the same time as real changes. That lets us gloss over whole commits in the code review as being pure whitespace changes.
-
BeyondCompare for life)
FTFY
Well, we also use UltraCompare but that doesn't always work well.
-
That's a good standard. Another good standard we could do with here is
code review
-
Luckily the "lead" checks our work with "diff -w" so he rarely notices these changes. Using diff instead of the svn tools is a WTF for another day, though. (There's a push to move to git but I'm not sure if that will be better or worse in this case!)
Both
git
andsvn
diff
also support-w
, so I don't think it'll make any difference.
-
Since I don't believe Microsoft shipped software that does random shit for one person and not for another
Ha ha! nice one. I acutally laughed out loud.
-
Ha ha! nice one. I acutally laughed out loud.
Ha ha hilarious joke. Use all the dollar signs to spell Micro$$$$oft. Look at those dollar signs. Hating Micro$$$$$$$$$oft is sure the way to go here in late 2014.
Now tell me how to turn on that setting.
-
This post is deleted!
-
-
Weighing in on the OT -- I'm in the spaces camp, as it saves you from having mixed tabs and spaces as soon as your indentation gets interesting. Most programming editors and IDEs I have run into are as smart as @accalia describes, though, so the whole faff about having to Backspace four times isn't a big deal, anyway.
For all you tab-only folks, I have a challenge for you. Configure your editor to allow you to produce
[code]
int some_function(
int arg1
, int arg2
, int arg3
);
[/code]without mixing spaces and tabulators. (This is the solution to the "I forgot the comma again"/"BEEP BOOP EXTRA TRAILING COMMA ERROR" problem that the shop I interned at adopted into their coding style -- it looks strange at first, but makes sense once you think about it.)
-
-
This is the solution to the "I forgot the comma again"/"BEEP BOOP EXTRA TRAILING COMMA ERROR" problem that the shop I interned at adopted into their coding style -- it looks strange at first, but makes sense once you think about it.
i hate this pattern. i really, really, really do.
i get why
but i just cannot wrap my brain around doing it!
besides if forgetting commas in your arguments is an actual issue then i tend to see that as a general red flag that you have deeper issues. that should probably b edealt with first.
-
There's an easy workaround that should satisfy both camps:
1 space tabs.
-
besides if forgetting commas in your arguments is an actual issue then i tend to see that as a general red flag that you have deeper issues.
It's a very easy mental slip to make when adding new arguments to existing code.
There are languages (Python, for instance) that allow a seemingly-spurious trailing comma for exactly this reason.
-
It's a very easy mental slip to make when adding new arguments to existing code.
yes, but it's still one that any basic linter should catch...
There are languages (Python, for instance) that allow a seemingly-spurious trailing comma for exactly this reason.
-
yes, but it's still one that any basic linter should catch...
The compiler catches it -- its just that it causes a fair bit of grief, especially with how obtuse compilers on not-so-mainstream platforms can be.
-
i didn';t say compiler. i said linter. linters tend to have much better output than compilers.
what language are they writing in that there isn't a decent linter for?
-
what language are they writing in that there isn't a decent linter for?
If you can tell linters in C to stop screaming about unused return values that aren't cast to void (and probably the 500 other nightmarish pedantry things that
lint
got its name from)...
-
Ready your slings and arrows...
I like 6-space indents.
This probably is the result of using ancient languages that had a 6-char field reserved on the left for, sigh, yes, labels. You kids and your fancy structured programming languages. </waves cane >
When I was a wee lad, all we had was "if" and "do", no weird "while" or "until" nonsense for us, no siree...
...So a six-space indent allowed you to easily read the operation (do/if) and the beginning of the variable you were working with (i, j, k, etc... )
Still looks the best, readablity-wise, to me.
But whatever the heck you do, don't mix the fool things.
-
hmm. i don't program in C but most liters allow disableing warnings, either globally or by annotations...
looking for C linters brings me prewttymuch invariably to Splint. http://www.splint.org/documentation/
maybe that could work?
also if avaialble i do know that clang gives better error messages that GCC. for compatibility reasons (all the IDES that grovel through GCC's output they can't change the output format of old errors. but Clang didn't have that requirement so gives better error messages.
-
also if avaialble i do know that clang gives better error messages that GCC. for compatibility reasons (all the IDES that grovel through GCC's output they can't change the output format of old errors. but Clang didn't have that requirement so gives better error messages
Yeah -- CLang's errors and warnings are a treat to behold; it wasn't an option back in the day that that coding style was invented, though!
-
also if avaialble i do know that clang gives better error messages that GCC. for compatibility reasons (all the IDES that grovel through GCC's output they can't change the output format of old errors. but Clang didn't have that requirement so gives better error messages.
I happened to try that last week - we're warning-free on GCC, but I know clang catches some stuff gcc doesn't. It immediately proceeded to clobber me to death with -Wcast-align, so I stopped.
-
all the IDES that grovel through GCC's output they can't change the output format of old errors
InB4 stupid CLI programs mixing UI and API
-
what language are they writing in that there isn't a decent linter for?
Some languages (Ada and Haskell come to mind) don't need linters.
-
InB4 stupid CLI programs mixing UI and API
-shrug- that's all we really had before this fancy gooey stuff came along. and who wants to mantain two different output styles depending on if a human or a program is reading the output? ick!
it's cromulent and disgusting, but when it is all one has.... well then that's all one has.
-
If these IDEs can indent for us, why are we even discussing tabs vs. spaces to begin with. Why does there have to be any character taking the place of the indent?
...
Oh, I forgot how reliable the auto-indenting is.
...
Carry on.
-
Oh, I forgot how reliable the auto-indenting is.
It's very reliable when I use it.Oh, wait, Razor views.
Carry on.
-
It works in VS. If it doesn't work it normally means I've got some mismatched braces somewhere
-
It works in VS. If it doesn't work it normally means I've got some mismatched braces somewhere
I'm working with a codebase right now in VS that has a bracing style that's funky enough to break the VS autoindenter.
-
why is autoindenting so horrible for those things?
i do a format all CTRLk+CTRLd and it won'tr fix it either.
but i delete a close bracket from a surrounding div and add it back in and that fixes it (until i hit format all reflexively again)
-
Stop using stupid languages then. I demand you port everything you're doing to C# immediately
-
... Razor Templates ARE C#. they're just a new syntax for embedding it into views that VS gets a bit confused about still
-
Oh, Razor. I had some brief exposure to that in my abortive expedition into web development. I much prefer proper desktop applications
-
The gooey stuff has been around since 1984. How long do you need?
-
That's 30 years ago. Anything in tech that long is obsolete and needs to be thrown out, so gooeys are old news. CLIs never age because they never change, so they're exempt from this rule and their time is now
-
... Razor Templates ARE C#
They can also be VB. Or, theoretically at least, any .NET language. Including Whitespace and Brainfuck, if you're willing to find/write a compiler for them
-
-
We as a society shouldn't cater to idiots.
Unless they want to pay us to program.
FTFY
-
-
hmm.... i'll grant you that...
some languages just won't die....
/me glares at FORTRAN
-
-
in the case of three of them it was the default behavior! (sublime, Cloud9 IDE and VisualStudio (if you select C# developer setting in VS2013, i can't guarantee it will do that for other keybinding layouts or versions))
Ok I just spent like 15 minutes going through every ReSharper option and every Visual Studio option, and not only is the not the default behavior, as far as I can tell this behavior isn't even available in the product.
Googling stuff like this brings up not even a hint that such a feature exists.
I am sad.
EDIT: Oh wait maybe I gave up too soon, I found this. Let's see if it's a broken piece of shit that doesn't work (protip: it almost certainly is.)
EDIT: Well it kind of half-works in some situations I guess.
-
I just booted up VS to confirm, and it is deleting to tabstop when i hit backspace at the beginning of a line of code.
checked and i'm set to use spaces not tabs (equiv of ViM expandtabs) so it's not that i'm just deleting tabs. Turning on show white-space confirms this (i get dots for spaces rather than the arrows for tabs)
colour me confused because i'm not running any extensions on this setup at all and AFAICR i haven't messed with editor preferences.
If it's any help: developing muscle memory to do a shift-tab to dedent might be a good idea, because that works in every rich editor (that isn't a website) that i have ever encountered.
-
Lies.