Options -> Document Options, Document Type 下拉選 C++ Source File, File Filter 中加入,*.cc
為Source Insight添加語言支援
1. 下載語言支援檔案。http://www.sourceinsight.com/public/languages/
2. 選擇 Options > Preferences。點擊Languages 標籤。
3. 點擊 Import 按鈕。選擇和載入定製的語言檔案 (.CLF)。
4. 現在你可以看見新的語言出現在語言列表中。
5. 點擊 Document Types 按鈕開啟檔案選項對話方塊。
6. 如果你沒有為該類型的語言檔案建立檔案類型,你需要立即建立一個類型。如果你已經建立了類型,在列表中選擇該類型並繼續步驟7。
7. 點擊 Add Type 按鈕來建立新的檔案類型。為檔案類型起一個名字。例如 "Ant File"。點擊OK 在檔案過濾文字框中填入一個萬用字元,例如"*.ant"。
8. 在文檔選項對話方塊的 Parsing 部分,在語言下拉式清單中選擇最新匯入的語言。這將把你的檔案類型與定製的語言聯絡在一起。
9. 點擊Close 按鈕關閉檔案選項。然後點擊OK 關閉參數選擇對話方塊。
Source Insight支援的檔案類型有
390 Asm、68000、ARM、CMD Batch、Delphi、Lua、MASM、PHP Script、PIC、PPC、Python、Ruby、SQL、TCL、delphi、verilog
配置
Source
Insight閱讀PHP項目的代碼
Source Insight(以下簡稱SI)是非常強勁的代碼閱讀工具,安裝後也就才3M大小,但在閱讀別人的代碼的時候實在是太方便了,尤其在尋找類,函數的相關定義的時候。
SI標準內建的語言主要在c/c++/Java/C#等,但就是沒有PHP。這次有個比較大的PHP的項目代碼需要接手,用UE看了一段,裡面的函數跳來跳去,實在是麻煩。後來g了以下,發現SI官方網站自己帶了PHP的語言定義檔案,按照網站上的說明,倒入,配置了以下。類,函數等關聯操作都已經可以了,就是文法的高亮沒有。基本上就只有幾個流程式控制制if,else高亮顯示,看起來累就一個字。
從SI的language中匯出的PHP語言定義,發現只配置了很少的流程式控制制字為keyword,所以只有這些是高亮的。這下好辦了,從UltraEdit的wordfile.txt中把php的高亮設定匯出,做了一些處理,分成內建function,keyword,control,operator四類,寫成一個新的文本,然後再倒入進語言定義。
接著在顏色style中配置了對這四類的顏色顯示,一切就OK了。
為了方便大家,我把自己做好的PHP語言定義檔案和style檔案上傳,方便大家使用。
使用方法:
==》》解壓縮,裡面有兩個檔案:PHP Script.CLF,PHP-Styles.CF3
==》》語言檔案:PHP Script.CLF
按照這個頁面的提示:http://www.sourceinsight.com/public/index.html
Custom Language files for adding new language support to Source 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 the custom language file (.CLF)
3. You should now see the new language in the list of languages.
4. Click the Document Types button to open the Document Options dialog box.
5. If you don't have a document type already created for the type of language file, you will need to create one now. If you already have a document type created, select it in the list and go to step 7.
6. Click the Add Type button to create a new document type. Give it a name that describes the type of file. For example, "Ant File". Click OK and then fill in the file filter text box with a wildcard. For example, "*.ant".
7. In the Parsing section of the Document Options dialog box, select the newly imported language in the language drop-down list. This is what associates your document type with the custom language.
8. Click the Close button to close Document Options. Then click OK to close the Preferences dialog box.
==》》style檔案:PHP-Styles.CF3
菜單“options”-》“Style Properties”,在快顯視窗中,選擇“load”,選中style檔案:PHP-Styles.CF3。確定後,你可以在左側的“Style Name”列表中看見增加了四個新的php-function,php-keyword,php-control,php-operator。在點擊“Done”確定後,就好了。