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!

I’ve added another tool to the PeopleCodeTools Sublime Text plugin that allows you to extract the call stack from a PeopleCode trace. You can find it on the PeopleCodeTools repository on github along with the syntax highlighters for PeopleCode and PeopleSoft trace files.

For those unfamiliar with installing this plugin, please see my previous post: PeopleCodeTools – Syntax Highlighting for Sublime Text

This tool only applies to PeopleSoft Trace Files that have at a minimum the following trace parameters:

4044 Trace

To extract the call stack, open the .tracesql file (generated with the trace flags) in Sublime Text  and then run the “PeopleCode Tools: Extract PeopleCode Call Stack” command from the command palette:

Extract PeopleCode Call Stack - Run

The call stack of the trace file should then be extracted and formatted:

Extract PeopleCode Call Stack

I find this tool particularly useful when looking through large trace files and trying to understand where and in what context a particular line of code is invoked. For the most part, this tool works pretty well. I’ve been trying to fix bugs as I discover them. If you’ve installed the PeopleCodeTools plugin using Package Control, you should automatically receive these updates.

 

Here are some cross-browser bookmarklets I wrote that should allow you to navigate to a particular component irrespective of what environment you’re in:

PeopleCode Trace

SQL Trace

Roles

User Profile

Permission Lists

Process Monitor

To install, simply just drag the links onto your bookmarks/favourites bar.

To add your own, use the following as a template, replacing the <Menu>.<Component>.<Market> where appropriate:

javascript:var a=window.frames.location.pathname.match(/^\/ps[pc]\/(.+?\/)(.+?\/)(.+?\/)/),b=a[1];-1<b.indexOf(“_”)&&(b=b.substr(0,b.indexOf(“_”))+”/”);void window.open(“/psp/”+b+”_newwin/”+a[2]+a[3]+”c/UTILITIES.TRACE_SQL.GBL“,””,””);

I find them especially useful in the following situations:

  1. When you have to work with multiple environments and always need to go to these components
  2. When you don’t have access to the Navigation bar (e.g. when logged in using a certain role, or even when logged in to a different portal).

Although here are some important caveats:

  1. They only work once you have logged into your environment of choice.
  2. You need to have the appropriate security assigned to the logged in user before being able to navigate to these components.

Here’s a Sublime Text Cheat Sheet that I just created based on what I’ve seen from others and with a few plugins of my own. Some of the links may not work since they refer to my dropbox folder. Posting it here is really for my own benefit, but it may be of use to some of you too.

Command Palette

  • Open Palette: Ctrl+Shift+P (Tools > Command Palette…)

Selection (can Be Repeated Multiple Times)

  • Select line: Ctrl+L (Selection > Expand Selection to Line)
  • Select word: Ctrl+D (Selection > Expand Selection to Word)
  • Skip selection: Ctrl+K, Ctrl+D
  • Undo last selection: Ctrl+U
  • Select scope: Ctrl+Shift+Space (Selection > Expand Selection to Scope)
  • Select brackets: Ctrl+Shift+M (Selection > Expand Selection to Brackets)
  • Select indentation: Ctrl+Shift+J (Selection > Expand Selection to Indentation)
  • Select tag: Ctrl+Shift+A (Selection > Expand Selection to Tag)
  • Scroll to selection: Ctrl+K, Ctrl+C (Goto > Scroll > Scroll to Selection)

Editing

  • Insert line after: Ctrl+Enter
  • Insert line before: Ctrl+Shift+Enter
  • Repeat last keyboard command: Ctrl+Y (Edit > Repeat)
  • Transpose: Ctrl+T (Edit > Text > Transpose)
  • (Un)Comment current line: Ctrl+/ (Edit > Comment > Toggle Comment)
  • Block (un)comment current selection Ctrl+Shift+/ (Edit > Comment > Toggle Block Comment)
  • Paste and indent correctly: Ctrl+Shift+V (Edit > Paste and Indent)
  • Uppercase: Ctrl+K, Ctrl+U (Edit > Convert Case > Upper Case)
  • Lowercase: Ctrl+K, Ctrl+L (Edit > Convert Case > Lower Case)

Deleting

  • Delete word forwards: Ctrl+Del
  • Delete word backwards: Ctrl+Backspace
  • Delete line: Ctrl+Shift+K (Edit > Line > Delete)
  • Delete from cursor to end of line: Ctrl+K, Ctrl+K
  • Delete from cursor to start of line: Ctrl+K, Ctrl+Backspace

Find/replace

  • Find: Ctrl+F (Find > Find…)
  • Find Next: F3 (Find > Find Next)
  • Find Previous: Shift+F3 (Find > Find Previous)
  • Replace: Ctrl+H (Find > Replace…)
  • Find in files: Ctrl+Shift+F (Find > Find in Files…) (Navigate using F4, Shift+F4)

