Delphi 代码格式化程序
是否有任何实用程序可以重新格式化 Delphi 代码?
编辑
我正在使用 Delphi 2006
一些反馈
感谢所有回答这个问题的人,
我一直在使用 JCF 代码格式化程序 - 它运行良好,我的代码已格式化为 对象 Pascal 风格指南
Are there any utilities that reformat Delphi code ?
EDIT
I am using Delphi 2006
Some feedback
Thanks to all that answered this question
I have been using the JCF code formatter - it works well and my code is been formated to Object Pascal Style Guide
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
您可以尝试“Jedi 代码格式”。 请在此处查看更多信息: http://jedicodeformat.sourceforge.net/
DelForExp 的格式化引擎已集成进入 GExperts 的代码库。 GExperts 的实验版本,其中包含“代码格式化程序”:
http://blog.dummzeuch.de/experimental-gexperts-version/
DelForExp 的单独信息/下载此处。
问候。
You can try the "Jedi code Format". See more information here: http://jedicodeformat.sourceforge.net/
The formatting engine of DelForExp has been integrated into the code base of GExperts. An experimental version of GExperts including a "Code formatter" here:
http://blog.dummzeuch.de/experimental-gexperts-version/
Separate information/downloads for DelForExp here.
Regards.
一段时间以来,我一直在发布实验性 GExperts 版本,其中包括以前称为 DelForEx 的代码格式化程序,并进行了一些改进和修复。 最新版本于 2020 年 10 月 23 日发布,支持以下 Delphi 版本:
但请注意,我仅在 Delphi 2007 中使用它,因此其他版本可能有未知的错误。 另外,并非所有较新的 Delphi 版本的语言改进都有效,例如嵌套类型、泛型和匿名方法。
有关详细信息,请参阅 gexperts.dummzeuch.de。
顺便说一句:任何改进格式化程序的帮助,特别是添加新的语言结构,将不胜感激。 源代码可以从我的主页链接的 subversion 存储库下载。
I have been for some time releasing experimental GExperts versions that include the code formatter formerly known as DelForEx with some improvements and fixes. The latest release is from 2020-10-23 and supports the following Delphi versions:
Please note, though, that I am using it only with Delphi 2007, so the other versions may have unknown bugs. Also, not all language improvements of later Delphi versions will work, e.g. nested types, generics and anonymous methods.
see gexperts.dummzeuch.de for details.
btw: Any help improving the formatter, especially adding the new language constructs would be appreciated. The source code can be downloaded from the subversion repository linked from my homepage.
我发现了这个:JEDI 代码格式
I found this: JEDI Code Format
lextudio - CodeGear RAD Studio 2007 的代码美化器集合 6
http://code.google.com/p/ lextudio/
lextudio - Code Beautifier Collection 6 for CodeGear RAD Studio 2007
http://code.google.com/p/lextudio/
是的,
我一直使用支持此功能的 TWM 实验版本 os GExperts。
在 Delphi 2006 和 2007 中它工作得很好(虽然不知道旧版本)。
当前版本正在添加对Delphi 2009的支持,但我不知道是在哪个阶段,您可以在这里找到更多信息:
http://www.dummzeuch.de/delphi/gexperts/english.html
Yes,
I always used TWM's experimental version os GExperts which support this feature.
In Delphi 2006 and 2007 it works perfectly (Don't know about older versions though).
The current version is adding support to Delphi 2009, but I don't know in which stage it is, you can find more about it here:
http://www.dummzeuch.de/delphi/gexperts/english.html
顺便说一句:自从 Delphi 2010。
BTW: There is an integrated Source Code Formatter since Delphi 2010.
Free Pascal 也有一个代码格式化程序 ptop,但它只实现了更基本的方言(例如 D4-D6 级别)。
Lazarus 最近更改为使用 Jedi 代码格式化程序 afaik。
Free Pascal also has a codeformatter, ptop, but it only implements the more basic dialect (say D4-D6 level).
Lazarus recently changed to use the Jedi codeformatter afaik.
GExperts 的 TWM 版本运行良好,并且很好地集成到 IDE 中。 它使您能够编写和修改代码,而不必过多担心精确的格式,然后只需按指定的热键即可立即重新格式化。 我一直发现它很容易设置来匹配我喜欢的风格,而不是像 JEDI 代码格式那么复杂,这对我来说看起来有点大材小用。
Delphi 2009 版本现在可以通过上面发布的链接获得,但它基于 GExperts 的测试版。 不过,它的底层格式化程序仍然大致相同,并且不知道一些较新的 Delphi 增强功能的语法。
The TWM version of GExperts works well and is nicely integrated into the IDE. It enables you to write and modify your code without worrying too much about exact formatting, then just hit the assigned hot-key and it instantly reformats. I have always found it easy to set up to match the style I prefer, and not as complex as JEDI Code Format, which looked like overkill to me.
The Delphi 2009 version is now available from the link posted above, though based on a beta release of GExperts. It is still much the same formatter underneath, though, and is unaware of the syntax of some of the newer Delphi enhancements.
我刚刚做了一个基于JCF的在线pascal代码美化器。 尝试。
您可以在 https://pak.lebah.web.id/jcf HTH
I just made an online pascal code beautifier based on JCF. You may try it at https://pak.lebah.web.id/jcf
HTH.
OPEdit II 是免费的,而且运行得很好。
它是一个全文编辑器,具有代码重构和代码浏览功能。
有一个文本格式化程序,它使用内部代码解析器,因此可以像真正的 Delphi 编译器一样处理条件定义。
请参阅 http://www.codefactor2.com
There is OPEdit II which is free, and works very well.
It's a full text editor, with code refactoring and code browsing.
There is a text formatter, which uses the internal code parser, therefore handle conditional defines just as a real Delphi compiler.
See http://www.codefactor2.com
有一个程序 PascalFormat
There is a program PascalFormat