views:

102

answers:

3

I'm just learning about F# and plan to use it for my next project. One thing I find immediately confusing is the lack of support for tab characters in .fs files. I love how indentation is used to show scope/hierarchy, but using spaces just seems so antiquated. Do I have to press backspace four times just to get back to the parent block? What happens if I accidentally hit backspace only three times but don't notice it and keep typing?

+2  A: 

If there's no other option to make this easier, you can turn on visible whitespace in Studio with Control + E + S.

wsanville
+5  A: 

Tabs Are Evil. Why Tabs Are Evil. But really, Tabs Are Evil.

Eric Towers
Tabs are only evil if you use them to line things up with things that occur in the middle of other lines, which I never do anyway, nor would you seemingly need to in F#. Tabs are perfect for indenting precise amounts easily and uniformly, which is exactly what F# would need it for, it seems. Spaces are far more evil for indenting, imo.
chaiguy
tabs are handy for indenting ... right up until some "helpful" editor starts replacing sequences of spaces with tab(s) to match whatever its tab stop setting is. And/or vice versa. Both types of editors exist.
Eric Towers
+6  A: 

If you're using VS2010, then pressing "tab" will indent four spaces, and subsequently, pressing "backspace" will also "do the right thing" for you. (I expect that some other text editors also have this feature, or at least you can configure them to do so.) If you do happen to get the wrong indent, then you're like to get error/warning squiggles as quick feedback in the VS editor.

If you're using a professional version of Visual Studio 2010, then I recommend using Column Guides from the Pro Power Tools extension. Watch this video

http://msdn.microsoft.com/en-us/fsharp/ff742849.aspx

(specifically, about two-and-a-half minutes, starting at about 2:05) to see how to use Column Guides to make F# indentation easier to discern.

Brian