智能缩排算法文档? [英] Smart Indent algorithm documentation?

查看:162
本文介绍了智能缩排算法文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我记录的是对编码流微妙而显著影响IDE功能的正确行为的忠实粉丝 - 比如自动完成选择注释/取消注释code 的你可能不知道你拿的优势,但在这一天结束时,你得到更多的只是有点做得比你可能有。我希望其他语言服务,我必须使用集成的功能(S),随后提高了我每天的生活编码这样做。 真正的智能缩排,即Visual Studio 2008的C#编辑器,是其中的功能之一。

I'm a big fan of documenting the proper behavior of IDE features that have a subtle but significant impact on coding flow - things like auto-completion selection and commenting/uncommenting code you might not realize you take advantage of but at the end of the day you got just a bit more done than you might have. I do so in hopes that other language services I have to use incorporate the feature(s), subsequently improving my daily coding life. "Real" Smart Indent, i.e. the Visual Studio 2008 C# editor, is one of those features.

基本块code缺口是相当简单的,可以被黑客攻破在一起的时间不够好,把工作做好的合理费用。真正的智能缩排,在另一方面,很可能是最具技术挑战性的任务,我已经在IDE中日实现了,我已经实现了我的公平份额。即使完全成熟的即时自动code重新格式化更容易;它只是推迟到智能缩排在繁重的任务。

Basic block code indentation is reasonably straightforward and can be hacked together in a reasonable amount of time well enough to get the job done. True Smart Indent, on the other hand, is quite possibly the most technically challenging task I've had to implement in the IDE to date, and I've implemented my fair share. Even full-blown on-the-fly automatic code reformatting is easier; it just defers to Smart Indent for the heavy lifting.

我在寻找的通用智能缩进算法的高级别讨论。 特别,我在找任何研究智能缩进策略,或为全部正常,边缘,可以进行测试以确保可重复的,无缺陷的结果情况的客观描述。最后,我倒是希望提供的功能,既是一个详细的工作流程,为实际执行的功能,最后组装,从一个特定语言的版本,并将其整合到我的语言服务混凝土地基。

I'm looking for high-level discussions of general purpose Smart Indent algorithms. In particular, I'm looking for either research on smart indent strategies, or an objective description of all normal and "edge" cases that could be tested to ensure repeatable, bug-free results. Eventually, I'd like to provide both a detailed workflow of the functionality, a concrete foundation for actually implementing the feature, and finally assembling a language-specific version from that and integrating it into my language services.

PS:Visual Studio 2010中的C#编辑器有这个功能的几个小错误。已经实现了它自己,我有一段时间,以便把它擦亮工作的一个全新的尊重。

PS: Visual Studio 2010's C# editor has several small bugs in this feature. Having implemented it myself, I have a whole new respect for the work it takes to polish it.

修改(8/25):我设法写下草案规定了解我是怎么想的时候,聪明的缩进是在一个code注释事情的处理方式。我可能会从规则的C ++ / C#角度开展工作,但后来他们应该可以进行参数设置为其他语言的各个方面。

Edit (8/25): I managed to write down a draft the rules for how I think things should be handled when the smart indent is inside a code comment. I'll probably be working from a C++/C# perspective on the rules, but later they should be able to be parameterized for aspects of other languages.

推荐答案

Emacs的CC手动模式:<一href="http://cc-mode.sourceforge.net/html-manual/Syntactic-Analysis.html#Syntactic-Analysis">Indentation发动机基础的。

Emacs CC Mode manual: Indentation Engine Basics.

史蒂夫Yegge博客咆哮: JS2 -mode:为Emacs 一个新的JavaScript模式

Steve Yegge blog rant: js2-mode: a new JavaScript mode for Emacs.

从后者引用:令人惊讶的,出人意料的是,直觉相反,压痕问题的几乎完全正交的要对它进行解析和语法验证。

Quote from the latter: "Amazingly, surprisingly, counterintuitively, the indentation problem is almost totally orthogonal to parsing and syntax validation."

这篇关于智能缩排算法文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