Is there any way to get code folding in Delphi 7?

风格不统一 提交于 2019-12-10 22:37:23

问题


I know this is a long shot - but is there any way at all to get code folding into Delphi 7?

I'm working on some .. "suboptimal" .. code. Sometimes I really need to fold bits away to grok a stupid-long procedure. Currently I'm pasting code into Notepad++, which works, but it would be nice to have it in the IDE.


回答1:


Look for "method folding" on this FAQ (for GExperts) and you'll see that even this team, which has added many enhancements to Delphi, doesn't think this is in the cards for Delphi 7. I've looked for solutions and haven't seen them.




回答2:


I don't know any way to do the code folding in Delphi 7, but there are some Delphi plug-ins that will make viewing code much better

Castalia for Delphi http://www.twodesks.com/castalia/

and the free one cnPack http://www.cnpack.org/index.php?lang=en




回答3:


Not exactly the same, but you could put your "folded" code into a separate file, then include the file using the {$I filename.inc} compiler directive. Its been awhile since I used Delphi 7 but I believe if you put the cursor on the filename and hold control and click the filename will open in the ide.




回答4:


{$i filename.inc} is the right way. I had similar suboptimal code and had 8.000 lines of "dead" database-udating code placed outside the main form (bringing it down to 12.000 lines of suboptimal code). An include file helps isolating functionality and therefore eases the final task of making it into a class.




回答5:


As already mentioned, you could use the include file. But personally I don't like the idea of removing parts of code to another file, especially parts of a procedure (if I interpret your question the right way). I would prefer using bookmarks to rapidly navigate through the procedure, skipping the irrelevant parts, and the Ctrl+Shift+Up/Down key combinations to alternate between implementation and definition of methods.



来源:https://stackoverflow.com/questions/189893/is-there-any-way-to-get-code-folding-in-delphi-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!