PeopleCodeTools – Syntax Highlighting for Sublime Text

I’ve had a few requests from people to document how I use the  PeopleCodeTools syntax highlighter in Sublime Text. Here’s a quick overview.

Firstly, the source code is freely available on github, for those that would like to contribute to it. And for those unfamiliar with installing this plugin using Sublime Text, all you need to do is first install Package Control, and then install the ‘PeopleCodeTools’ plugin from Package Control.

The plugin should work for PeopleCode methods (in Application Classes), Functions and Event PeopleCode when using ctrl/cmd + r to bring up the Goto Symbol prompt. Here’s an example of searching for Event PeopleCode on a PeopleCode dump:

Event PeopleCode

Here’s another example of searching for method PeopleCode:

Method PeopleCode

The extensions of the PeopleCode files need to end in either .ppl or .pcode.

I’ve also created syntax highlighters for .tracesql files. Although bear in mind that .tracesql files can sometimes generate code with unmatched quotes resulting in messed up syntax highlighting:

Messed up syntax highlighting

For this specific issue I’ve created a tool to tidy up .tracesql files (also available in the plugin). To run the tidy tool, run the “PeopleCode Tools: Tidy PeopleCode Trace” tool from the command palette:

tidy

The syntax highlighting should now look okay:

Tidied syntax highlighting

I’ve noticed that the syntax highlighting plugin slows the opening time for very large files (i.e. 50 MB or greater) due to the fact that the plugin uses regular expressions to create scopes. For this reason, I usually open up a PeopleCode dump at the start of my day and peruse it when needed. I’ve also noticed that the tidy command can take up to 60 seconds on 15MB tracesql files, so please be patient.

Also, when searching for text within large files, I’d recommend disabling the ‘Highlight matches’ option when searching large files:

Disable Highlight matchesIf ‘Highlight matches’ is not disabled, the search will try to instantly match every single character you type. I’m yet to figure out a way to toggle this functionality on and off, so I have to manually de-select it for now.

I’ve also noticed that if you are using the BracketHighlighter plugin, you’ll need to disable it by running ‘BracketHighlighter: Toggle Global Enable’ from the command line. If not, the response times for pretty much anything you do will be quite slow.

That’s all for now. Hope you guys find this plugin useful!


Warning: Missing argument 1 for cwppos_show_review(), called in /var/www/jaymathew.com/wp-content/themes/flat/content-single.php on line 29 and defined in /var/www/jaymathew.com/wp-content/plugins/wp-product-review/includes/legacy.php on line 18

6 comments

    1. Cool, let me know how it goes. At the moment I’ve only been testing on the Windows platform, so hopefully it’ll work on others.

      Yes, TraceMagic is an excellent tool, although I only tend to use it when diagnosing performance related issues. For everything else, I use Sublime, just because I like the searching capabilities it provides. Specifically, I find the Goto Symbol functionality priceless when wanting to get a list of all the events, methods and functions that were executed. I can then easily jump between definitions as needed.

      The Extract PeopleCode Call Stack tool was created purely to speed up my own workflow (i.e. not having to load TraceMagic and sift through the extra information). Plus, since I was more interested in the sequence and flow of PeopleCode events, functions and methods and didn’t really need to know anything performance related, I wrote the tool to extract just the information I was after, making the output a little easier to read…or at least I think so :P.

  1. I finally just tried your plugin with straight peoplecode – not bad at all! I need to get around to installing this at work as we have some things blocked by proxy. I need to update mine as well. I have added function list for Notepad++ and need to upload the whole thing to GitHub.

    Keep up the good work though – I noticed you have put in quite a few hours 🙂

  2. Brilliant !
    Thanks very much and love it !

    My questions are :
    Is there any possibility to tip the peoplecode built-in functions ?
    And ignore Cases in peoplecode ?
    And another color For variables than white …

    (ps : i found it from here “https://sublime.wbond.net/channel.json” …. lucky aha.)

    1. Thanks. Pretty amazing that you discovered it from the channel.json :P.

      Sorry, I’m not actually sure what you mean by tip PeopleCode Built-in functions. Are you referring to code completion? If so, then I don’t believe it’s possible to achieve that with Sublime Text…yet.

      Good idea about ignoring case for reserved words though. I’ve added that in the latest version. It is possible to change the colour of variables, and the reason I did not implement it that way was because Application Designer doesn’t do it. But I’ve decided to now add colour to variables too since in theory the colour can be changed using a Syntax Specific colour scheme. Although I personally haven’t tried doing this.

Leave a Reply

Your email address will not be published. Required fields are marked *

*