F# 中的空格和缩进
我刚刚学习 F# 并计划将其用于我的下一个项目。我立即感到困惑的一件事是 .fs 文件中缺乏对制表符的支持。我喜欢如何使用缩进来显示范围/层次结构,但使用空格似乎已经过时了。我是否必须按退格键四次才能返回父块?如果我不小心只按了三下退格键但没有注意到并继续输入,会发生什么情况?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用的是 VS2010,那么按“tab”将缩进四个空格,随后按“退格”也将为您“做正确的事情”。 (我希望其他一些文本编辑器也具有此功能,或者至少您可以将它们配置为这样做。)如果您碰巧得到了错误的缩进,那么您可能会收到错误/警告波形图作为快速反馈VS 编辑器。
如果您使用的是 Visual Studio 2010 的专业版本,那么我建议使用 Pro Power Tools 扩展。观看此视频
http://msdn.microsoft.com/en-us/fsharp/ ff742849.aspx
(具体来说,大约两分半钟,大约 2:05 开始)了解如何使用列参考线使 F# 缩进更容易辨别。
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.
如果没有其他选项可以简化此操作,您可以使用 Control + E、Control + S 在 Studio 中打开可见空白。
If there's no other option to make this easier, you can turn on visible whitespace in Studio with Control + E, Control + S.