Goto Anything

  • Go to file: Ctrl+P (Goto > Goto Anything…)
  • Go to symbol: Ctrl+P, “@symbol” (Ctrl+R, Goto > Goto Symbol…)
  • Go to line number: Ctrl+P, “:#” for line (Ctrl+G, Goto > Goto Line…)
  • Go to word: Ctrl+P, “#word” (Ctrl+;)

Line Operations

  • Indent current line(s): Ctrl+] (Edit > Line > Indent)
  • Unindent current line(s): Ctrl+[ (Edit > Line > Unindent)
  • Move line/selection up: Ctrl+Shift+Up (Edit > Line > Swap Line Up)
  • Move line/selection down: Ctrl+Shift+Down (Edit > Line > Swap Line Down)
  • Duplicate lines: Ctrl+Shift+D (Edit > Line > Duplicate Line)
  • Join lines: Ctrl+J (Edit > Line > Join Lines)

Navigation

  • Jump to matching bracket: Ctrl+M (Goto > Jump to Matching Bracket)
  • Jump to your last change: Ctrl+U (Edit > Undo Selection > Undo) (repeat to undo change)

Bookmarks

  • Toggle bookmark: Ctrl+F2 (Goto > Bookmarks > Toggle Bookmark)
  • Next bookmark: F2 (Goto > Bookmarks > Next Bookmark)
  • Previous bookmark: Shift+F2 (Goto > Bookmarks > Previous Bookmark)
  • Select all bookmarks: Alt+F2 (Goto > Bookmarks > Select all Bookmarks)

Code Folding:

  • Fold: Ctrl+Shift+[ (Edit > Code Folding > Fold)
  • Unfold: Ctrl+Shift+] (Edit > Code Folding > Unfold)
  • Unfold all: Ctrl+K,Ctrl+J or Ctrl+K,Ctrl+0 (Edit > Code Folding > Unfold All)
  • Fold by level number Ctrl+K,Ctrl+# (Edit > Code Folding > Fold Level #)
  • Fold markup tag attributes: Ctrl+K,Ctrl+T (Edit > Code Folding > Fold Tag Attributes)

Macros

  • Record: Ctrl+Q (Tools > Record Macro)
  • Playback: Ctrl+Shift+Q (Tools > Playback Macro)

Tabs

  • Previous tab: Ctrl+PgUp (Goto > Switch File > Previous File)
  • Next tab: Ctrl+PgDown (Goto > Switch File > Next File)
  • Switch to tab number: Alt+number (Goto > Switch File > …)

Split Layout

  • Set single layout: Alt+Shift+1 (View > Layout > Single)
  • Set # columns: Alt+Shift+2,3,4 (View > Layout > Columns)
  • Set 2 or 3 rows: Alt+Shift+8,9 (View > Layout > Rows)
  • Set 2×2 grid: Alt+Shift+5 (View > Layout > Grid)
  • Move to group #: Ctrl+# (View > Focus Group)
  • Move file to group #: Ctrl+Shift+# (View > Move file to Group)

Organization

  • Toggle side bar: Ctrl+K, Ctrl+B (View > Side Bar > Hide Side Bar)
  • Distraction free: Shift+F11 (View > Enter Distraction Free Mode)
  • Enable spell-check: F6 (View > Spell Check) (Navigate using Ctrl+F6, Ctrl+Shift+F6)

Multiple Cursors

  • Press Ctrl then click in each region
  • Ctrl+Shift+L (Selection > Split into Lines)
  • Highlight word, press Ctrl+D (Selection > Expand Selection to Word) repeatedly to select additional occurrences of that word.
  • Add cursor at all occurrences of a word with Alt+F3 (Find > Quick Find All)
  • Add new line with cursor: Ctrl+Alt+Up, Ctrl+Alt+Down (Selection > Add Previous Line)
  • Return to single selection: Esc (Selection > Single Selection)
  • You can select a rectangular selection by using Shift, then holding the right mouse button and dragging over the area you wish to select. You can remove part of the selection using Shift+Alt.

Marking

  • Set mark: Ctrl+K, Ctrl+Space (Edit > Mark > Set Mark)
  • Select to mark: Ctrl+K, Ctrl+A (Edit > Mark > Select to Mark)
  • Delete to mark: Ctrl+K, Ctrl+W (Edit > Mark > Delete to Mark)
  • Switch location with mark: Ctrl+K, Ctrl+X (Edit > Mark > Swap with Mark)
  • Clear Mark: Ctrl+K, Ctrl+G (Edit > Mark > Clear Mark)

Projects

  • Switch Project: Ctrl+Alt+P (Project > Switch Project in Window…)
  • Select root folder: Project > Add Folder to Project…
  • Save: Project > Save Project As… (.sublime-project file)

Miscellaneous

  • Show scope in status bar: Ctrl+Alt+Shift+P
  • Re-indent Lines: Edit > Line > Reindent
  • Close Tag: Alt+.
  • Reopen Closed File: Ctrl+Shift+T (File > Open Recent… > Reopen Closed File)
  • See Key Bindings: Preferences > Key Bindings – Default
  • A list of all installed packages is in “%AppData%\Sublime Text 2\Packages\User\Package Control.sublime-settings” (see “installed_packages”)

My User Settings and Sublime Theme / Colour Scheme

Preferences > Settings – User :

Preferences > Key Bindings – User :

Snippets

JQuery-Snippets

Common JQuery snippets :

Packages I Use

AAAPackageDev

Used to convert JSON to PList for Syntax Highligher creation

  • I used this to create the PeopleCode syntax definitions

AdvancedNewFile

File Creation Plugin

  • Create New File: Ctrl+Alt+N

Preferences > Package Settings > AdvancedNewFile > Settings – User :

Automatic Backups

Automatically Save Off A Backup Of Your Files Each Time You Save A File.

  • Backwards in history: Ctrl+Alt+[
  • Forwards in history: Ctrl+Alt+]
  • Merge from backup history: Ctrl+Alt+Shift+M

Preferences > Package Settings > Automatic Backups > Settings – User :

BracketHighlighter

Bracket And Tag Highlighter.

Preferences > Package Settings > Bracket Highlighter > Settings – User :

BufferScroll

Remember, restore and sync scroll, bookmarks, marks, folds and cursors.

Clipboard History

Keep a history of your clipboard items.

  • Show History: Ctrl+Alt+V
  • Paste Previous History Entry: Ctrl+Shift+V
  • Paste Newer History Entry: Ctrl+Shift+Alt+V

CTags

CTags Support.

  • Find > CTags
  • Rebuild Tags: Ctrl+T, Ctrl+R
  • Navigate to Definition: Ctrl+T, Ctrl+T
  • Search for Definition: Ctrl+T, Ctrl+Y
  • Jump Back: Ctrl+T, Ctrl+B
  • Show Symbols: Alt+S (multi: Alt+Shift+S, language: Ctrl+Alt+Shift+S)

DocBlockr

Make Writing Documentation A Breeze. Supports Javascript, Php, Actionscript, Coffeescript, Java, Objective C, C And C++.

  • /**< Enter >
  • /* < Enter >
  • /**< Enter >function foobar (baz, quux) { } – where function (or variable definition) already exists. Shift-Enter will place the definition inline.
  • Decorate comment: // foo!< Ctrl+Enter >

Emmet

Emmet (previously Called Zen Coding).

  • Documentation
  • div#page.section -> <div id="page" class="section"></div>
  • div[title="Hello"] -> <div title="Hello"></div>
  • li.item$*3 -> <li class="item#"></li> (3 times)
  • p>{Click }+a{here}+{ to continue} -> <p>Click <a href="">here</a> to continue</p>
  • div#page>(div#header>ul#nav>li*4>a{Item $})+(div#page>(h1>span)+p*2)+div#footer -> quite complicated div structure

EncodingHelper

Encoding Helper provides the following features:

  • attempts to guess encoding of files
  • shows encoding on status bar
  • shows when the current document is maybe broken because was opened with an incorrect encoding
  • converts to UTF-8 from a variety of encodings organized in a menu.
  • converts to UTF-8 quickly from guessed encoding via an Edit menuitem
  • converts to UTF-8 automatically when opening a file via some defined encodings found on User preferences

Preferences > Settings – User :

ExportHtml

Export code to HTML for copying/printing/saving – great for copying code into Word documents

  • Ctrl+Shift+P, Export to HTML: Show Export Menu

FileDiffs

Shows Diffs Between The Current File, Or Selection(s) In The Current File, And Clipboard, Another File, Or Unsaved Changes.

  • For Araxis Merge:

Preferences > Package Settings > FileDiffs > Settings – Default :

FindKeyConflicts

Assist In Finding Key Conflicts Between Various Plugins.

  • Ctrl+Shift+P, FindKeyConflicts

Format SQL

For formatting SQL Statements * Ctrl+Shift+P Format SQL

Format XML

For formatting XML Files * requires xmllint * Select xml to format and then press Ctrl+Shift+X

  • xmllint Installation:
    • xmllint requires libxml, which requires iconv and zlib
    • Download libxml2, iconv and zlib from ftp://ftp.zlatkovic.com/libxml
    • Copy exes and dlls of libxml2, iconv and zlib to C:\Program Files (x86)\Tools
    • Add C:\Program Files (x86)\Tools\ to Path if not done already
    • Copy tidy_xml_lint directory from dropbox to Packages dir

GenerateUUID

Generate Uuid

  • Generate UUID: Ctrl+Shift+U

Git

Git Integration

  • Wiki
  • Install Git using “Run Git from the Windows Command Prompt”
  • Tools > Git

Hayaku

Allows you to quickly write CSS – the beauty is that it guesses what you want, but also has pre-programmed values

  • fl -> float: left * oh -> overflow: hidden

HexViewer

Allows The Toggling Of A File Into A Hex Viewing Mode

  • Tools > Packages > Hex Viewer
  • NOTE: Shortcuts conflict with “build”
  • Toggle hex editor mode: Ctrl+Shift+B, Ctrl+Shift+H
  • Show hex inspector: Ctrl+Shift+B, Ctrl+Shift+I

Preferences > Package Settings > Hex Viewer > Settings – User :

HighlightWords

Highlight mutiple words in different colors.

  • Highlight Words: Ctrl+Alt+H (Edit > Highlight Words > Highlight Words)
  • Unhighlight Words: Ctrl+Alt+U (Edit > Highlight Words > Unhighlight Words)

HTML5

HTML5 bundle.

INI

INI Syntax Highlighting.

JSFormat

Javascript formatter

  • Select ALL JavaScript to format and then press Ctrl+Shift+P, Format JavaScript

JSMinify

Javascript minifier using Google Closure

  • Minify Javascript: Ctrl+Alt+M, Markdown Preview
  • Minify Javascript to file: Ctrl+Alt+Shift+M

Markdown Preview

Preview Your Markdown Files Quickly In Your Web Browser.

  • Ctrl+Shift+P, Markdown Preview

NetTuts+ Fetch

  • Use “Fetch: Manage” to manage all the files/packages you can fetch. Has JQuery and HTML5 Boilerplate by default
  • Use “Fetch: File” to fetch the contents of the file
  • Use “Fetch: Package” to store a package (zip) at a specified location

Open URL

Open URLs, Files, Folders, Or Google Text Under The Cursor Or In Selected Text.

  • Open URL: Ctrl+U

Origami

Split the window however you like!

  • Ctrl+K then press the arrow keys with modifiers:
    • (no modifiers): travel to an adjacent pane
    • Shift: carry the current file to the destination
    • Alt: clone the current file to the destination
    • Ctrl: create an adjacent pane
    • Ctrl+Shift: destroy an adjacent pane

PowerShell

Support For The Ms PowerShell 2 Programming Language.

Prefixr

For cross-browser css prefixing * Ctrl+Alt+X

Pretty JSON

Prettify JSON.

  • Prettify: Ctrl+Shift+J

Preferences > Package Settings > Pretty JSON > Settings – User :

Preferences > Key Bindings – User :

SideBarEnhancements

Provides Enhancements To The Operations On Side Bar Of Files And Folders.

  • Open current file in browser: F12 (NOTE: doesn’t support IE)

Split Line

Breaks a line into multiple lines using comma as a delimiter

  • Requires manual installation in Packages folder

Sublime-HTMLPrettify

Html, Css And Javascript Code Formatter.

  • Requires Node.js
  • Prettify: Ctrl+Shift+P, htmlprettify

SublimeLinter

Highlights Lines Of Code The Linter Deems To Contain (potential) Errors.

  • CSS, JS requires Node.js
  • C++ requires cppcheck
  • Note that C++ filters can’t be modified
  • HTML requires tidy
    • Installation
      • Download tidy.zip from http://tidybatchfiles.info/
      • Extract the tidy.exe to your desired folder. eg. C:\Program Files (x86)\Tools
  • Lint: Ctrl+Alt+L
  • Next/Previous Error: Ctrl+Alt+E, Ctrl+Alt+Shift+E

Preferences > Package Settings > SublimeLinter > Settings – User :

Table Editor

Edit simple text tables in text mode.

  • Usage: Preferences > Package Settings > Table Editor > README
  • Demo: Ctrl+Shift+P, Table Editor: Show demo film in new scratch view

Tag

Collection Of Packages About Tags.

  • Edit > Tag
  • Put matching closing tag: Alt+.

Here’s a bookmarklet that allows me to debug any webpage using jQuery via the Chrome Developer Console:

Load jQuery

To install, simply just drag the above link onto your bookmarks/favourites bar.

Note: This bookmarklet will first prompt whether you want to overwrite any current version of jQuery that is already loaded on the page with the latest minified version of jQuery.

I was trying to use the jQuery load function in Chrome (on Windows) when I encountered the following error:

XMLHttpRequest cannot load file:///C:/Projects/test/about.html. Origin null is not allowed by Access-Control-Allow-Origin.

I discovered that I had to disable web security in chrome by closing ALL currently running instances of chrome and then running chrome with the – -disable-web-security parameter:

Chrome would then display the following warning header once it was loaded:
Chrome warning

Note: I would only recommend this option for development purposes. Please do not use this option for every day browsing.