Source Insight阅读PHP项目的代码…

来源:互联网 发布:全球社交网络名人排行 编辑:程序博客网 时间:2024/06/09 16:17

Source Insight(以下简称SI)是非常强劲的代码阅读工具,安装后也就才3M大小,但在阅读别人的代码的时候实在是太方便了,尤其在查找类,函数的相关定义的时候。

SI标准内置的语言主要在c/c++/Java/C#等,但就是没有PHP。这次有个比较大的PHP的项目代码需要接手,用UE看了一段,里面的函数跳来跳去,实在是麻烦。后来google了一下,发现SI官方网站自己带了PHP的语言定义文件,按照网站上的说明,倒入,配置了以下。类,函数等关联操作都已经可以了,就是语法的高亮没有。基本上就只有几个流程控制if,else高亮显示,看起来累就一个字。

从SI的language中导出的PHP语言定义,发现只配置了很少的流程控制字为keyword,所以只有这些是高亮的。这下好办了,从UltraEdit的wordfile.txt中把php的高亮配置导出,做了一些处理,分成内置function,keyword,control,operator四类,写成一个新的文本,然后再倒入进语言定义。

接着在颜色style中配置了对这四类的颜色显示,一切就OK了。

为了方便大家,我把自己做好的PHP语言定义文件和style文件上传,方便大家使用。

使用方法:

==》》解压缩,里面有两个文件:PHPScript.CLF,PHP-Styles.CF3

==》》语言文件:PHP Script.CLF

按照这个页面的提示:http://www.sourceinsight.com/public/index.html

Source Insight Downloads

This page contains links to macro and custom languagedirectories.

Macros

Sample Source Insight macros.

Languages

Custom Language files for adding new language support toSource Insight.

To import a custom language file into Source Insight:

1. Select Options > Preferences.Click the Languages tab.

2. Click the Import button. Select and load thecustom language file (.CLF)

3. You should now see the new language in the list oflanguages.

4. Click the Document Types button to open theDocument Options dialog box.

5. If you don’t have a document type already created for thetype of language file, you will need to create one now. If youalready have a document type created, select it in the list and goto step 7.

6. Click the Add Type button to create a newdocument type.  Give it a name that describes thetype of file. For example, “Ant File”. Click OKand then fill in the file filter text box with awildcard.  For example, “*.ant”.

Source <wbr>Insight阅读PHP项目的代码的详细配置

7. In the Parsing section of the DocumentOptions dialog box, select the newly imported language in thelanguage drop-down list. This is what associates your document typewith the custom language.

8. Click the Close button to close DocumentOptions. Then click OK to close the Preferencesdialog box.

Source <wbr>Insight阅读PHP项目的代码的详细配置

==》》style文件:PHP-Styles.CF3

菜单“options”-》“StyleProperties”,在弹出窗口中,选择“load”,选中style文件:PHP-Styles.CF3。确定后,你可以在左侧的“StyleName”列表中看见增加了四个新的php-function,php-keyword,php-control,php-operator。在点击“Done”确定后,就好了。

Source <wbr>Insight阅读PHP项目的代码的详细配置


所需要的PHP语言定义文件和style文件打包下载地址如下:

SI的PHP配置文件

PS:

关于ZDE的问题,主要是ZDE太大了。而SourceInsight的颜色样式都是可以配置的。SI无论阅读代码还是编辑都是很好用的。只是不象ZDE那样和PHP结合的紧密,需要自己来配置来能支持PHP。而且没有集成调试。

0 0
原创粉丝点击