Komodo-Ide-6 1 2
Komodo-Ide-6 1 2
Komodo-Ide-6 1 2
Table of Contents
Welcome to the Komodo User Guide................................................................................................................1
What's new in Komodo IDE....................................................................................................................1
Support and Community..........................................................................................................................2
Sample Project.........................................................................................................................................2
Feature Showcase.....................................................................................................................................2
Tutorials...................................................................................................................................................2
Starting Komodo...............................................................................................................................................12
Windows................................................................................................................................................12
Mac OS X..............................................................................................................................................12
Linux......................................................................................................................................................13
i
Komodo User Guide
Table of Contents
Komodo Installation Guide
Hardware Requirements...........................................................................................................17
Operating System Requirements..............................................................................................17
Installing the Komodo License on OS X.........................................................................................17
Upgrading from Previous Komodo Versions..................................................................................17
Installing Komodo on Mac OS X....................................................................................................17
Starting Komodo on OS X..............................................................................................................18
Uninstalling Komodo on OS X.......................................................................................................18
Linux......................................................................................................................................................18
Prerequisites....................................................................................................................................18
Hardware Requirements...........................................................................................................18
Operating System Requirements..............................................................................................18
Software Prerequisites on Linux...............................................................................................18
Adding Perl or Python to the PATH Environment Variable....................................................19
Installing the Komodo License on Linux........................................................................................19
Upgrading from Previous Komodo Versions..................................................................................19
Installing Komodo on Linux...........................................................................................................20
Starting Komodo on Linux..............................................................................................................20
Uninstalling Komodo on Linux.......................................................................................................21
Language and Debugging Prerequisites.................................................................................................21
Source Code Control Integration Prerequisites......................................................................................21
ii
Komodo User Guide
Table of Contents
Support and Feedback......................................................................................................................................33
Documentation.......................................................................................................................................33
ActiveState Community Site.................................................................................................................33
Mailing Lists..........................................................................................................................................33
Reporting Bugs......................................................................................................................................33
Feature Requests....................................................................................................................................34
ActiveState Technical Support..............................................................................................................34
Comments and Feedback.......................................................................................................................34
Projects...............................................................................................................................................................35
Projects Pane..........................................................................................................................................35
Open vs. Active Projects.................................................................................................................35
File and Folder Links......................................................................................................................35
Project Groups.................................................................................................................................36
Project Menus..................................................................................................................................36
Project Properties and Settings..............................................................................................................36
Toolboxes...........................................................................................................................................................38
Adding, Removing and Managing Tools...............................................................................................38
Special Folders - Abbreviations and Vi Commands..............................................................................39
Behind the Scenes - How Tools are Stored...........................................................................................39
Importing and Exporting Tools..............................................................................................................39
iii
Komodo User Guide
Table of Contents
Working with Files
Saving Files Remotely.....................................................................................................................48
Show Unsaved Changes..................................................................................................................48
Reverting Files.......................................................................................................................................48
Closing Files..........................................................................................................................................48
Editing................................................................................................................................................................55
Language Support..................................................................................................................................55
Syntax Coloring and Indentation.....................................................................................................55
Background Syntax Checking.........................................................................................................56
AutoComplete and CallTips............................................................................................................57
Perl AutoComplete and CallTips..............................................................................................57
Python AutoComplete and CallTips.........................................................................................58
Ruby AutoComplete and CallTips............................................................................................59
PHP AutoComplete and CallTips.............................................................................................59
Tcl AutoComplete and CallTips...............................................................................................60
XSLT AutoComplete................................................................................................................61
XML AutoComplete and CallTips...........................................................................................61
Soft Characters................................................................................................................................62
Viewing the Current File as Another Language..............................................................................62
Commenting Blocks of Code..........................................................................................................62
Manipulating Code................................................................................................................................63
Cutting and Copying Lines..............................................................................................................63
Selecting and Dragging Lines.........................................................................................................63
Automatically Repeating Keystrokes..............................................................................................63
Indenting and Un-indenting Lines of Code.....................................................................................63
Reflowing Paragraphs.....................................................................................................................64
Formatting Code Komodo IDE only...............................................................................................64
iv
Komodo User Guide
Table of Contents
Editing
Joining Lines...................................................................................................................................64
Converting between Uppercase and Lowercase..............................................................................64
Transposing Characters...................................................................................................................64
Literal Characters............................................................................................................................65
Commenting and Un-commenting Lines or Blocks of Code..........................................................65
Cleaning Line Endings....................................................................................................................65
Tabifying and Untabifying Regions................................................................................................65
Column / Rectangular Selection......................................................................................................66
Column Editing...............................................................................................................................67
Completing Words..........................................................................................................................67
Selecting Blocks of Code................................................................................................................67
Editor Display Characteristics...............................................................................................................68
Toggling Whitespace On and Off...................................................................................................68
Toggling Indentation Guides On and Off........................................................................................68
Toggling Line Numbers On and Off...............................................................................................68
Toggling EOL (end of line) Markers On and Off...........................................................................68
Increasing and Decreasing the Code Font Size...............................................................................68
Toggling Fixed and Non-Fixed Width Fonts..................................................................................69
Folding and Unfolding Code...........................................................................................................69
Navigating Within Files.........................................................................................................................70
Moving to a Specific Line...............................................................................................................70
Go to Definition...............................................................................................................................70
Setting and Moving to Bookmarks and Marks................................................................................70
Matching Braces..............................................................................................................................71
Detecting Changed Files........................................................................................................................71
Preview in Browser................................................................................................................................71
Editor Tab Display.................................................................................................................................72
Abbreviations....................................................................................................................................................73
Inserting Snippets..................................................................................................................................73
Abbreviation Search Order....................................................................................................................74
Adding New Abbreviations...................................................................................................................74
History................................................................................................................................................................75
Locations................................................................................................................................................75
History Navigation.................................................................................................................................75
Snippets..............................................................................................................................................................76
Creating Snippets...................................................................................................................................76
Configuring Snippets.............................................................................................................................76
Using Snippets.......................................................................................................................................77
Abbreviations..................................................................................................................................77
Snippet Options......................................................................................................................................77
Snippet Properties............................................................................................................................77
Assigning Custom Icons to Snippets........................................................................................77
Snippet Key Bindings...............................................................................................................78
v
Komodo User Guide
Table of Contents
Tabstops.............................................................................................................................................................79
Creating Tabstops..................................................................................................................................79
Using Tabstops......................................................................................................................................79
Examples................................................................................................................................................79
Macros................................................................................................................................................................81
Creating Macros.....................................................................................................................................81
Recording Macros...........................................................................................................................81
Writing Macros................................................................................................................................81
Running Macros.....................................................................................................................................82
Managing Macros..................................................................................................................................82
Macro Properties....................................................................................................................................82
Assigning Key Bindings to Macros.................................................................................................82
Assigning Custom Icons to Macros.................................................................................................83
Running Macros in the Background................................................................................................83
Specifying Macro Triggers..............................................................................................................83
Trigger Macro subject Variable................................................................................................84
Macro Return Values................................................................................................................84
Vi Command Mode Macros...................................................................................................................84
Macro API.........................................................................................................................................................85
The Komodo Macro API.......................................................................................................................85
Warning...........................................................................................................................................85
Feedback..........................................................................................................................................85
JavaScript Macros..................................................................................................................................85
ko.views.manager.currentView.scimoz...........................................................................................86
scimoz Attributes......................................................................................................................86
scimoz Methods........................................................................................................................87
scimoz Notes.............................................................................................................................90
ko.views.manager.currentView.koDoc...........................................................................................91
koDoc Attributes.......................................................................................................................91
ko.views.manager.currentView.koDoc.file.....................................................................................91
document.file attributes............................................................................................................91
ko.commands.doCommand()..........................................................................................................92
ko.open.URI()..................................................................................................................................92
ko.projects.findPart().......................................................................................................................92
ko.interpolate.interpolateString()....................................................................................................93
ko.interpolate.getWordUnderCursor()............................................................................................93
ko.run.runEncodedCommand().......................................................................................................93
Python Macros.......................................................................................................................................94
Creating a view object.....................................................................................................................94
Accessing the editor........................................................................................................................95
Opening a URI.................................................................................................................................95
Interpolate a string...........................................................................................................................95
Get word under cursor.....................................................................................................................95
Running a Komodo command.........................................................................................................95
Find a part........................................................................................................................................96
vi
Komodo User Guide
Table of Contents
Komodo Command Id List..............................................................................................................................97
Breakpoint Manager...............................................................................................................................97
Code Browser.........................................................................................................................................97
Code.......................................................................................................................................................97
Debugger................................................................................................................................................98
Document Outline..................................................................................................................................99
Editor.....................................................................................................................................................99
Fast Open.............................................................................................................................................105
Find......................................................................................................................................................105
General.................................................................................................................................................106
Help......................................................................................................................................................107
Macro...................................................................................................................................................108
Move up one directory.........................................................................................................................108
Open the Komodo Error Log for viewin..............................................................................................108
PDK.....................................................................................................................................................109
Places...................................................................................................................................................109
Projects/Toolbox..................................................................................................................................109
Publishing............................................................................................................................................110
Source Code Control............................................................................................................................110
Source Code.........................................................................................................................................110
Spell Check..........................................................................................................................................110
TDK Bug Databas................................................................................................................................110
TDK Communit...................................................................................................................................110
TDK Email List...................................................................................................................................111
TDK.....................................................................................................................................................111
Toolbox................................................................................................................................................111
Tools....................................................................................................................................................111
User Interface.......................................................................................................................................111
Replace in Place...................................................................................................................................112
Templates.........................................................................................................................................................113
Creating New Files from Templates....................................................................................................113
Creating Custom Templates.................................................................................................................113
Using Interpolation Shortcuts in Custom Templates....................................................................114
Project Templates.................................................................................................................................114
Storing Templates in a Toolbox...........................................................................................................114
Template Options..........................................................................................................................114
Assigning Custom Icons to Templates..........................................................................................115
Template Key Bindings.................................................................................................................115
URL Shortcuts.................................................................................................................................................116
URL Shortcut Options.........................................................................................................................116
URL Shortcut Properties...............................................................................................................116
Assigning Custom Icons to URL Shortcuts............................................................................116
URL Shortcut Key Bindings...................................................................................................117
vii
Komodo User Guide
Table of Contents
Run Commands...............................................................................................................................................118
Creating Run Commands.....................................................................................................................118
Simple Run Commands.................................................................................................................118
Advanced Run Commands............................................................................................................119
Command Output Tab...................................................................................................................119
Storing Run Commands in a Toolbox.................................................................................................120
Run Command Properties.............................................................................................................120
Assigning Custom Icons to Run Commands..........................................................................120
Run Command Key Bindings.................................................................................................121
viii
Komodo User Guide
Table of Contents
Debugging Programs Komodo IDE only
Setting Watched Variables............................................................................................................138
Output Tab.....................................................................................................................................138
HTML Preview Tab......................................................................................................................139
Viewing the Call Stack..................................................................................................................139
Watching Files.....................................................................................................................................139
Detaching the Debugger......................................................................................................................139
Stopping the Debugger........................................................................................................................140
ix
Komodo User Guide
Table of Contents
Debugging PHP Komodo IDE only
To initiate remote debugging using the DBGP Proxy:...........................................................158
To stop the debugger:.............................................................................................................158
Using xdebug_break()...................................................................................................................158
Xdebug Logging............................................................................................................................159
PHP Just-in-Time Debugging / Break on Exception.....................................................................159
Common PHP Debugging Problems...................................................................................................159
Debugging PHP on OS X..............................................................................................................159
Debugging PHP on 64-bit Linux...................................................................................................160
Zend Optimizer and Zend Studio Debugger.................................................................................160
Unit Testing.....................................................................................................................................................170
Creating and Editing Test Plans...........................................................................................................170
Supported Test Frameworks by Language....................................................................................170
Adding Libraries Required for Unit Testing.................................................................................170
Running a Test Plan.............................................................................................................................170
Importing Global Test Plans................................................................................................................171
x
Komodo User Guide
Table of Contents
Interactive Shell Komodo IDE only..............................................................................................................175
Stand-Alone Interactive Shell..............................................................................................................175
Debugging with an Interactive Shell....................................................................................................175
Using the Interactive Shell...................................................................................................................175
Setting Shell Preferences...............................................................................................................176
Starting the Interactive Shell.........................................................................................................176
Using Multiple Shells....................................................................................................................176
Using AutoComplete and CallTips...............................................................................................176
Customizing Colors and Fonts......................................................................................................177
Viewing Shell History...................................................................................................................177
Stopping a Shell Session...............................................................................................................177
Clearing the Shell Buffer...............................................................................................................177
Using the Python Interactive Shell......................................................................................................177
Debugging with the Python Shell..................................................................................................178
Using the Tcl Interactive Shell............................................................................................................178
Debugging with the Tcl Shell........................................................................................................178
Using the Perl Interactive Shell...........................................................................................................178
Debugging with the Perl Shell.......................................................................................................180
Using the Ruby Interactive Shell.........................................................................................................180
Debugging with the Ruby Shell....................................................................................................181
Code Intelligence.............................................................................................................................................182
Code Browser Komodo IDE only........................................................................................................182
Context Menu................................................................................................................................183
Sorting...........................................................................................................................................183
Locating Current Scope.................................................................................................................183
Filtering Symbols..........................................................................................................................183
Object Browser Komodo IDE only......................................................................................................184
xi
Komodo User Guide
Table of Contents
Source Code Control Komodo IDE only
Configuring Source Code Control Integration.....................................................................................191
Configuring CVS...........................................................................................................................191
Basic CVS Configuration.......................................................................................................191
CVS Over SSH.......................................................................................................................191
Configuring Subversion (SVN).....................................................................................................191
Basic SVN Configuration.......................................................................................................191
SVN Over SSH.......................................................................................................................191
Configuring Perforce (P4).............................................................................................................191
Basic Perforce Configuration..................................................................................................192
Configuring Preferences................................................................................................................192
Configuring SSH Support for CVS and Subversion............................................................................192
Installing and Configuring Putty on Windows..............................................................................192
Using CVS with Putty on Windows.......................................................................................194
Using Subversion with Putty on Windows.............................................................................195
Configuring CVS with Windows/Cygwin-SSH or Linux/SSH..............................................196
Configuring Subversion with SSH on Linux or Mac OS X...................................................196
xii
Komodo User Guide
Table of Contents
Regular Expressions Primer
Asterisk...................................................................................................................................210
Plus..........................................................................................................................................211
Number: '{N}'.........................................................................................................................211
Ranges: '{min, max}'..............................................................................................................211
Quantifier Summary...............................................................................................................212
Alternation.....................................................................................................................................212
Grouping with Parentheses............................................................................................................212
Character Classes..........................................................................................................................213
Negated Character Classes............................................................................................................214
Anchors: Matching at Specific Locations.....................................................................................215
Substitution: Searching and Replacing................................................................................................215
Modifiers..............................................................................................................................................216
Modifier Summary........................................................................................................................217
Python Regex Syntax...........................................................................................................................217
More Regex Resources........................................................................................................................217
Interpolation Shortcuts..................................................................................................................................223
Interpolation Code List........................................................................................................................223
Basic Interpolation Shortcut Syntax....................................................................................................224
Non-Bracketed Syntax..................................................................................................................224
Bracketed Syntax...........................................................................................................................224
Basic Interpolation Options.................................................................................................................225
%(date).................................................................................................................................................226
%(date) Syntax..............................................................................................................................226
%(date) Format Options................................................................................................................226
%(ask) and %(askpass)........................................................................................................................227
%(ask) and %(askpass) Syntax......................................................................................................227
%(ask) and %(askpass) Options....................................................................................................228
%(path).................................................................................................................................................228
xiii
Komodo User Guide
Table of Contents
Interpolation Shortcuts
%(path) Syntax..............................................................................................................................228
%(path) Options............................................................................................................................228
%(debugger).........................................................................................................................................229
%(debugger) Syntax......................................................................................................................229
%(debugger) Options....................................................................................................................229
%(pref).................................................................................................................................................229
%(pref) Syntax..............................................................................................................................229
Back-References..................................................................................................................................230
Back-Reference Syntax.................................................................................................................230
Preferences.......................................................................................................................................................231
Appearance Preferences.......................................................................................................................231
Code Intelligence Preferences..............................................................................................................231
Debugger Preferences Komodo IDE only...........................................................................................232
Debugger Connection Preferences................................................................................................233
Advanced Debugger Preferences..................................................................................................233
Editor Preferences................................................................................................................................233
Configuring Key Bindings............................................................................................................234
Configuring Indentation................................................................................................................236
Smart Editing.................................................................................................................................237
Configuring Word Completion...............................................................................................237
Configuring Word or Character Wrap....................................................................................237
Configuring Edge Lines..........................................................................................................237
Soft Characters........................................................................................................................238
Line Cut/Copy.........................................................................................................................238
Hyperlinks...............................................................................................................................238
Background Syntax Checking................................................................................................238
Configuring Folding...............................................................................................................238
Save Options..................................................................................................................................238
Environment.........................................................................................................................................239
Find......................................................................................................................................................239
File Associations..................................................................................................................................240
Fonts and Colors Preferences...............................................................................................................240
Fonts..............................................................................................................................................241
Colors............................................................................................................................................241
Common Syntax Coloring.............................................................................................................242
Language-Specific Coloring..........................................................................................................243
Code Formatters Komodo IDE only....................................................................................................243
HTTP Inspector Preferences Komodo IDE only.................................................................................243
Interactive Shell Preferences Komodo IDE only.................................................................................244
Internationalization Preferences...........................................................................................................244
Language Help Settings.......................................................................................................................245
Configuring Reference Locations.................................................................................................245
Using Language Help....................................................................................................................245
Language Configuration......................................................................................................................245
Configuring JavaScript..................................................................................................................245
Configuring Perl............................................................................................................................246
xiv
Komodo User Guide
Table of Contents
Preferences
Configuring PHP...........................................................................................................................246
Configuring Python.......................................................................................................................247
Configuring Ruby..........................................................................................................................247
Configuring Tcl.............................................................................................................................247
Tcl Syntax Checking...............................................................................................................248
Tcl Debugging........................................................................................................................248
Configuring HTML.......................................................................................................................249
Configuring XML Catalogs...........................................................................................................249
Mapped URIs.......................................................................................................................................249
New Files Preferences..........................................................................................................................250
Printing Preferences.............................................................................................................................250
Projects and Workspace Preferences...................................................................................................251
Servers Preferences..............................................................................................................................252
Shared Support Preferences.................................................................................................................252
Sharing .tip, .pcx and .pdx Files....................................................................................................253
Sharing Preferences.......................................................................................................................253
Source Code Control Preferences Komodo IDE only.........................................................................254
CVS Integration.............................................................................................................................254
Perforce Integration.......................................................................................................................254
Subversion Integration..................................................................................................................255
Web and Browser Preferences.............................................................................................................255
Windows Integration Preferences........................................................................................................255
Feature Showcase............................................................................................................................................259
Project and Workspace........................................................................................................................259
Editing..................................................................................................................................................259
Debugging............................................................................................................................................259
Search...................................................................................................................................................259
Tools....................................................................................................................................................259
xv
Komodo User Guide
Table of Contents
Perl Tutorial Komodo IDE only
Opening Files.......................................................................................................................................261
Open the Perl Tutorial Project.......................................................................................................261
Open the Perl Tutorial Files..........................................................................................................261
Overview of the Tutorial Files......................................................................................................261
Analyzing the Program........................................................................................................................261
Introduction...................................................................................................................................261
Setting Up the Program.................................................................................................................262
Line 1 - Shebang Line.............................................................................................................262
Lines 2 to 4 - External Modules..............................................................................................262
Writing the Output Header............................................................................................................262
Lines 6 to 7 - Open Files.........................................................................................................262
Lines 9 to 13 - Print the Header to the Output File.................................................................262
Setting Up Input Variables............................................................................................................262
Lines 15 to 16 - Assign Method Call to Scalar Variable........................................................262
Lines 18 to 19 - Method "getline"..........................................................................................262
Starting the Processing Loop.........................................................................................................263
Line 21 - "while" Loop...........................................................................................................263
Lines 22 to 25 - Extracting a Line of Input Data....................................................................263
Converting Characters with a Regular Expression........................................................................263
Lines 27 to 31 - "foreach".......................................................................................................263
Combining Field Reference and Field Data..................................................................................263
Lines 33 to 35 - hash slice......................................................................................................263
Writing Data to the Output File.....................................................................................................263
Lines 37 to 50 - Writing Data to the Output File....................................................................263
Closing the Program......................................................................................................................264
Line 51 - Closing the Processing Loop...................................................................................264
Lines 52 to 54 - Ending the Program......................................................................................264
Run the Program to Generate Output...................................................................................................264
Debugging the Program.......................................................................................................................264
More Perl Resources............................................................................................................................265
Documentation..............................................................................................................................265
Tutorials and Reference Sites........................................................................................................266
xvi
Komodo User Guide
Table of Contents
PHP Tutorial Komodo IDE only
Lines 10 to 18 - Comments.....................................................................................................268
Line 22 - Datafile....................................................................................................................268
GuestBook Class...........................................................................................................................268
Lines 25 to 28 - Class Declaration..........................................................................................268
GuestBook Function......................................................................................................................269
Lines 34 to 37 - GuestBook Function.....................................................................................269
Lines 40 to 44 - Check for Valid Form Entry.........................................................................269
Lines 45 to 46 - Check for Variable Value.............................................................................269
_getData Function.........................................................................................................................269
Lines 53 to 58 - _getData Function........................................................................................269
outputData Function......................................................................................................................270
Lines 64 to 66 - outputData Function.....................................................................................270
_createEntryHTML Function........................................................................................................270
Lines 72 to 77 - Retrieve Form Data......................................................................................270
Lines 80 to 83 - Validate Form Data......................................................................................270
Line 86 - Current Date and Time............................................................................................270
Lines 89 to 94 - Interpolate Form Data with HTML..............................................................270
_writeDataFile Function................................................................................................................271
Lines 100 to 106 - Open the Data File....................................................................................271
Lines 108 to 110 - Write to the Data Files..............................................................................271
Lines 111 to 113 - Close the Data File...................................................................................271
addGuestBookEntry Function.......................................................................................................271
Lines 120 to 125 - Call Functions for Writing Data...............................................................271
outputForm Function.....................................................................................................................271
Lines 127 to 142 - The Function for HTML Form.................................................................271
Closing Tags..................................................................................................................................271
Lines 148 to 151 - Closing Tags.............................................................................................271
Running the Program...........................................................................................................................272
Debugging the Program.......................................................................................................................272
More PHP Resources...........................................................................................................................274
Tutorials and Reference Sites........................................................................................................274
xvii
Komodo User Guide
Table of Contents
Python Tutorial Komodo IDE only
Initializing Global Objects............................................................................................................277
Line 93 - Initializing log.........................................................................................................277
Lines 98 to 111 - Mapping Language Comments...................................................................277
Defining a Private Method............................................................................................................278
Lines 116 to 123 - Expression Evaluation..............................................................................278
Preprocessing a File.......................................................................................................................278
Lines 129 to 140 - The preprocess Method Interface.............................................................278
Lines 145 to 156 - Identifying the File Type..........................................................................278
Lines 158 to 166 - Defining Patterns for Recognized Directives...........................................278
Lines 178 to 303 - Scanning the File to Generate Output......................................................278
Lines 311 to 349 - Interpreting Command Line Arguments..................................................279
Lines 351 to 352 - Running the Main Method........................................................................279
Analyzing contenttype.py..............................................................................................................279
Open contenttype.py......................................................................................................................279
Setting Up the contenttype.py Module..........................................................................................279
Lines 16 to 19 - Importing External Modules.........................................................................279
Getting Data from content.types...................................................................................................279
Lines 29 to 31 - Finding the Helper File (content.types)........................................................279
Lines 33 to 80 - Loading the Content Types from content.types...........................................280
Lines 85 to 118 - Determining a File's Content Type.............................................................280
Running the Program...........................................................................................................................280
Using a Run Command.................................................................................................................281
Using the Debugger.......................................................................................................................281
Debugging the Program.......................................................................................................................282
Explore Python with the Interactive Shell...........................................................................................284
More Python Resources.......................................................................................................................284
Tutorials and Reference Sites........................................................................................................285
Preprocessor Reference.................................................................................................................285
xviii
Komodo User Guide
Table of Contents
Ruby Tutorial Komodo IDE only
Line 90 to 98 - Deleting Entries..............................................................................................288
Line 100 to 102 - Listing Entries............................................................................................288
Line 104 to 133 - Saving to a File..........................................................................................289
Line 135 to 143 - Loading from a File....................................................................................289
Line 145 to 149 - Showing Help.............................................................................................289
Line 151 - Starting the Program.............................................................................................289
Line 153 to 180 - Handling Commands from the User..........................................................289
Running the Program...........................................................................................................................290
Debugging the Program.......................................................................................................................290
More Ruby Resources..........................................................................................................................291
Tutorials and Reference Sites........................................................................................................291
XSLT Tutorial.................................................................................................................................................306
XSLT Tutorial Overview.....................................................................................................................306
Before You Start............................................................................................................................306
XSLT Tutorial Scenario................................................................................................................306
Opening the Tutorial Project................................................................................................................306
Opening the XSLT Tutorial Files..................................................................................................306
Overview of the Tutorial Files......................................................................................................306
Analyzing the Program........................................................................................................................306
xix
Komodo User Guide
Table of Contents
XSLT Tutorial
XSLT Header................................................................................................................................307
Lines 1 to 3 - XML and XSLT Declarations..........................................................................307
HTML Header...............................................................................................................................307
Line 6 - XSLT "template".......................................................................................................307
Lines 7 to 11 - HTML Tags....................................................................................................307
Line 12 - XSLT apply-templates............................................................................................307
Lines 13 to 15 - HTML Tags..................................................................................................308
Format Email Header....................................................................................................................308
Lines 18 to 21 - Select HEADER content..............................................................................308
Lines 22 to 29 - call-template.................................................................................................308
Process Email................................................................................................................................308
Lines 33 to 34 - Process First Message...................................................................................308
Lines 36 to 39 - Process Email Body......................................................................................308
Format Email Addresses...............................................................................................................309
Lines 45 to 52 - Format Email Addresses...............................................................................309
Running the Program...........................................................................................................................309
Debugging the Program.......................................................................................................................309
More XSLT Resources........................................................................................................................310
Documentation..............................................................................................................................310
Tutorials and Reference Sites..............................................................................................................310
xx
Komodo User Guide
Table of Contents
Run Command Tutorial
Introduction...................................................................................................................................322
Parsing Output with a Regular Expression....................................................................................322
Using "Find in Files".....................................................................................................................324
Komodo FAQ..................................................................................................................................................326
Where is Komodo installed?................................................................................................................326
Where does Komodo keep settings data?............................................................................................327
Where does Komodo log output and errors?.......................................................................................327
Komodo doesn't start. Why?................................................................................................................327
"Acces Denied" during installation on Windows XP SP3...................................................................327
Why can't I see my Left or Right Pane................................................................................................328
I can't see my Bottom Pane..................................................................................................................328
I want to maximize the Editor Pane.....................................................................................................328
How do I know if I'm debugging?.......................................................................................................328
How do I know if I'm editing?.............................................................................................................328
How can I add command-line arguments to my program for debugging?..........................................328
Komodo crashes. What can I do?........................................................................................................329
Why is Komodo so big?.......................................................................................................................330
I already have Mozilla. Why do I need to have two versions?............................................................330
I'm having trouble debugging PHP. What do I do?.............................................................................330
How do I emulate sessions in PHP debugging?...................................................................................331
Why don't breakpoints work when I use the Psyco extension in Python?...........................................331
How do I configure Virtual Hosting on an Apache Web server?........................................................332
I moved my Komodo installation on Linux, and am now getting Perl debugging errors....................333
How do I prevent the dialog from displaying every time I start the debugger?..................................333
Why do I get a CGI security alert when debugging PHP?..................................................................333
When I click Check Configuration on the Start Page, Komodo reports that a language that is
installed on my system is not available. Why?...................................................................................333
My screen goes black for a second or two whenever I open files for which Komodo performs
background syntax checking. Why?...................................................................................................333
How can I run additional CVS commands from within Komodo?......................................................334
Why doesn't Ruby debugging work on my Linux x64 system?..........................................................334
xxi
Komodo User Guide
Table of Contents
Windows/Linux Key Bindings (Default)
Source Control...............................................................................................................................340
Tools..............................................................................................................................................340
User Interface................................................................................................................................340
Snippets.........................................................................................................................................341
Vi Key Bindings...............................................................................................................................................357
Vi Emulation........................................................................................................................................357
Custom Vi Commands..................................................................................................................358
Vi Scheme............................................................................................................................................358
Vi-specific key bindings................................................................................................................359
Code Browser................................................................................................................................360
Debugger.......................................................................................................................................360
Editor.............................................................................................................................................360
xxii
Komodo User Guide
Table of Contents
XML Catalogs.................................................................................................................................................363
Using an Existing XML Catalog.........................................................................................................363
Creating an XML Catalog....................................................................................................................363
XML Catalog Resources......................................................................................................................364
xxiii
Welcome to the Komodo User Guide
What's new in Komodo IDE
• Better Support for Django:
♦ better syntax highlighting and smarter indentation for templates
♦ syntax checking for templates
♦ automatic code completions for Django template tags and filters
♦ hyperlinks to easily jump to template file locations
♦ easier to open files with fast open supporting directory name matching
• Projects: By popular demand, file and directory references have been reintroduced. These can be
organized in Groups to keep things logical and tidy.
• Database Explorer: Lets you easily explore local and remote database installations, including
viewing and managing data. SQLite is supported in this release, with more databases coming soon.
Support for each database is implemented as a Komodo extension, so integration with other databases
can be easily added.
• Places: A new file manager has been added to Komodo's left pane. It provides a customized view of
your file system (local or remote) and easy file management operations such as file editing, drag/drop
copying, creation of new files and folders, and search.
• Publishing: Copy remote files to your local system to work on them, then push them back to the
remote system when you're done. Komodo keeps track of the synchronization details to avoid copying
files that haven't changed, as well as using advanced conflict detection to avoid overwriting changes
made by others.
• New Toolbox: The Komodo toolbox and project system are being rewritten. Individual toolbox items
(commands, macros, snippets, etc.) are saved in separate JSON files rather than as nodes in a
toolbox.kpf file. There is a new "Invoke Tool" command which allows you to easily search and then
execute specific tools. In future versions project-specific tools will appear in the Toolbox sidebar
instead of the Projects sidebar, which will eventually be removed.
• Faster: A number of Komodo components have been made to run faster, such as startup, shutdown,
tab-switching and finding text. The underlying Mozilla source code has been updated to version 1.9.1,
the same code base as Firefox 3.5, which means improved performance gains for Komodo.
• Workspace Save and Restore: Komodo will now be regularly saving your workspace. In the case of
an unexpected shutdown, you can choose to restore your last used workspace the next time it starts
up.
• Hyperlink Additions: Hyperlinks have been extended and can now...
♦ show image preview while hovering on an image link,
♦ show Code Intelligence definitions while hovering on a symbol,
♦ jump to an HTML anchor tag to it's definition,
♦ jump to HREF and SRC locations,
♦ open files from a path reference,
♦ jump to PHP file includes
• Rx Toolkit Improvements: Choose between Python, Perl, PHP, Ruby, and JavaScript syntax for
testing your Regular Expressions. They are now evaluated "out of process", so a long-running regular
expression won't tie up the IDE.
• HTML 5 and CSS3 Support: Autocomplete for HTML 5 and CSS3.
• More Languages: Syntax highlighting for Markdown, MySQL, and others.
• Komodo FAQs
• Komodo Forums
Sample Project
Get started fast with Komodo's Sample Project.
Feature Showcase
Quick Demos showing advanced search functionality, editing, debugging, and more.
Tutorials
Helpful introductions to Ruby on Rails, Ruby, PHP, Perl, Python, XSLT and Run Commands.
• Database Explorer: when editing a row, show scroll bars if there are too many columns to fit on the
screen. (Bug 90087)
• Debugging: Ruby: correctly encode attribute values that contain special characters. (Bug 90564)
• Project Templates: improve compatibility with v5 extensions and macros. (Bug 89750)
• Django: trigger syntax checking when the Python interpreter changes. (Bug 89573)
Known Issues
To view the status of outstanding Komodo issues, including those that have been fixed in this release, or to
add comments or additional issues, please visit the Komodo Bug Database.
Startup
• The first time Komodo is run after installation, it must register a number of components with the
operating system. This causes the first launch to be considerably slower than subsequent launches.
Editing
• Tabstop syntax has changed in Komodo 5.0. Abbreviation from the Toolbox|Samples directory of
pre-5.0 versions of Komodo will not work as expected with the current implementation. Delete the
older versions to use the ones featured in the "Samples (5.0.0)" directory. Alternatively, if you have
made modifications to these snippets or have implemented your own using tabstops linked by name,
consult the documentation and revise them using numbered linking.
• By design, Komodo does not attempt Replace in Files operations on unknown file types. However,
file association preferences can be used to associate a user-defined extension with a language category
Debugging
• PHP: The xdebug.remote_autostart option will interfere with local debugging configuration
in Komodo if it is enabled. If you need this option enabled for remote debugging, set the Path to
alternate PHP configuration file under Preferences|Languages|PHP to point to a copy of php.ini
without this option.
• PHP: A non-empty doc_root setting in php.ini causes a 'No input file specified' error when starting
a local debugging session with CGI emulation. The Web Developer Suite 2.0 package and others use
this setting, and it is copied into the debugging version of php.ini during PHP auto-config. Comment
this setting out in the file specified in 'Preferences|Languages|PHP|Path to alternate PHP configuration
file' to avoid this problem.
• Python: Breakpoints will not work with the Psyco extension enabled. The Komodo FAQ has a
work-around solution.
• Tcl 8.5: Tcl Beta releases contain only version-specific executables (e.g. tclsh85.exe and
wish85.exe). Komodo does not automatically find these in the path. To use them, specify the
executables manually in Edit|Preferences...|Languages|Tcl|Interpreters, or create non-versioned
symlinks/shortcuts to the versioned executables.
• The Perl debugger uses alarm() internally. This can conflict with some Perl frameworks and
modules (such as POE) which use alarm() as well. To work around this problem, add alarm=0 to
the PERLDB_OPTS environment variable (in the Environment tab of the Debugger Options) which
Editing 6
Komodo User Guide
stops the debugger from using alarm(). With this work-around in place, the Break Now button and
menu item will not work in debugging sessions.
• Using the JavaScript debugger on files with mapped URIs can yield confusing results. Komodo will
open the mapped source file rather than querying Firefox for the runtime JavaScript.
• Python debugging with IronPython does not currently work as there is no support for Python
debugging hooks in IronPython.
• In PerlApp executables, it is now possible to step into loaded modules, but not to set breakpoints in
them.
• The Komodo JavaScript Debugger is incompatible with the FireBug Firefox extension. FireBug must
be manually disabled (Tools|Firebug|Disable Firebug) for the JavaScript debugger to work. (Bug
47208)
• PHP 5.0.0, 5.0.1 and 5.0.2 do not work with the debugger extension. Use PHP versions 4.3.10 or
greater, or 5.0.3 or greater, including 5.1.
• If the debug listener (Debug|Listen for Debugger Connections) is off, multithreaded applications
may not run or debug as expected. Only the main thread operates through the debugger. To debug
multithreaded applications, turn on debug listening prior to debugging. (Debug listening is turned on
by default.) (Bug 32776)
• PHP configurations that use Zend Extensions (such as PHP Accelerator) are not compatible with the
Komodo PHP debugger. (Bug 21890)
• Due to the way the core Perl interpreter works, it is not possible to step over "require" statements.
(Bug 18776)
• You cannot debug 'freestanding' executables created with the PDK in Komodo. Instead, build a
'dependant' executable, which requires a local install of ActivePerl.
• The variable watcher does not work when debugging
\\machine\d$\path\to\perl_script.pl. It does work when opening the same file via a
UNC path that does not include a '$' character. (Bug 19558)
• When debugging remote applications, Komodo fails if the remote process does not have valid stdout
and stderr handles. GUI applications, such as those started with "wperl.exe" or "pythonw.exe", or
those using the Pythonwin or wxPython frameworks, or those with certain embedded applications,
can have invalid stdout and stderr handles. Until we resolve this issue, try to run and debug your
remote program under perl.exe or python.exe.
• Python, XSLT and PHP debugging require TCP/IP to be installed and properly configured, even if
you are debugging scripts locally. While TCP/IP is configured by default on most systems, early
versions of Windows may require manual TCP/IP configuration.
• When debugging a GUI script in Komodo, adding a "watched variable" when not stopped at a
breakpoint can cause Komodo to hang. You must manually terminate the script being debugged to
stop Komodo from hanging. The problem occurs because the GUI script, while in its message loop,
does not respond to Komodo's request for the variable value. (Bug 23516)
• If the Komodo debugger is configured to use a specific port, when Komodo is shut down, the port is
sometimes not immediately released. If Komodo is restarted before the port is released by the
operating system, a message is displayed advising that the system is unable to bind that port. As a
workaround, we suggest configuring port 0 as the Komodo debugging port and using the debugger
proxy for remote debugging. (Bug 32821)
• Breaking into a running Perl script can only occur while crossing sub boundaries in the Perl code, as
that's currently the only chance the Perl debugger has to check to see if the IDE has sent the break
command. (Bug 35611)
• When debugging Perl, if you set a breakpoint on the while statement, the debugger stops on the
breakpoint only once, namely before the first pass through the loop. This is a limitation in the Perl
interpreter. (Bug 34866)
• Komodo debugger uses TCP/IP networking for communications. On systems with firewalls installed,
the debugger may fail if the firewall is not configured to allow Komodo to listen for connections. On
Debugging 7
Komodo User Guide
Windows, you may see a "Windows Security Alert" dialog asking if you want to allow Komodo to
listen for connections, you will need to unblock Komodo. (Bug 21684)
• The Perl debugger cannot trap fatal runtime errors. Users can accomplish this in their code by
wrapping problematic code in an eval block, and then testing for an exception. (Bug 33855)
• Komodo does not provide proper source debugging in Python exec and eval statements. This is a
limitation of Python's interpreter. (Bug 40336)
• When debugging PHP on a remote Linux machine from a local Windows machine, the debugging
option "Try to find files on the local system when remote debugging" has no effect. This is due to
differences in Unix and Win32 file paths. (Bug 39137)
• When debugging Python, Komodo does not permit you to set local variables in the interactive shell.
However, you can edit those values from the program's variable viewers, such as the Watch and
Locals panes on the Debug tab. (Bug 36794)
• When debugging PHP scripts on Komodo with CGI emulation, you may need to change the setting
for cgi.force_redirect in the php.ini file. You may also need to set an environment variable in
the Debugger Options dialog box: "REDIRECT_STATUS=200 OK". These settings vary depending
on your system and the configuration of PHP. (Bug 35021)
• When Debugging PHP, the HTML pane of the Output tab does not refresh automatically. To refresh
the contents of this pane, click the "Reload HTML view" button on the Output tab. (Bug 36999)
• Komodo supports full Unicode debugging with Perl 5.8. Although Perl 5.6 can be used for debugging
programs with single-byte encodings (e.g. cp1251), it is recommended that programmers with
multi-byte character sets upgrade to Perl 5.8.5 or better. (Bug 36760)
• When debugging Python, if you launch the debugger from a directory containing a module with the
same name as one of the modules used by the debugger, the wrong file is used. For example, if you
have a file named logging.py in the directory where the debugger is launched, the debugger will fail.
(Bug 36783)
• When stepping through Perl files, the Komodo debugger displays the wrong print results in the Locals
window of the Debug tab. This is because Perl provides only one iterator for each collection variable.
The Komodo debugger must iterate through a hash or an array in order to display the values in
Komodo. A workaround is to display the Watch pane instead of the Locals pane, and type the names
of the expressions that you want to view. (Bug 33668)
• As of Komodo 5.0, the Perl debugger emits numeric hash keys with embedded underscores. For
example, a hash key of '123456789' now appears in the variables tabs as '123_456_789'.
• Breakpoints don't work in files with symlinks in their path. The debugger engine calculates whether to
break based on the actual file path. To work around this limitation, load the file in Komodo using the
real path, or create a hard link (e.g. on Linux, use 'ln' without the '-s' option). (Bug 79147)
Interactive Shell
• The interactive shell does not initialize properly when invoked while the Command Output tab has
focus. To avoid this, switch focus to another tab or sidebar before starting the interactive shell.
• Perl: Only pattern variables $1 .. $9 are preserved across each query. (Bug 34528)
• Python: The getpass package requires the use of a tty on UNIX systems. Komodo does not provide a
tty in its interactive shell so getpass will fail with an exception. (Bug 34259)
Interactive Shell 8
Komodo User Guide
cvsnt.org executable, which are used by both WinCVS and TortoiseCVS. (Bug 21085)
• Komodo's integration with the Perforce commit/submit command cannot commit files that are not in
the default changelist. These files must be submitted via an external interface (e.g. p4, P4Win). Note
that any files checked out inside Komodo are in the default changelist, so this limitation should only
apply to users who already use an external interface to their Perforce repository. (Bug 27070)
• If the Perforce connection cannot be established, checking the status of files in a Perforce repository
will hang Komodo. (Bug 35058)
• If you are using CVS Source Code Control, note that the very first time you log in to a repository,
cvs.exe fails to create the .cvspass file correctly and will return an error. Repeat the command to login
a second time and correctly generate the file. This is a CVS bug. (Bug 20353)
Mac OS X
• If you have two drives with the same name, and you use the file open dialog in a Mozilla application,
the directory menu (top middle of dialog) may crash when clicked. To avoid this, rename one of the
hard drives.
• New Custom Menus created in a Project or in the Toolbox will not appear until Komodo has been
restarted.
• Throughout the Komodo documentation there are references to key bindings that use the 'Cmd' key.
This key may be better known to OS X users as the 'Command' key. (Bug 41959)
• Komodo will shut down and restart itself the first time it is run after installation. (Bug 40143)
• Display of text during editing ("painting") may sometimes be slow or pause momentarily.
• Certain UI elements stop working after changing key bindings. Restarting Komodo fixes this. (Bug
38683)
• When saving a file, Komodo does not set file information (type and creator) for the OS X Finder to
know that Komodo created the file. (Bug 38745)
• Breakpoints cannot be removed when debugging XSLT scripts. (Bug 40072)
• PHP debugging will not work with the PHP build distributed with OS X because it does not load
external modules. To use PHP debugging on OS X, build PHP from source or download a binary
from http://www.entropy.ch/software/macosx/php
(Bug 39901)
• Komodo is sometimes recognized as a web browser by some applications on OS X (e.g. Safari's
"Default Web Browser" setting). Using Komodo as the default web browser is not recommended.
• Application menu items that have multi-key key bindings will not show their key bindings in a pop-up
tool tip on OS X. This is a limitation in OS X.
• Context menus may not display unless you hold down the mouse button for a period of time. This is
because the Komodo editor is implemented in Mozilla as a plugin, and it does not access the
appropriate context menu event to handle this behavior properly without interfering with other mouse
events (for example, drag and drop). (Bug 41216)
• Due to a limitation in the Mozilla code base, key bindings for the Next File and Previous File options
on the Window menu are not displayed next to the menu items. The key bindings are
'Cmd'+'PageDown' to view the next file and 'Cmd'+'PageUp' to view the previous file. (Bug 40716)
Linux
• The Fonts and Colors pane in the Preferences dialog box displays the same list of fonts in both the
Fixed and Proportional lists. There is no programmatic way to identify whether a font is proportional
or not on GTK; therefore, users must know the properties of the individual fonts when modifying
these values. (Bug 27206)
Other
• A limitation in the parser used by the DOM Viewer causes HTML elements embedded in JavaScript
strings to appear as element nodes of the current document. Placing the JavaScript in a CDATA
section or a comment avoids this problem.
• Komodo inherits a Mozilla bug whereby certain video drivers on Windows cause Komodo to crash. If
you experience this behavior, upgrade your video driver to the latest version. If the problem persists,
reduce the color definition assigned to the driver (Control Panel|Display|Settings). (Bug 32746)
• Komodo inherits a Mozilla bug regarding display on dual-monitor systems where the secondary
monitor is to the left of the primary monitor (causing negative coordinate results). The Komodo
display occasionally fails to refresh; Komodo must be stopped and restarted to fix the display (Bug
26852)
• When using Komodo's Preview in Browser feature, users running Mozilla on Windows XP Pro,
Windows 2000 Pro and Windows 98 may find that they cannot exit Komodo if Mozilla is still open. If
this should occur, close all open browser windows before exiting Komodo. (Bug 26431)
• The Palm Desktop for Windows software makes exclusive use of the 'Ctrl'+'Shift'+'T' key
combination, thus making this combination unavailable in Komodo. (Bug 27851)
• When using the PDK Build Standalone Application feature in Komodo with Perl 5.8.0 on a Linux
installation where the environment is set to use UTF-8, you must add a module 'utf8' on the modules
tab. This is the equivalent of 'perlapp --add utf8'. This does not affect Perl 5.6.x or future versions of
Perl 5.8.1 or higher. (Bug 26898)
• On Windows NT, some interactive commands may not work properly when run from the Command
Output tab of the Output Pane. You must run these commands in a separate shell. (Bug 23176)
• Perforce client version 2001.1 and previous for Windows is known to hang when used for Komodo's
Perforce integration. Upgrading to the most recent version of Perforce is known to fix the problem.
(Bug 19959)
• The Output tab cuts off lines at 250 characters. (Bug 20711)
• Macros will not record certain commands, including (but possibly not limited to)
'Ctrl'+'Shift'+'B'|'R'|'E'|'D' (toggle toolbars or button text), 'Ctrl'+'Shift'+'N' (new default file), and
View as Language menu items.
• If you are using the Pop-Up Stopper ad-blocking program (Pop-Up Zapper on OS X), it will close the
Linux 10
Komodo User Guide
Rx Toolkit window immediately after it is opened. (Bug 21768)
• When you schedule a new file to be added using CVS, CVS will not permit you to remove the file
from the repository using the "revert changes" command. (Bug 27192)
• Users of the Japanese version of Windows XP may experience difficulties in starting Komodo.
• The Open field in the Open/Find Toolbar does not automatically display a drop-down list of
directories when an UNC path is typed. Currently, the list is only displayed when a the path includes a
subdirectory. (Bug 29011)
• When creating a "diff" in Komodo (Tools|Compare Files), the line endings of the files are
normalized to Unix style line endings. Lines in files that have different line endings are not displayed
differently in the diff (unless other differences are present), but a warning is provided to the user in
the 'diff' window, or the 'no difference' dialog. (Bug 32932)
• In Komodo's Rx Toolkit, the match offsets for Unicode or high-bit data are incorrect. When matching,
the program does not account for UTF-8 multi-byte characters. (Bug 33287)
• When adding new key bindings via the Preferences dialog box, Komodo displays a message
indicating that the key bindings will not take effect until Komodo is restarted. However, some
changes do take effect immediately.(Bug 36710)
• If you rename a folder that was added to a custom menu, the name is changed in Komodo's Toolbox
but not on the menu itself. A workaround is to move the renamed folder out and then back into the
associated custom menu icon in the Toolbox. (Bug 36679)
• A newly created custom menu is added to the Toolbox but is not immediately displayed alongside
existing toolbars. Restarting Komodo causes the new toolbar to display. (Bug 40078)
Other 11
Starting Komodo
Windows
From within the Windows environment, use one of the following methods to launch Komodo:
Multiple filenames may be specified; all specified filenames will be loaded in the Komodo editor pane.
• Help: -h or --help
• Show Komodo version: -V or --version
• Open at a specified line number: -l line or --line=line
• Open with a specified range selected: -s range or --selection=range
(e.g. komodo -s 1,5-2,15 example.py would open example.py and select from line 1
and column 5 to line 2 column 15)
Mac OS X
From within the OS X environment, use one of the following methods to launch Komodo:
If you want to start to Komodo from the command line, it is best to first create an alias for 'komodo':
Starting Komodo 12
Komodo User Guide
komodo [options] [filenames]
All command line options described in the Windows section are available.
Linux
To start Komodo from a shell prompt, enter:
All command line options described in the Windows section are available.
Desktop icons and taskbar applets are not added automatically during installation on Linux. Check your
window manager documentation for information on creating these manually. A choice of Komodo icons is
available. By default, the icon files (.xpm) are stored in the Komodo installation directory.
Mac OS X 13
Komodo Installation Guide
• Windows
♦ Prerequisites
♦ Installing the Komodo License
♦ Upgrading from a Previous Komodo Version
♦ Installing Komodo on Windows
♦ Command Line Installation Options
♦ Starting Komodo on Windows
♦ Uninstalling Komodo on Windows
• Mac OS X
♦ Prerequisites
♦ Installing the Komodo License
♦ Upgrading from a Previous Komodo Version
♦ Installing Komodo on OS X
♦ Starting Komodo on OS X
♦ Uninstalling Komodo on OS X
• Linux
♦ Prerequisites
♦ Installing the Komodo License
♦ Upgrading from a Previous Komodo Version
♦ Installing Komodo on Linux
♦ Starting Komodo on Linux
♦ Uninstalling Komodo on Linux
• Language and Debugging Prerequisites
• Source Code Control Integration Prerequisites
Windows
Prerequisites
Hardware Requirements
The following platforms are officially supported. Current Critical Updates, Windows Updates, and Service
Packs must be installed (see http://windowsupdate.microsoft.com).
• Windows 7
• Windows Vista
• Windows XP
• Windows Server 2003
To install on Windows XP, you may need to upgrade your version of Windows Installer.
Miscellaneous Prerequisites:
• Perl Dev Kit: In order to build executable programs, ActiveX controls and Windows services in Perl,
you must have ActiveState's Perl Dev Kit version 3.1 or greater installed on your system.
For minor releases (e.g. 4.1 to 4.2) and patch-level releases (4.1.1 to 4.1.2), use the auto-update system
(Help|Check for Updates). The changes will be applied safely in the current install directory. If you need to
update using an installer, completely uninstall the older version before installing the new one, or manually
specify a different install directory during the installation process. Your Komodo preferences will be
preserved as they are installed in a different directory.
• If you intend to run the installation from a shared network drive, your system must have SYSTEM
rights (or greater) to the directory from which the installation is run. Alternatively, run the installation
from a local drive.
When installation is complete, you will see an ActiveState Komodo icon on your desktop.
Komodo's installer uses Windows Installer technology, which allows you to partially control the install from
the command line. For example:
You can have the Komodo installer run with a reduced user interface. For example, the following will install
silently and only open a dialog when the installation is complete.
Turning on Logging
You can generate a log of the Komodo installation with the following command:
Command line options can be used to configure Komodo installation properties. The following will install
Komodo to "E:\myapps\Komodo", instead of the default location:
Komodo is divided into a number of distinct features. In the "Customize Setup" dialog you can select which
features to install. You can also do this on the command line with the ADDLOCAL property. For example,
the following command will install just the core Komodo functionality (i.e. not the PyWin32 extensions or the
documentation.
The hierarchy denotes dependencies (i.e. to install quicklaunch you must install the env.
The register option puts the Komodo location in the registry so 'start komodo' works, and adds bindings for
.kpz and .kpf Komodo project files.
Alternatively, use the Add/Remove Programs menu (accessible from the Windows Control Panel).
Mac OS X
Prerequisites
Hardware Requirements
• Intel processor
• 1 GB RAM
• 200 MB hard disk space
• 340 MB of temporary hard disk space during installation
For minor releases (e.g. 4.1 to 4.2) and patch-level releases (4.1.1 to 4.1.2), use the auto-update system
(Help|Check for Updates). The changes will be applied safely in the current install directory. If you need to
update using an installer, completely uninstall the older version or rename the .app before installing the new
one. Your Komodo preferences will be preserved as they are installed in a different directory.
• Open a new Finder window. Drag the Komodo icon from the mounted folder to the Applications
folder.
• If desired, drag the Komodo icon into the Dock.
Starting Komodo on OS X
Click the Komodo icon in the Dock or the Applications folder.
Uninstalling Komodo on OS X
Drag the Komodo icon into the Trash.
Linux
Prerequisites
Hardware Requirements
Komodo can also be run on the following platforms. This version of Komodo has not necessarily been tested
on these platforms; platform-specific bugs may or may not be fixed.
Installation Prerequisites:
• glibc 2.4 (or higher) and libjpeg.so.62 (or higher): These libraries are included in standard Linux
distributions.
• libstdc++6 (or higher)
• GTK+ 2.10 (or higher)
To add Perl or Python to the PATH environment variable, do one of the following:
• Modify your PATH environment variable. For example, if you use the Bash shell, add the following
line to your ~/.bashrc file:
export PATH=<installdir>/bin:$PATH
...where <installdir> points to the directory where you installed ActivePerl or ActivePython.
• Create a symbolic link to the Perl or Python executable. For example, for ActivePerl, enter:
ln -s <installdir>/bin/perl /usr/local/bin/perl
ln -s <installdir>/bin/python /usr/local/bin/python
...where <installdir> points to the directory where you installed ActivePerl or ActivePython.
For minor releases (e.g. 4.1 to 4.2) and patch-level releases (4.1.1 to 4.1.2), use the auto-update system
(Help|Check for Updates). The changes will be applied safely in the current install directory. If you need to
update using an installer, completely uninstall the older version before installing the new one, or manually
specify a different install directory during the installation process. Your Komodo preferences will be
preserved as they are installed in a different directory.
cd Komodo-<version>-<platform>
4. Run the install script ("install.sh"):
./install.sh
5. Answer the installer prompts:
6. ♦ Specify where you want Komodo installed, or press 'Enter' to accept the default location
(/home/<username>/Komodo-<IDE|Edit>-x.y).The -I option can be used to
specify the install directory. For example:
./install.sh -I ~/opt/Komodo-IDE-4.2
If multiple users are sharing the system and will be using the same installation, install
Komodo in a location every user can access (e.g. /opt/Komodo-x.x/ or
/usr/local/Komodo-x.x/).
Note:
7. Once the installer has finished, add Komodo to your PATH with one of the following:
♦ Add Komodo/bin to your PATH directly:
export PATH=<installdir>/bin:$PATH
♦ Add a symlink to Komodo/bin/komodo from another directory in your PATH:
ln -s <installdir>/bin/komodo /usr/local/bin/komodo
Note: Creating symlinks in system directories such as /usr/bin requires root access.
After completing the installation, you can delete the temporary directory where the Komodo tarball was
unpacked.
To start Komodo on Linux enter `komodo` at the command line or create a shortcut on your desktop or in
your toolbar using the full path to the komodo executable.
Note: You cannot relocate an existing Komodo installation to a new directory by simply moving it. You must
uninstall Komodo from the existing location and reinstall it in the new location.
The debugging libraries for all languages are bundled with Komodo IDE, but they are also available for
download from the Komodo Bits page.
• Perforce Source Control Integration: Requires a connection to a Perforce server with version 99.1
or later.
• Subversion Source Code Control Integration: Requires the svn command line client, available
from http://subversion.tigris.org/. Komodo cannot use the TortoiseSVN client as its SVN executable.
Sections of the page can be hidden by clicking the arrow icons next to the section title. Other start page
preferences can be set under Edit|Preferences|Appearance.
The Recent Projects and Files section shows the full path to to the projects and files, and the time they were
last modified.
Menus
The default drop-down menus are: File, Edit, Code, Navigation View, Debug, Project, Tools, and Help.
The functions accessed from each menu are described in detail in the relevant section of the User Guide. For
example, the items accessed from the Debug menu are described in Debugging Programs.
Context Menus
Komodo displays right-click context menus with options relative to the area of Komodo where the option was
invoked, depending the location of the mouse pointer. Use the left mouse button to select items from context
menus.
• Menu Bar Areas and Toolbar Areas: Options to view or hide individual toolbars and toolbar text
(unavailable on Mac OS X).
• Projects Sidebar (Project Name): Options to open, save, activate, and close the projects, and to add
a file to the selected project.
• Projects Sidebar (File Name): Options to edit, remove or export the selected file ,and access to
source code control commands.
• Toolbox Sidebar: Options to work with the specified component.
• Editor Pane (File Editing Area): Options to cut, copy, and paste text, to set a breakpoint, and to edit
the file properties and settings.
• Editor Pane (Tabs): Options to close the selected file and to view the file's properties and settings.
• Bottom Pane: The context menus available on tabs in the Bottom Pane (e.g. the Debug tab and the
Breakpoints tab) contain subsets of Komodo's top-level menus.
Toolbars
To hide or show toolbars, or to hide or show button text, do one of the following:
Menus 24
Komodo User Guide
• From the Edit menu, select Preferences. (On Mac OS X, from the Komodo menu, select
Preferences.) Then, click the Appearance option and select or clear the desired options.
The Standard Toolbar provides quick access to common editing functions. Launch the Komodo User Guide
by clicking the Help button.
The Tools Toolbar contains the commonly used commands on the Tools menu, including Preview in Browser,
the Regular Expression Toolkit, and the the interactive shell.
The Debug Toolbar provides quick access to common debugging functions, such as Step In and Step Over.
For more information about debugging programs, see Debugging Programs.
The Source Code Control Toolbar (Komodo IDE only) makes it easy to work with files that are stored in
Perforce or CVS. For more about using the Source Code Control Toolbar, see Source Code Control.
For users of PDK 6.0 and later, the PDK Toolbar provides quick access to Perl Dev Kit tools. Buttons for
launching the core PDK tools (PerlApp, PerlSvc, PerlCtrl, and PerlTray) are grayed out unless a Perl file is
the active file in the Editor Pane. Availability of buttons depends on which features are included in your PDK
version. If the PDK is not installed on your system, all toolbar options are grayed out when the PDK Toolbar
is displayed. For more information on how the PDK integates with Komodo, see Komodo and the Perl Dev
Kit.
Toolbars 25
Komodo User Guide
It is also possible to create Custom Toolbars consisting of items in the Toolbox or Komodo projects (e.g. run
commands, code snippets and directory shortcuts).
Left Pane
The Left Pane of the Komodo workspace contains the Places, Code and DOM sidebars.
Places
The Places sidebar displays a file manager and a list of recently used projects. To display it, select View|Tabs
& Sidebars|Places, or use the associated key binding.
Related Topics:
• Places
• Projects
• Managing Sidebars, Tabs and Panes
Left Pane 26
Komodo User Guide
Related Topics:
• Code Browser
• Managing Sidebars, Tabs and Panes
Related Topics:
• DOM Viewer
• Managing Tabs and Panes
Right Pane
The Right Pane of the Komodo workspace contains the Toolbox and, optionally, a Shared Toolbox.
Toolbox Sidebar
Use the Toolbox sidebar to manage and store Komodo components (for example, frequently used files, code
snippets, commands, and URLs). Add items to the Toolbox, as well as to folders within the Toolbox. Items
can be imported to the Toolbox and exported as Komodo project files and packages. Items added to the
Toolbox are displayed with associated icons for easy identification. To display the Toolbox sidebar, select
View|Tabs & Sidebars|Toolbox, or use the associated key binding.
Related Topics:
Related Topics:
• Shared Toolboxes
Editor Pane
The large pane in the middle of the Komodo workspace is the Editor Pane. The Editor Pane is used for editing
and debugging. Each open file has a corresponding tab at the top of the Editor Pane. Change the order of the
tabs by clicking and dragging tabs to the desired position. The name of the active file (that is, the file that is
currently displayed in the Editor Pane) is displayed in bold text. Use the left and right arrow buttons on the
right side of the tabs to scroll though open files. Use the close button "X" on the right side of the tab display to
close the active file. An asterisk beside the filename indicates that the file has been changed since it was
opened, and needs to be saved. If a file is under source code control, a file status icon to the left of the
filename indicates its current status.
Related Topics:
• Editing Files
• Managing Projects and Files
• Managing Tabs and Panes
Bottom Pane
The Bottom Pane spans the width of the Komodo workspace and displays at the bottom of the screen. The
Bottom Pane contains the following tabs:
• Breakpoints Tab: manage breakpoints and spawnpoints in the current debugging session(s)
• Command Output Tab: displays the results of commands run in the Run Command dialog box
• Find Results Find Results 2 Tabs: display the results of the Find All, Find in Files or Replace in
Files functions
• SCC Output Tab: displays details of source code control commands, such as editing or checking in
files
• Interactive Shell Tab: displayed when the interactive shell is launched as a stand-alone tool or from
within a debugging session
• Debug Tab: consolidates views of the debugger output, call stack, program variables (local and
global), and watched variables.
The Breakpoints, SCC Output, Interactive Shell, and Debug tabs are only available in Komodo IDE.
Status Bar
At the very bottom of each Komodo window is the Status Bar. From left to right, it displays:
• Editor Mode: when using Vi Emulation, this shows which mode you are in (e.g. Visual vs. Insert).
• Status: shows messages from Komodo describing events (e.g. the return of external commands).
• Section List: an expandable list of code or markup objects in the current file. When not expanded, it
displays the object at the current cursor position.
• Syntax Checking Status: shows the current status of syntax checking. Clicking this gives options to
"Check Syntax Now", "Jump to next result", or "Clear warning/error squiglies".
• File Encoding: shows the encoding of the current file (e.g. ASCII, UTF-8, Latin-1, etc.)
• Line and Column position: shows the current position of the cursor.
• Selection: shows the character and line count of the selection (if there is one).
• Language: shows which programming language Komodo is parsing the current file as. Click to select
a different language from the pop-up list or "Reset to best guess."
Bottom Pane 30
Komodo User Guide
Resizing Panes
When you are focusing on coding alone, you may want to maximize the Editor Pane. To increase the size of
the Editor Pane, hide the Left Pane and the Right Pane. The Left, Right and Bottom Panes can be resized by
clicking and dragging.
Resizing Panes 31
Getting Started with the Sample Project
Komodo's sample project includes a number of programs in different languages. Use these sample programs
to familiarize yourself with Komodo's functionality.
To open a sample program, double-click the file name on the Places sidebar. The contents of the file will
display in the Editor Pane.
1. Breakpoints: In the sample program, click on the gray margin to the immediate left of the Editor
Pane. A green circle will appear, indicating that a breakpoint has been set. When you run the
debugger, program processing will stop at lines where breakpoints have been set.
2. Start / Step Over / Step In: To start debugging, click the "Go" button on the Debug Toolbar. When
debugging begins, the Bottom Pane will be displayed beneath the Editor Pane in the Komodo
workspace. The program will run until a breakpoint is encountered; when program execution pauses
at a breakpoint, click "Step In" to move through the program in single line increments, or "Step Over"
to execute the entire function (as applicable), or "Step Out" to execute the remainder of a function (as
applicable).
3. Debug Tab: The tab labeled Debug: <filename> is displayed when debugging begins. In addition to
the debug output, the Debug tab displays the call stack, variables, and variable values.
Documentation
Have a look through this user guide to see if there is any relevant documentation. Use the Search field in the
top right corner of the Komodo Help window to search the table of contents.
http://community.activestate.com/products/Komodo
Mailing Lists
The Komodo mailing lists are another good resource for peer support. You can join the mailing lists, or search
the archives.
http://code.activestate.com/lists/komodo-discuss/
http://code.activestate.com/lists/komodo-beta/
Reporting Bugs
If you have found a bug, we'd like to know about it. First, query our on-line bug database to see if your bug
has already been reported:
http://bugs.activestate.com/query.cgi
Try a few searches using different keywords related to the problem; someone else may have reported the same
problem, but described it slightly differently. If you can't find an existing bug, submit a new one. A set of
guidelines for writing up a bug can be found here:
http://bugs.activestate.com/page.cgi?id=bug-writing.html
http://bugs.activestate.com/enter_bug.cgi
Your bug will be assigned a bug ID (and related URL) that you can use to monitor the progress of the bug.
The system can also email you when your bug is resolved.
Feature Requests
If you tried Komodo and you would like to see a specific feature or enhancement, provide a detailed
description in a bug report with Severity set to "7-enhancement".
• the version of Komodo (copy the Build Information listed in "Help|About Komodo").
• your operating system version
• relevant details of any associated software you are running (e.g. PHP version, SCC type, filesystem
type)
Reporting Bugs 34
Projects
Komodo Projects are collections of settings and preferences that help you work with a particular set of files.
These settings include:
Projects Pane
The Projects pane at the bottom of the Places pane is the main interface to projects. It lists all open projects,
showing the active project in bold.
Double-clicking on a project in this list will make that project active and switch the Places pane above to the
base directory of the project.
If the active project has saved debugger settings, test plans, library search paths, or mapped URI's, these
settings will be enabled for all files that are part of that project.
Projects 35
Komodo User Guide
Project Groups
Groups are named virtual containers for files and folders. You can use them to organize items for quick access
which might be in disparate locations. Groups are not actual direcories, they just contain links to files and
folders (or sub-groups).
Project Menus
Projects menus are available in the main toolbar, the Projects pane toolbar and as a right-click context menu.
The toolbar menus operate on the active project and the context menu operates on the selected project.
Each menu offers a different list of options, but there is some overlap. The following options are available:
• Show in Places: Changes the Places pane to the base directory of the project without making it the
active project.
• Open Project: Opens a diolog for choosing a .komodoproject file to open. The project is opened in
the pane and becomes the active project by default.
• New Project: Creates a new project, then opens it and makes it active.
• Close Project: Removes the selected project from the Projects pane.
• Close All Projects: Removes all projects from the Projects pane.
• Save Project: Saves the current project properties to the ".komodoproject" file.
• Save Project As...: Saves a copy of the current project with a different name (or in a different
location), then makes the new project active.
• Rename Project...: Renames the current project.
• Open Project in New Window: Each Komodo window can have only one active project at a time.
This feature opens a new Komodo window with the selected project active, allowing you to work with
multiple projects silmultaneously.
• New Project: Opens the filesystem browser to select the location and name of a new project. The
project preferences and settings are stored in a ".komodoproject" file. The directory selected becomes
the base directory for display in Places.
• Refresh Status: Updates the filesystem and source code control status of all files and directories in
the project.
• Add: Add files folders and groups.
♦ New File: Add a new file to the project or folder (depending on context or selection).
♦ New Group: Add a new named group of folders or files.
♦ Existing File: Select a file to include in the project, folder or group.
♦ Existing Folder: Select a filesystem folder to include in a project or group.
♦ Existing Remote File / Folder: As above, but using the remote filesystem browser.
• Source Code Control: A sub-menu of SCC actions. (Komodo IDE only)
• Publishing: A sub-menu of Publishing actions. (Komodo IDE only)
• Show in File Manager: Open the selection in the system's default file manager.
• Remove: Remove the selection from the project.
• Properties: Opens the Properties and Settings dialog for the current or selected project.
Project Groups 36
Komodo User Guide
Project settings include the following sub-set of the global preferences:
• Debugging
• Test Plan Configuration
• Languages
• Mapped URIs
The Toolbox sidebar is for storing "tools" - bits of code that you can quickly add to Komodo to automate
tasks, integrate extrnal tools, or just store snippets of text or links.
The following types of tools can be added anywhere in the Toolbox sidebar:
• macros
• commands
• snippets
• templates
• URLs
To show and hide the Toolbox sidebar click the Show/Hide Right Pane button in the Workspace toolbar,
click View|Tabs & Sidebars|Toolbox, or use the key binding for your platform (e.g. "Ctrl" + "Shift" + "L").
The top level of the Toolbox sidebar is considered the global toolbox. This is an area for tools that are
generally applicable for any file you might be working on. Tools can be grouped into folders to keep them
organized.
There are also two optional toolboxes indicated by special toolbox icons in the sidebar:
• Shared Toolbox: A toolbox for tools shared with a group of people or otherwise accessed by other
installations of Komodo. It is configured and toggled on or off in the Shared Support preferences.
• Project Toolbox: Tools specific to a particular project, only visible when that project is active.
To add an item in a specific place: right-click on the desired folder or toolbox, and select Add|New... from
the context menu.
To remove an item: select it and hit the Delete key or right-click on it and choose "Delete" from the context
menu.
To move tools: drag tools or directories between folders and toolboxes or cut/copy paste anywhere in the
Toolbox sidebar.
Toolboxes 38
Komodo User Guide
• Abbreviations: Any folder named "Abbreviations" for snippets it can use with the Abbreviations
function. See the "Samples" toolbox directory for an example.
• Vi Commands: Macros stored in a folder named "Vi Commands" can be run in command-line mode
if Vi emulation is enabled.
The individual tools are stored in JSON files with a ".komodotool" extension.
Toolboxes can also be exported as standard zip archives using "Export as Zip File..."
If Komodo is configured to integrate with a source code control system (SCC), status icons beside the
filenames indicate the file's current SCC status, and SCC options are available from the File menu and the
right-click context menus. This integration is described in detail in the Source Code Control section of the
Komodo documentation.
Files are manipulated in various ways: via the File menu, via context menus in the editor, via context menus
on the file tab (above the editor), and as components within projects and the Toolbox.
This document describes file functionality, such as opening, printing, and saving files. See the Editing page
for information about editing files.
Creating Files
To create a new file, click the "New File" button on the standard toolbar. (To display the standard toolbar,
click View|Toolbars|Standard.) A new file with the default file extension for the file type is created and
opened in the Komodo editor. Use the New Files page in Komodo's Preferences to specify the default file
extension for new files.
To create a new file from a template, select File|New|File. The New File dialog box contains numerous
pre-defined templates organized into categories. Select the desired category, then select the desired template
within that category.
Click Open to create a file with the contents of the template file. The file is loaded in the editor.
The File|New|File menu displays a list of the most recently accessed templates. To alter the number of
template files displayed, refer to the New Files page in Komodo's Preferences.
To add a template to the Toolbox for quick access, select the desired template and click Add to Toolbox.
Opening Files
There are numerous methods for opening files in Komodo. These include:
• Most Recently Used List: The most recently opened files are displayed on Komodo's Start Page.
This list is also accessible from the File|Recent Files menu. The number of files in the most recently
used list is determined by the Appearance preference.
• Drag and Drop: Drag and drop one or more files from another drag-and-drop application (such as
Windows Explorer) onto the Komodo editor.
• Command-Line Argument: When Komodo is invoked from the command line, files can be specified
as open arguments. See Starting on Windows, Starting on OSX, or Starting on Linux for more
information.
• Words in the filter box are used to match substrings in file basename.
• Matching uses "Smart Case": case-insensitive if the filter words are all lowercase, case-sensitive if
uppercase letters are used.
• You can also specify full and relative paths in the filter box. E.g. "~/myproject/Makefile",
"../relative/to/current/file.py".
Use the Open field on the Open/Find Toolbar to open one or more files in the filesystem. The Open field
generates a drop-down list of files and directories as you navigate the hierarchy. To open a file, enter the file
path and name, and then press 'Enter'.
For example, to open a file named "debug.txt" in the directory C:\temp\log on a machine running Windows,
enter C:\tmp\log\debug.txt in the Open field and then press 'Enter'. As you enter each backslash, a drop-down
list displays the files and directories beneath the current directory.
Enter "./" or ".\" in the Open field to display a list of files and directories in the "current" directory. The
current directory is determined as follows:
1. Current File: If a file is open in the editor, the directory where the file is stored is the current
directory. If multiple files are open, the file that is currently displayed is the current file.
2. HOME Variable: If no files are open, Komodo checks if the system has a defined HOME
environment variable. If so, the directory specified in that variable's value is the current directory.
Opening Files 41
Komodo User Guide
3. Filesystem Root: If neither of the above conditions is met, the system's root directory is used ("C:\" is
the default on Windows, and "/" is the default on Linux and Mac OS X).
To narrow the results in the list box, enter one or more characters in the name of the file or directory you wish
to open or view. (The search is case-sensitive.) Alternatively, use the arrow keys to navigate the drop-down
list. The contents of the Open field are updated as you move up and down the list with the arrow keys.
Note that you can use standard directory navigation syntax to change directories. For example, if the current
directory is /home/fred/tmp/foo, change to the /home/fred/tmp/bar directory by entering ../bar.
To open a file, press 'Enter' when the file name is displayed in the Open field. To continue navigating the
directory structure, append a frontslash or backslash to the directory name displayed in the Open field; the
drop-down list is updated with the list of files and directories that exist under the current location.
To open multiple files, specify a wildcard ("*" for a file name segment, "?" for a specific character). For
example, to open all the files with the extension ".tcl" in the directory /home/fred/tmp, enter
/home/fred/tmp/*.tcl.
At any time, press the 'Escape' key to return focus to the Komodo editor.
Komodo supports public key authentication through external key agents like ssh-agent (inlcuded with the
OpenSSH distribution) and Pageant (a companion utility for Putty). This allows you to access remote files
over SFTP or SCP without entering passwords.
• ssh-agent configuration: See Jeremy Mates's "OpenSSH Public Key Authentication" guide or the
ssh-agent manual page.
• Pageant configuration: See Using Pageant for authentication".
Information on configuring public key authentication with source code control (CVS and SVN) can be found
in Configuring SSH Support for CVS and Subversion.
After establishing a connection to the remote server, a list of files and directories is displayed. These files and
directories exist under the directory specified in the Look in field. Double-click a directory (indicated by a file
folder icon) to navigate the directory structure. Use the navigation buttons in the top right corner of the dialog
box to navigate the remote filesystem.
To open a single file, double-click the filename. To open multiple files, hold down the 'Ctrl' key while
clicking multiple files, then click Open.
The buttons in the top right corner of the dialog box perform various file and directory manipulation
functions. Hover your mouse pointer over the buttons for a description of their functions. To delete or rename
a file on the remote server, right-click the filename and, with the left mouse button, select the desired
command on the context menu.
This feature also works with URIs mapped to remote filesystems (via FTP, SFTP or SCP), which in turn can
be configured for automatic authentication under Edit|Preferences|Servers.
If more files are opened than can be displayed by file tabs, click the right and left arrow buttons located in the
top right corner of the editor to view the tabs of all open files.
To re-order the position of the file tabs, drag and drop the tabs into the desired positions.
For more information about working with the editor tabs, see Editor Tab Display in the editor documentation.
Comparing Files
Komodo includes a "diff" mechanism used to compare files. To compare two files using Komodo's "diff"
window:
2. By default, the path and file name of the file currently displayed in the editor is the first file for
comparison. As desired, alter this selection by entering an alternate path and file, or browse for the
desired file using Browse button. Use the same mechanism to specify the second file.
3. Click Compare Files. The contents of both files are displayed in the "diff" window.
If the file is stored in a project or the Toolbox, this function can also be invoked by right-clicking the file and
selecting Compare File With.
The unique characteristics of each file are displayed in different colors (red and blue by default); common
characteristics are displayed in a third color (black by default). To configure custom colors for the "diff"
window, alter the Language-Specific Coloring setting for the Other|Diff language in the Fonts and Colors
preference.
The following buttons (and default keybindings) are available in the "diff" window:
A right-click context menu is also available with the following additional options:
• Copy
• Select All
• View Whitespace
• View Indentation Guides
• View Line Numbers
• View EOL Markers
• Word Wrap
If the component is stored in a source code control system, Refresh Status also checks the repository status of
the file. Komodo determines whether a file is contained in an SCC repository by the following methods:
To refresh the file status of the current file, right-click the file tab or right-click within the editor and select
Refresh Status. The same option is available on the right-click context menu of files in projects or within the
Comparing Files 44
Komodo User Guide
Toolbox.
• Editor Context Menu: Right-click a file in the editor and select Source Control.
• File Tab Context Menu: Right-click a file tab above the editor and select Source Control.
• Toolbox or Project Context Menu: Right-click a file in the Toolbox or Projects sidebar and select
Source Control.
• Toolbox or Project Menu: If a file is currently selected in the Toolbox or Projects sidebar, use the
menu to access source code control commands for the selected file.
File Properties
The Properties category in the Properties and Settings dialog box displays general information about the file,
such as the directory where it is stored, the size and creation and modification dates. The following file
characteristics can be modified on this tab:
For HTML and XML documents, two additional settings are available:
• Default DOCTYPE
• Default Namespace
Komodo tries to determine these values from the document's XML declaration. If the document does not have
one, the DOCTYPE and namespace can be manually set here, enabling appropriate XML autocompletion.
XHTML 1.1 is the default if no declaration or settings are present.
Indentation Tab
The options on this tab are a subset of the Indentation Preferences. Refer to that section of the Preferences
documentation for information about individual options.
Browser Preview
This option configures the behavior of the Preview in Browser function. When the Preview in Browser
function is invoked, you are prompted to specify the file or URL used to preview the current file. (For
example, when previewing a CSS file, specify an HTML file to use for the preview.) The Preview in Browser
dialog box has an option for remembering the specification. If that option is enabled, the file or URL specified
is displayed in the Preview field. Click Change to alter the preview file.
Printing Files
To print the file that is currently displayed in the editor, use one of the following methods. These methods
invoke the standard system dialog box for printer selection and configuration. Advanced print functions are
described below.
Printing style is configured on the Printing page in Komodo's Preferences. Alternatively, select
File|Print|Print Settings to display the Printing preferences page.
Select File|Print|Print Preview contains features for setting the scale and orientation of a print job. Use the
arrow buttons to move forward or backward in a multi-page print job, or enter a specific page number in the
field provided. Click the Page Setup button to access the complete set of print features in the Page Setup
dialog box.
File Properties 46
Komodo User Guide
To print a selection of text rather than the entire file, select the desired text in the editor, then select
File|Print|Print Selected Text.
Page Setup
Manage the format of print jobs using the options available in the Page Setup dialog box. Select File|Page
Setup to access these options.
• Orientation: Select whether the printed output should have a portrait or landscape orientation.
• Scale: If the Shrink To Fit Page Width check box is not selected, use this field to manually enter a
percentage.
• Shrink To Fit Page Width: Select this check box to make the print job fit the paper size selected for
the default printer.
• Print Background (colors & images): Select this check box to include background colors and
graphics (e.g., on a web page) in a print job.
• Margins: Use the fields provided to enter the size of the margins in inches.
• Headers and Footers: Use the drop-down lists to select the type of information that appears in the
headers and/or footers, and to determine their position on the page. The top row of lists contains the
header options, and the bottom row contains the footer options. Choose from options such as "Title",
"URL" and "Page #". Select the "Custom" option from any of the drop-down lists to enter custom
header information. To print without headers and footers, select the "blank" option in each of the
drop-down lists.
1. On the File menu, click Print to HTML File. You are prompted to name the output file.
2. Enter the file location in the field provided. Click OK. The HTML file opens in the editor.
To print a selection of text to an HTML file (rather than the entire file), select the desired text in the editor,
then select File|Print|Print to HTML File.
Saving Files
Komodo is "intelligent" about saving files. For example, Komodo prompts to save unsaved files on close.
Attempting to save changes to a file that is set to read-only displays a dialog box where you are given the
option to change the status or to "force" the save (which makes the file writable, saves the changes, then sets
the file back to read-only). In addition, Komodo can be configured to automatically save a backup copy of
files open in the editor. To configure Komodo's save functionality, use the Save Options preference page.
Printing Files 47
Komodo User Guide
• File|Save: Use the File|Save menu option to save the file that is currently displayed in the editor. To
save the file to a different name, select File|Save As. To save all open files, select File|Save All
• Standard Toolbar: Click the Save button on the Standard toolbar. To save all open files, click the
Save All button.
• File Tab Context Menu: Right-click the file tab and select Save. To save the file to a different name,
select File|Save As.
The unique characteristics of each file are displayed in different colors (red and blue by default); common
characteristics are displayed in a third color (black by default). To configure custom colors for the "diff"
window, alter the Language-Specific Coloring setting for the Other|Diff language in the Fonts and Colors
preference.
Reverting Files
To abandon changes made to a file since it was last saved, but leave the file open in the editor, select
File|Revert.
Closing Files
To close one or more files, use one of the following methods:
• Editor Tabs: Click the "x" in the top right corner of the tab, or middle-click on the tab.
• File Menu: Select File|Close then one of Current Tab, Other Tabs or All Tabs.
• Key Binding: Use the associated key binding (e.g. "Ctrl"+"F4" on Windows).
• Editor Tab Context Menu: Right-click the file tab and select Close.
Saving Files 48
Find & Replace
There are a number of ways to search for text in Komodo:
To replace text, use the Find dialog with the Replace option enabled.
Match Highlighting
When performing a search on the current buffer, all matching text strings will be highlighted. Press 'Esc' to
clear the highlighting.
To guard against performance problems caused by slow searches, Komodo will stop highlighting matches
after the timeout configured in the Find preferences.
Incremental Search
Use incremental search to quickly find a word or string in the file you are currently editing.
• Start an incremental search: Use the associated key binding (by default: 'Ctrl'+'I' on Windows and
Linux, 'Cmd'+'I' on Mac OS X). The status bar displays "Incremental Search:" followed by the
characters in your search. Begin typing the characters you want to find. As you type, the cursor moves
to the first match after the current cursor position.
• Jump to the next/previous occurrence: Press 'Ctrl'+'I' 'Ctrl'+'I' to cycle through all subsequent
occurrences; press 'Ctrl'+'Shift'+'I' to cycle through previous ones.
• Use a selection as your search string: Select the text you want to use with the mouse or keyboard,
then press 'Ctrl'+'I'.
• Change the search string while searching: Use 'Shift'+'Right Arrow' to add the character to the right
of the current selection, and 'Shift'+'Left Arrow' will remove a character.
• Cancel the search: Press 'Esc'.
Find Dialog
The Find dialog box is a multi-purpose interface for finding and replacing text. It has the following options:
• Multiline: Changes the "Find what:" field to a multi-line field, allowing you to insert blocks of text.
• Replace: Adds the "Replace with:" field for making substitutions.
The interface changes as different options are selected, so that you only see fields and buttons that are relevant
to your task.
Regex Searches
Selecting Regex will interpret the search string as a Python regular expression, and perform the search
accordingly.
To the right of the "Find what:" field are two buttons which can help you compose your regular expression:
• Regular Expression Shortcuts: A drop list of commonly used regular expression special characters
and sequences with a short description of what each one does.
• Open in Rx Toolkit: Opens the regular expression from the "Find what:" field in the Rx Toolkit,
allowing you to test it before running your search. Komodo IDE only
When used in conjunction with Replace, regular expression replacement sequences can be used in the
"Replace with:" field (e.g. "\1", "\g<name>", etc.).
Case Sensitivity
The Smart case / Match case option is a three-way toggle:
• Match case (selected): Performs a case sensitive search; only exact matches are found (e.g.
"myString" matches "myString" but not "mystring").
• Match case (deselected): Performs a case insensitive search; strings will match even if the case is
different (e.g. "mystring" will match "myString").
• Smart case (selected): Search strings containing capital letters are automatically case sensitive.
Multiline
Selecting Multiline changes the "Find what:" field (and the "Replace with:" field if Replace is selected) with
larger, multiline text boxes.
This makes it easier to paste in multiline blocks of text in these fields. The search text will only match if the
line breaks are the same. Line breaks in the "Replace with:" field are likewise respected.
Scope
The "Search in:" drop list defines where the find or replace will happen. It contains the following options:
Find Dialog 50
Komodo User Guide
• Current document
• Selected text
• Open files
• Project (current project)
• Files
Selecting Files from this list opens additional fields allowing you to set the scope of your search in directories
on your filesystem:
• Directories: Defines the path to the directory to start your search in. Multiple paths can be added by
separating them with a semi-colon (";"). Relative paths can be specified using the path of the file in
the current editor tab as the starting point (e.g. "../adjacent-dir/").
• Search in sub-directories: If selected, makes the search recursive. The search starts in the directory
or directories specified above and descends into all sub-directories.
• Include: Defines the file names to include in the search or replace. Can be used to specify a partial
filename or file extension with glob syntax (e.g. "*.html, *.txt").
• Exclude: As above, but defining the files and directories to exclude.
See also the Replace in Files section for a description of the Confirm and Undo options.
Actions
Once all the options for the Find or Replace are set, choose the action you wish to perform. The action buttons
available will depend on which options have been selected:
• Find Next: Finds consecutive occurrences of the search string in your file or selection. As matches
are found, the text will be highlighted. The Find dialog box remains in focus. To keep the focus in
your file, close the Find dialog box, then use the associated key binding.
• Find All: Locates all occurrences of the search string in your file or selection. The matches will be
displayed in the Find Results tab in the Bottom Pane.
• Replace: Highlights the next occurrence of the search string; if you click Replace again, the
highlighted text will be replaced with the replacement string and the next occurrence of the search
string will be highlighted.
• Replace All: Replaces all occurrences of the search string in the document or selection without
prompting for confirmation. All replacements will be displayed on the Find Results tab of the Bottom
Pane.
• Mark All: Inserts a bookmark on each line that contains the search string. To move the editing cursor
to a bookmarked line, press 'F2'.
On Mac OS X, these keyboard shortcuts are accessed by holding down the 'Ctrl' key, but are not indicated in
the interface. They are:
Scope 51
Komodo User Guide
• Regex: 'X'
• Match/Smart case: 'C'
• Word: 'W'
• Multiline: 'T'
• Search in: 'I'
• Directories: 'D'
• Browse button: '.'
• Search in sub-directories: 'B'
• Include: 'U'
• Exclude: 'E'
• Find Next: 'F'
• Replace: 'R'
• Replace All: 'A'
• Show results: 'O'
• Confirm: 'M'
Replace in Files
Globally replacing strings in multiple files can be daunting. Using a search string that matches more than what
was intended, specifying an incorrect replacement string, or selecting the wrong starting directory for a
recursive replacement can cause havoc.
Komodo's Replace in Files feature has a Confirm option which lets you check the substitutions before you
apply them, and an Undo feature to revert the replacement if you make a mistake.
Confirming Changes
When "Search in: Files" is selected, the only action button available is Replace All. Beneath this button is a
Confirm check box. This option adds an additional step to the replacement process which allows you to view
changes before applying them, and "un-mark" specific changes you don't want to apply.
Confirm Replacements
The Confirm Replacements dialog box shows a list of all pending replacements from the Replace in Files
operation. Each line shows:
• A check mark (by default all are marked) indicating that the replacements in that file are marked for
inclusion. Click on the check marks to toggle them on or off.
• The path and filename
• The number of replacements to be made in the file
Show Selected Changes previews all selected changes in the list. Use 'Shift'+'Click' or 'Ctrl'+'Click' to select
multiple items.
The preview window has the same format and options as Compare Files. The preview is in unified diff
format, so it can be copied and saved as a patch.
Make Changes
Once you have confirmed that all pending replacements are correct, or un-marked the changes you do not
want to include, click Make Changes.
If you've made a mistake and would like to roll back all of the changes from the last Replace in Files
operation, click the Undo Replacements button in the Find Results tab toolbar.
Komodo can open two tabs, Find Results 1 and Find Results 2, which can be locked using the Lock button
in their respective toolbars. New find or replace operations will not overwrite contents in a locked tab.
Komodo uses the first available tab for output. If both tabs are locked during subsequent find or replace
operations, Komodo prompts you to unlock one of the tabs or cancel the action.
• File: the path and filename in which the match or replacement occurred
• Line: the line number on which the match or replacement occurred
• Content: the text that was matched or replaced
Double-click on any output line to jump to the relevant file and line in an editor tab.
Open/Find Toolbar
The Open/Find toolbar provides a quick way to open files and find strings. The toolbar is not displayed by
default; to open it select View|Toolbars|Open/Find.
• Open: The file to open. Use the full path of the file, the relative path from the directory of the current
file, or just the filename if it's in the same directory as the current file.
• Find: The string to search for. Pressing 'Enter' after typing the search term searches the current file.
Make Changes 53
Komodo User Guide
• in: The directory or file to search in. Pressing 'Enter' in this field causes the search term in the Find
field to be applied to the specified directory or file instead of the current file. You can use the Browse
button to the right of the field to populate this field. Accepts the glob wildcards '*' and '?'.
The Find and in fields both keep a list of the most recently entered strings and file specifications.
If a file or directory is specified in the in field, matches will be displayed in a Find Results tab.
Press 'Esc' to return focus to the Komodo editor. All fields can be accessed via their associated key bindings.
Use Navigation|Find Next Function or Navigation|Find Previous Function (or the associated key
bindings) to cycle through the functions.
Use Navigation|Find All Functions to display a list of all functions in a Find Results tab. Double-click on
any entry to jump to the relevant line.
Komodo IDE has a more powerful feature with the same default keybinding ('Ctrl'+'F8') called the Sections
List.
Open/Find Toolbar 54
Editing
Feature Showcases
Komodo's editor has extensive code intelligence features for JavaScript, HTML, XML, XSLT, Perl, PHP,
Python, Ruby, and Tcl. and provides syntax highlighting and common editor features for most other
programming languages. Many of these features can be customized in Komodo's editor preferences.
Right-clicking in the editor pane brings up a context menu with common editing functions. In addition to
standard Cut, Copy, Paste, Select All, and Print commands, the following options are available:
Language Support
Syntax Coloring and Indentation
The Komodo editor is language-sensitive. When you open a file in a supported language, Komodo will color
the syntax, format indentation, and provide indentation guides.
Editing 55
Komodo User Guide
More Information:
The syntax checking icon in the status bar displays the syntax status of the current file displayed in the Editor
Pane:
• A green check mark over the icon indicates that the language interpreter does not detect any warnings
or errors in the program.
• A red exclamation mark over the icon indicates one or more errors. To see the number of errors and
warnings contained in the program, hover your mouse pointer over the syntax checking icon. A
pop-up tool tip will display the total number of errors and warnings.
• An hourglass over the icon indicates that syntax analysis is in progress.
You can view the error message from the interpreter in the status bar if the editing cursor is on the same line
as the error. If it is not, hover the mouse pointer over the error and the interpreter error will be displayed in a
pop-up tool tip.
To move the editing cursor to the line containing the error or warning, double-click the syntax checking icon.
If there are multiple errors or warnings, each time you double-click the icon, the editing cursor will move to
the next error.
If background syntax checking is disabled in Preferences, shift-click on the syntax checking icon to check the
syntax of the file.
Autocomplete presents a pop-up list of relevant choices at certain trigger points as you are editing a
document. Autocomplete functionality varies according to language; for example, Python autocomplete lists
object methods when you type the '.' (period) trigger character, Perl autocomplete lists available sub-packages
when you type the '::' trigger string in a "use" statement, and XSLT autocomplete lists appropriate element
and attribute names when starting XML tags.
Use the arrow keys to scroll through the list; use the 'Tab' or 'Enter' key to insert the currently selected item
into your document; use the 'Esc' key to cancel the pop-up list.
A calltip presents you with a call signature for, and possibly a short description of, a function or method call.
Generally, a calltip is opened when you enter the open parenthesis, "(", of a function call. However, this varies
according to language. Use the 'Esc' key to close the calltip.
Komodo includes autocomplete and calltip support for several languages. Language-specific functionality for
each supported language is described below.
More Information:
• Autocomplete for sub-modules in use statements: Available sub-modules are listed upon entering
"::" in use and require statements. For example:
use LWP::|
use LWP;
$HTTP::Request::|
• Autocomplete for module subroutines: Subroutines are listed upon entering "->" after a module
name. For example:
use LWP;
LWP::UserAgent->|
• Autocomplete for object methods: Object methods are listed upon entering "->" after an object
reference. For example:
use Data::Dumper;
my $d = Data::Dumper->new($foo);
$d->|
• Calltips for subroutine calls: A calltip is shown for subroutine and object method calls upon
entering "(" after a sub-routine name, if information is available for that subroutine. Note: Perl
supports subroutine calls without the parentheses. Komodo only triggers a calltip without the
parentheses for certain built-in Perl functions such as, "chdir", "split", "join", etc.
A Perl autocomplete list or calltip can also be explicitly initiated by typing 'Ctrl'+'J' ('Cmd'+'J' on Mac OS X).
• Autocomplete for object methods and attributes: Object methods and attributes are listed upon
entering "." after an object reference. For example:
import sys
sys.|
"This is a string".|
• Autocomplete for import statements: Modules are listed after an import or from statement.
Available members (i.e. sub-modules, variables, functions, and classes) are listed after a from ...
import construct. For example:
##
# This is the description.
# @|
• Calltips for function calls: A calltip will be shown for function and object method calls upon
entering "(" after the function name -- if information is available for that function.
A Python autocomplete list or calltip can also be explicitly initiated by typing 'Ctrl'+'J' ('Cmd'+'J' on Mac OS
X).
• Autocomplete for require statements: Available Ruby libraries are listed upon entering the
opening quote and for slashes in the quotes. For example:
class Animal
def initialize(species)
@@species = species
end
def grunt
"ugh"
end
def run
end
end
Animal::|
• Autocomplete for methods on an class instance: Available methods on an instance are listed upon
entering ".". For example:
a = Animal.new("dog")
a.|
• Calltips for method calls: The method signature (and possibly some method documentation) is
shown in a calltip upon entering the "(" for a method call.
a = Animal.new(|"dog")
A Ruby autocomplete list or calltip can also be explicitly initiated by typing 'Ctrl'+'J' ('Cmd'+'J' on Mac OS
X).
• Classes and Methods: Classes in the current file, and classes in any included files, are displayed
upon entry of the keyword "new". Methods for a class instance are displayed after you enter "->" on
the instance variable or alternatively if the scope is inside the class you will get completions after
"this->", "self::", "parent::" operators. Static and constants are displayed after you enter "::" after a
class name.
class Student {
const UNIVERSITY = "Pluto";
var $id = "";
var $name = "";
function Print() {
echo "Id: " . $this->id . " Name: " . $this->name . "\n";
}
}
• Functions: Standard PHP functions and functions defined within the script (and within any included
files) are displayed after you have typed three characters that match one or more function names.
Function calltips are displayed after the opening parentheses "(" on a function call.
php|info();
phpversion(|);
• Constants: PHP constants are included with the functions list triggering after three characters have
been typed.
• Variables: Variables declared in the current file, or in any included files, are displayed when you
enter the symbol "$" followed by one letter.
• Autocomplete for command names: A list of matching Tcl commands is displayed after you have
typed three characters in a command. For example,
str|
• Calltips for command arguments: A calltip is displayed for a Tcl command upon entering ' ' (space)
after the command name. For example,
string is alpha |
Tcl autocomplete and calltips use the built-in function definitions contained in Tcl .tip files, which are in the
lib/support/tcl subdirectory of the Komodo installation directory.
Windows
<komodo-install-directory>\lib\support\tcl
Linux
<komodo-install-directory>/lib/support/tcl
Mac OS X
<komodo-install-directory>/Contents/SharedSupport/tcl
Edit the .tip files to customize or extend Tcl autocomplete and calltips in Komodo. Review the existing .tip
files for examples before editing.
XSLT AutoComplete
• Autocomplete for XSLT elements: A list of appropriate elements in the XSL-namespace for the
current context is supplied upon entering "<" to start a tag.
• Autocomplete for XSLT attributes: A list of appropriate attributes in the XSL-namespace for the
current element is supplied upon entering ' ' (space) in a tag.
• Autocomplete for end-tags: A one item list containing the appropriate closing tag for the current
position is supplied upon entering '</'.
• Autocomplete for output: A list of elements and attributes for HTML or XML output (as defined in
the method attribute of the xsl:output element) is supplied upon entering "<" within
xsl:template blocks. If the output method is a specific dialect of XML, specifying the
publicId or systemId of that dialect in the doctype-public or doctype-system
(respectively) enables autocompletion appropriate to that dialect.
Komodo supports XML autocomplete and calltips for basic XML as well as a a number of XML dialects,
including:
• HTML
• XML Schema • VXML
• XHTML
• Atom • SVG
• SGML
• Dublin Core • MathML
• RELAX
• DocBook • XBL
• RELAX NG
• WAP • XUL
• RDF
• XSLT • XML Catalog
• MXML
Support for additional XML dialects can be configured by adding an XML Catalog for the dialect in the
SGML/XML Catalogs section of the Code Intelligence Preferences.
• Autocomplete for elements: A list of elements available in the current namespace is supplied upon
entering "<". If the current document's XML dialect is not recognized (i.e. it is not in the above list or
in a configured catalog), the completion list is drawn from elements used in the document.
• Autocomplete for attributes: A list of attributes available within in the current element is supplied
upon entering a space after the element name.
• Autocomplete for end-tags: A list (of length one) to close the current tag is supplied upon entering
'</'.
If the document does not have an XML declaration, autocomplete will default to XHTML 1.1. The
DOCTYPE and namespace can be manually set under File Properties.
Soft Characters
With Enable soft characters selected in Komodo's editor preferences, typing one of "[" "{" "(" will put the
matching, highlighted closing character to the right of the cursor. The highlighting indicates that it's a "soft"
character. If you move over the soft character with navigation keys or move to a new cursor position outside
of the delimiters with the mouse, the soft characters become fixed (i.e. are inserted as normal text). You can
also "type over" soft characters. For example:
object.method(value|)
object.method(value)|
In most programming languages, typing a string-start character in a "default" context (i.e. not in a string or
comment), will generate the appropriate soft quote to the right of the cursor. Komodo is aware that in some
languages characters like single-quote are used to start a comment, so no soft character is generated.
Cursor movement (e.g. moving over the soft character with the right-arrow) "hardens" soft characters.
If you have opened a file that does not have a file association specified in the Preferences dialog box, Komodo
displays the file as text. You can select to view the file as another language, but Komodo does not remember
again. If you will be working with a new type of file, it is recommended that you specify a file association.
For example, if you open a DocBook (*.docb) file in Komodo, it does not have XML syntax coloring. Specify
a file association to tell Komodo to open *.docb files as XML files. For more information on specifying file
associations, see Customizing File Associations.
If you choose to view a file in a different language and then save the file, the original language will not be
restored when you re-open the file. If you are unsure of the original language, you can select View|View As
Language|Reset to best guess. Komodo will ignore the user preference, and analyze the file in an attempt to
determine its language.
Soft Characters 62
Komodo User Guide
More Information:
Manipulating Code
Cutting and Copying Lines
When no text is selected, the Cut and Copy commands operate on the entire line. For example, pressing
'Ctrl'+'X' while editing a line will cut the entire line even though there is no selection. Note: This behavior
also applies to blank lines.
Copying or cutting lines repeatedly from the same cursor position adds each line to the clipboard rather than
overwriting the previous clipboard contents.
To drag a single line, click the line number and (keeping the left mouse button depressed) drag it to the
desired location. The same operation can be done with multi-line selections.
1. Select Code|Repeat Next Keystroke N Times. The status bar at the bottom of the Komodo
workspace prompts you for the number of times the keystroke will be repeated.
2. Type a number using only numeric characters.
3. Enter the keystroke. The results of the sequence are displayed in the Editor Pane the specified number
of times.
• Single Line: Position the cursor at the start of the text on the desired line. Press Tab, or select
Code|Indent.
• Multiple Lines: Select the desired lines by clicking and dragging in the Editor Pane. Press Tab, or
select Code|Indent.
• Single Line: Position the cursor at the start of the text on the desired line. Select Code|Dedent or use
the associated key binding.
• Multiple Lines: Select the desired lines by clicking and dragging in the Editor Pane. Select
Code|Dedent, or use the associated key binding.
Specify the number of spaces per tab in the Indentation Editor Preferences
(Edit|Preferences|Editor|Indentation).
Reflowing Paragraphs
To reformat a section of code so that it is left-aligned and displays within the Edge line column, select the
section of code to be reflowed, and then select Code|Reflow Paragraph. Alternatively, use the associated key
binding.
• Select the formatter from the list under Code|Format Using. The first sub-menu shows the formatters
available based on Komodo's language detection. Additional formatters are available under the Other
Formatters sub-menu.
• Use the Editor: Format Code or Text command ('cmd_format'). Komodo will run the formatter on
the selection if there is one. If there is no selection, the entire document will be formatted. By default,
this command does not have a key binding; you can assign one in the Key Bindings preferences.
Note: Komodo uses HTML Tidy as the default formatter for HTML documents. Since this parser cannot
differentiate between isolated sections of HTML and complete documents, use Tidy Fragment when
formatting selection and Tidy Document when formatting the entire file.
Joining Lines
To cause two lines of code to display on the same line, position the cursor in the first of the two lines, and
select Code|Join Lines. The second line is joined with the first line.
Transposing Characters
To reverse the position of the two characters to the left of the editing cursor, use the associated key binding.
Literal Characters
To insert literal characters into the editor, select Code|Enter Next Character as Raw Literal, and then enter
the key or key combination representing the literal character. (Alternatively, use the associated key binding.)
For example, to insert a form feed, enter 'Ctrl'+'L'. The following characters are common:
To un-comment a line of code, place the cursor is on the desired line, then, from the Code menu, select
Uncomment Region. Alternatively, use the associated key binding.
To comment a block of code, select the lines you wish to comment by clicking and dragging the mouse in the
Editor Pane. Then, from the Code menu, select Comment Region. Alternatively, use the associated key
binding.
To un-comment a line of code, place your cursor is on the desired line, then, from the Code menu, select
Uncomment Region, or use the associated key binding.
1. On the View menu, click View EOL Markers to show line endings.
2. Select the line(s) for which you want to replace the endings.
3. On the Code menu, click Clean Line Endings. The line endings are replaced with the line endings
specified in the file's settings.
To tabify a region:
Literal Characters 65
Komodo User Guide
To untabify a region:
1. Open python_sample.py
2. Find the following line: print "element %s is a string" % element. There are 8
leading spaces on this line.
3. Tabify this line. Set the number of spaces to 8. This means the 8 spaces will be converted to one Tab
character.
4. Now this line has one Tab character, represented as a right arrow, preceding print "element %s
is a string" % element;. This does not change the line's indentation.
5. Untabify this line. Set the number of spaces to 8. This returns the line to the original state.
You can set the width of Tab characters in the Preferences dialog box. The default value is 8.
Note: On Linux, the default key bindings may conflict with ones used by the window manager. To avoid this,
re-map the "Editor: Select Rectangular..." commands in the Key Binding Preferences to unused key
combinations.
Column Editing
Once a rectangular selection has been made, text insertion will operate on each line of the selection; the
characters will be duplicated on all selected lines.
For example to change "directory-name" in the file list below, select the column containing that name as
described above.
Once the column is selected, begin typing. The cursor will appear only at the top line of the selection, but the
new text will appear on all subsequent lines within the colum selection.
Note: Column selections in areas beyond line endings will not appear correctly. The areas beyond the end of
line will not be highlighted, but column editing will still work. Text will be inserted immediately after the
longest line in the selection.
With Vi emulation enabled, mouse selection and Vi visual blockwise selection ('Ctrl'+'V') will not trigger
column editing. While in Input mode, use 'Alt'+'Shift' with the direction keys to make the column selection,
and 'Esc' to exit column editing mode.
Completing Words
The Komodo editor maintains an index of words in the current file. Rather than re-entering words that already
exist in the current file, use the Complete Word feature to finish words.
Enter one or more characters, then select Code|Complete Word, or use the associated key binding. Words are
completed based on the most recent occurrence in the current file. For example, if you type "pr", Komodo
searches backward from the insertion point to find the first instance of a word that begins with "pr". Continue
pressing the spacebar while holding down the 'Ctrl' ('Cmd' on Mac OS X) key to cycle through all possible
completions for the word. The Complete Word feature is case sensitive.
Column Editing 67
Komodo User Guide
When the Select Block function is invoked, Komodo analyzes the cursor position relevant to the blocks of
code in the document. If the cursor is within a block, the entire block will be selected. (If the cursor is within a
nested block, only the current sub-block will be selected, not the block that contains the entire nested
structure.) If the cursor is not inside a block, the entire document will be selected.
To toggle whitespace on and off, select View|View Whitespace, or use the associated key binding.
To set a default for whitespace display, see Customizing Editor Features for more information.
To toggle indentation guides on and off, select View|View Indentation Guides, or use the associated key
binding.
To toggle line numbers on and off, select View|View Line Numbers, or use the associated key binding.
To set this option globally, see Customizing General Editor Features for more information.
To toggle EOL markers on and off, select View|View EOL markers, or use the associated key binding.
To set this option globally, see Customizing General Editor Features for more information.
1. On the View menu, select Font, then Toggle Fixed/Proportional Fonts. This changes the font to
fixed width.
2. Repeat to reverse.
All foldable blocks of code collapse and the minus signs all become plus signs.
All foldable blocks of code expand and the plus signs all become minus signs.
Go to Definition
You can jump to the definition of a code object under your cursor (e.g. a variable, a subroutine, a module,
etc.) in any of the following ways:
Alternatively, double-click the symbol node for the object in the Code Browser tree.
Objects defined within the file, in user-defined modules, and in the site library are accessible in this way;
objects defined in a language's standard library are not.
In Rails applications, you can also jump to symbol definitions in models from controller files.
Bookmarks
• To set or unset a bookmark: Position the editing cursor on the line of interest. Select
Navigation|Toggle Bookmark or use the associated key binding to bookmark the line. If the line is
already bookmarked, the bookmark will be removed.
• To move to the next bookmark: Select Navigation|Next Bookmark or use the associated key
binding.
• To move to the previous bookmark: Select Navigation|Previous Bookmark or use the associated
key binding.
• To clear all bookmarks: Select Navigation|Remove All Bookmarks or use the associated key
binding.
Marks
Komodo has three commands for Emacs-style transient marks, which have following defaults using the
These commands can be bound to custom key sequences in the Key Bindings preferences with any key
binding scheme.
Matching Braces
Use the Matching Brace functions to quickly jump between opening and closing braces and parentheses.
Notice that when the editing cursor is adjacent to a brace or parenthesis, the brace is displayed in bold red.
The associated closing or opening brace is also displayed in bold red.
To jump to the matching brace, select Navigation|Jump to Matching Brace, or use the associated key
binding. To select the braces and the contents they contain, select Edit|Select|Select to Matching Brace.
Preview in Browser
You can configure Komodo to preview a variety of file types in your default browser, or in the Editor Pane.
The Preview in Browser feature is particularly useful when working with HTML or XML files.
The browser preview will be displayed in a separate window, in the Editor Pane, or in a split view of the
Editor Pane, depending on which preference has been set.
The context menu in the Editor Pane is only available when the "source" tab is in focus. If Komodo does not
support previewing of a specific file type, the Preview in Browser option will not be available from either the
toolbar or the View menu.
1. Open the file in the Komodo Editor Pane. Or, if the file is already open, make sure it is the selected
tab in the Editor Pane.
2. Select View|Preview in Browser. A dialog box will appear, prompting you to choose which file to
preview.
3. If you want to preview the current file, select Preview with this file, or, if you want to preview using
another file that includes the current file (e.g., use an HTML file to preview a CSS file), select
• Move to Other Tab Group: Splits the Editor Pane (if not already split) and moves the active file to
the other tab group.
• Split View: Splits the Editor Pane (if not already split) and displays the active file in both tab groups.
• Rotate Tab Groups: If two tab groups are displayed, this option switches between a horizontal and
vertical split.
If displayed in the Editor Pane, previews include a toolbar with basic Web browser functionality, including
(from left to right) "Back", "Forward" "Reload", and "Stop" buttons.
Preview in Browser 72
Abbreviations
The Abbreviations function lets you quickly insert code snippets by entering their name in the editor buffer
followed by Ctrl+T. Several useful default snippets are included in Komodo. Additional ones can be added
easily.
Komodo looks for abbreviations in a special folder in projects and toolboxes called Abbreviations. Within the
Abbreviations folder are language specific sub-folders, and a General sub-folder for global snippets.
Inserting Snippets
To insert a snippet using Abbreviations, enter the name of the snippet in the editor buffer, then enter Ctrl+T
(Meta+T on OS X). Komodo searches for a snippet matching the word to the left of the cursor in
Abbreviations folders, and replaces the word with the contents of the snippet if it finds one.
divblock|
<div id="default">
</div>
Many of the default snippets in Komodo use Tab Stops (highlighted above) to make populating the snippet
with your content even quicker. After inserting the snippet, the first tab stop is selected, just start typing to
insert text in place of the marker. Use the Tab key to cycle through subsequent markers.
Abbreviations 73
Komodo User Guide
Exact case matches take precedence over mismatched case. For example, "Class" would trigger a snippet
named "class" if there isn't one named "Class".
This allows you to have snippets with the same names for multiple languages. For example an abbreviation
called 'class' abbreviation would insert a different snippet in a Perl file than in a PHP file.
To add a new abbreviation to a project, use the steps above after adding the necessary folders (i.e. at least
Abbreviations/General) to the project.
As with all project and toolbox items, snippets can be copied, cut and pasted between toolboxes and projects.
Locations
The editing history is saved as a list of locations. Each location is made up of a filename and a cursor position.
There is one history session per Komodo window.
History Navigation
You can navigate the history using the Back and Forward buttons, or by selecting the desired position from
the drop down list.
Back and Forward are also available in the Code menu, and will display the keybindings assigned to these
actions ("Editor: Go Forward" and "Editor: Go Back" in the Key Binding preferences). The default
keybindings are the same as those used in most browsers: 'Alt'+'Left/Right arrows' on Windows and Linux,
'Cmd' + '[' or ']' on Mac OS X.
History 75
Snippets
Feature Showcases
Snippets are frequently used strings that can be quickly inserted into the current document. For example,
repetitive sections of code or standard comments can be stored within a snippet. Snippets have advanced
properties; they support the use of Tabstops and Interpolation Shortcuts, can be assigned to Key Bindings, and
allow for the specification of indentation context and cursor position.
Creating Snippets
To create a code snippet, select the desired block of text in the Editor Pane. Then drag and drop the selected
section onto the Toolbox tab or into a project on the Projects tab.
Alternatively, select the desired text, then right-click and select Add as Snippet in the Toolbox.
Alternatively, right-click a folder in the Toolbox or on a project or folder name in the Projects sidebar, and
select New Snippet. If you use this method, you must manually enter the contents of the snippet; text selected
in the Editor Pane is not automatically added to the Snippet dialog box.
Configuring Snippets
To configure snippet properties, right-click the snippet on either the Toolbox tab or the Projects tab, and select
Properties. The following configuration properties are available:
• Snippet Name: Enter the text that should display in the Projects or Toolbox sidebars for this code
snippet. If the snippet was created by dragging a text selection from the Editor Pane, the snippet is
named after the text in the snippet.
• Snippet Contents: If the snippet was created by dragging a text selection from the Editor Pane, the
contents of the selected text are displayed in the Snippet Contents field. Otherwise, enter the contents
of the snippet manually. Add or edit snippet content as desired.
• Snippet Shortcuts: Add Interpolation Shortcuts or Tabstops to a snippet by clicking the arrow button
to the right of the Snippets Contents field, and selecting a shortcut from the drop-down menu.
Interpolation shortcuts in snippets are not executed when the snippet is inserted in the Editor Pane via
dragging and dropping.
• Maintain selected text or cursor position after insertion: Within the snippet contents field, either
select a portion of the snippet (by dragging the mouse pointer over the desired selection) or position
the editing cursor within the string. If this check box is selected, when the snippet is inserted into the
Editor Pane, the selected text or the cursor position is displayed in the same manner.
• Maintain indentation context after insertion: If the snippet is inserted into the Editor Pane when
the editing cursor is in an indented position, select this check box to use the indentation point as an
indentation "prefix". The indentation structure of the snippet is preserved at the position of insertion.
Snippets 76
Komodo User Guide
Using Snippets
To insert the contents of a snippet at the current cursor position in the Editor Pane, double-click it, or
right-click the snippet and select Insert Snippet.
Although you can also drag and drop snippets onto the Editor Pane, the cursor position and indentation check
box options explained above in Configuring Snippets will only take effect if the snippet is added using the
double-click or Insert Snippet method.
Abbreviations
Snippets saved in a toolbox or project folder called "Abbreviations" (or a language-specific sub-directory) can
be inserted by typing the snippet name in the buffer. See Abbreviations.
Snippet Options
To access options for the selected snippet, right-click a snippet in the Toolbox and select the desired option.
• Insert Snippet: Use this option to insert the snippet at the current cursor position in the editor, as
described above in Using Snippets.
• Cut/Copy/Paste: Used to duplicate or move a snippet when dragging is not convenient (e.g. to a
project which is currently closed).
• Show in File Manager: Shows the JSON file for the snippet in the system's default file manager.
• Export as Zip File...: Exports the snippet in a standard ".zip" archive.
• Rename: Changes the snippet name.
• Delete: Permanently removes the selected snippet from the toolbox.
Snippet Properties
Snippet properties are used to alter or rename snippets (as described in Configuring Snippets, above). The
Properties dialog box is also used to assign a custom icon to a snippet or to assign a custom key binding. To
access the Properties dialog box, right-click the snippet and select Properties.
The default snippet icons can be replaced with custom icons. Komodo includes more than 600 icons;
alternatively, select a custom image stored on a local or network drive (use 16x16-pixel images for best
results).
1. In the Projects or Toolbox sidebar, right-click the desired snippet and select Properties. Alternatively,
click the icon in the Projects or Toolbox sidebar, then select Projects|snippet_name|Properties or
Toolboxsnippet_name|Properties.
2. In the Properties dialog box, click Change Icon.
3. In the Pick an Icon dialog box, select a new icon and click OK. Alternatively, click Choose Other,
and browse to the desired image file.
Using Snippets 77
Komodo User Guide
4. In the Properties dialog box for the snippet, click OK. The custom icon is displayed next to the
snippet.
1. In the Projects or Toolbox sidebar, right-click the desired snippet and select Properties.
2. Click Reset, then click OK. The default icon is displayed next to the snippet.
To assign a key binding to a snippet, right-click the snippet on either the Toolbox, and select Properties.
Select the Key Bindings tab, and configure the desired binding. See Key Bindings for Custom Components
for more information.
Creating Tabstops
Tabstops are set in snippets and templates using a similar syntax to bracketed interpolation shortcuts. The
simplest type just provides a placeholder for inserting text:
[[%tabstop]]
Adding a colon followed by any string provides a default value (or just a helpful name):
[[%tabstop:myValue]]
Numbered tabstops are linked together in the buffer. Text replacements in one numbered tabstop will be
replicated in tabstops with the same number. Linked tabstops should use the same default string or omit the
default string once it's been defined in the first linked tabstop:
print <<"[[%tabstop1:EOT]]";
[[%tabstop:TextHere]]
[[%tabstop1]]
Using Tabstops
When the snippet or template is inserted or loaded in the buffer, the tabstops will show the default text (i.e.
specified after the colon) highlighted in the buffer. Hitting the Tab key cycles the cursor through the tabstops
in the order they appear in the snippet or template (not in numbered order).
With the cursor on a tabstop, typing overwrites the default value (if defined). Hitting Tab again inserts the
default value and moves to the next tabstop.
Examples
This "blank" PHP function snippet uses numbered tabstops. This is what it looks like when defined in the
snippet:
/*
* function [[%tabstop1:name]]
* @param [[%tabstop2:arg]]
*/
function [[tabstop1:name]]($[[%tabstop2:arg]]) {
Tabstops 79
Komodo User Guide
[[%tabstop]];
}
/*
* function name
* @param $arg;
*/
function name($arg) {
The "name" tabstop is the first place Tab will stop. It gets replaced with the function name which is
propagated through the rest of the snippet when Tab is hit again. The "arg" tabstop is the next place Tab
stops, and is treated the same way. The unnamed tabstop is invisible in the buffer, but hitting Tab again will
move the cursor to its position.
<[[%tabstop1:div]]>[[%s]]</[[%tabstop1:div]]>
<div>[[%s]]</div>
Hitting Tab after insertion will select the first "div" for replacement. If it is replaced, the closing tag will be
changed as you type. If it is not replaced, "div" will be used as the element type.
Examples 80
Macros
Macros are scripts which automate Komodo. They are stored toolboxes and can be launched by
double-clicking the macro icon, pressing an associated custom key binding, or by binding them to event
triggers.
The Macros toolbar provides quick access for recording, running, and saving macros. To show or hide the
toolbar, select View|Toolbars|Macros. You can also use the Tools|Macros menu items.
Creating Macros
Macros can be created by recording keystroke and command sequences, or written from scratch in JavaScript
or Python using the Macro API.
Recording Macros
Recording is a simple method for creating a macro. Only keystrokes (not mouse movements) are recorded.
To record a macro:
1. Select Tools|Macros|Start Recording (or use the Record Macro button in the Macro toolbar). The
Komodo status bar displays "Recording Macro".
2. In the Editor Pane, enter the keystrokes to store in the macro. While entering keystrokes, pause
recording by selecting Tools|Macros|Pause Recording. Select Start Recording when ready to
resume macro creation.
3. To end macro recording, select Tools|Macros|Stop Recording. The status bar displays "Macro
Recorded".
Note: Though keystrokes in the Editor pane can be captured and recorded in this manner, several Komodo
commands cannot. If your resulting macro does not replay certain operations, you may be able to add them
manually by editing the recorded macro. Consult the Writing Macros section in conjunction with the
Command ID List and the Macro API for further information.
1. Select Tools|Macros|Save to Toolbox, or click Macro: Save to Toolbox on the Macro Toolbar.
2. Give the new macro a unique name in the Enter name for new macro field. A reference to the macro
is automatically added to the Toolbox.
Writing Macros
Use the "New Macro" Properties dialog box to write macros in either Python or JavaScript. This dialog box
has tabs for specifying key bindings and Komodo event triggers that invoke the macro automatically.
To add a macro:
1. Select Add New Macro... from the Toolbox drop-down menu or a folder's right-click context menu.
2. Language: Specify the language (Python or JavaScript) in which to program the macro.
3. Set any desired macro properties.
Macros 81
Komodo User Guide
4. Write the macro in the editor field or save what you have so far by clicking OK. You can open it in an
editor tab by right-clicking on the macro icon and selecting Edit Macro. This is useful as it provides
autocompletion and other Komodo editing features.
Refer to the Macro API for information about writing JavaScript and Python macros in Komodo.
Running Macros
To run the most recently recorded macro, select Tools|Macros|Execute Last Macro. If the Macro Toolbar is
open (View|Toolbars|Macro), click Macro: Run Last Macro.
To run a macro that has been saved to a project or toolbox, double-click the macro or use the key binding you
have assigned to it. Alternatively, right-click the macro and select Execute Macro.
Managing Macros
Macros can be dragged into any toolbox or toolbox folder. Right-clicking on a macro brings up a context
menu with the following additional options:
Macro Properties
Right-click on a macro and select Properties to view or edit the macro or configure the following properties.
If the macro is in a toolbox, the assigned keybinding will always trigger the macro. If it's in a project, the
keybinding will work only when that project is open.
Writing Macros 82
Komodo User Guide
To revert to the default icon for a selected macro, use the Reset button.
If a macro is not associated with a Komodo event, it can run either in the foreground or in the background.
Macros that perform "editor" functions or modify open files should always run in the foreground to "block"
and prevent user interference. This prevents the user from moving the cursor and disrupting the macro
currently in progress.
Check to make sure macro triggers are enabled in the Projects and Workspace preferences. In the Triggering
Macros area, select Enable triggering of macros on Komodo events, and then click OK.
Trigger macros run with an argument called "subject", available as a global variable within the macro. This
variable references the ko.views.manager.currentView object for post-open, pre/post-save, and pre-close
trigger macros. For post-close macros, it references the URI since the view object is empty at that point. For
example, in a macro with an "After file open" trigger you could use:
Komodo macros that use the event triggers "Before file save", "Before file close", or "On shutdown", can
make use of return values. Macros that return that return a true value (e.g. True in Python, true in
JavaScript) can interrupt the process under execution. For example, the following JavaScript macro triggering
"Before file save" prevents you from saving files on Sunday:
The interfaces for the two macro languages are described separately:
• JavaScript Macros
• Python Macros
Warning
The macro system is a powerful mechanism by which Komodo users can execute arbitrary code inside the
Komodo process. It is easy for novices to write macros that can significantly disrupt Komodo's behavior,
leading to instability and data loss. Avoid experimenting with macros while working with important files.
Of particular note:
• Macros that never terminate (for example, due to infinite loops) can hang Komodo.
• Macros that modify the buffer should never be run in the background, as multiple threads accessing
the editor object could cause crashes.
• Macros that modify the scimoz object should be written with care, to avoid data loss.
Feedback
The Komodo JavaScript API is under active development. If you have questions or feedback about the API,
please post to the Komodo Macros and Extensions forum.
The API described below may change in future releases (we will of course try to minimize
backwards-incompatible changes).
JavaScript Macros
For macros, the most important parts of the Komodo JavaScript API are:
Macro API 85
Komodo User Guide
ko.views.manager.currentView.scimoz
The ko.views.manager.currentView.scimoz object corresponds to the main text editing widget
that contains and manipulates files in the Editor Pane. It is a thin wrapper around the Scintilla widget, an
open-source component written by Neil Hodgson (www.scintilla.org).
The Scintilla API is large, complex and subject to change. This document only contains the calls most
relevant to Komodo, and notes some common patterns of use relevant to changing the editor widget.
scimoz Attributes
int currentPos
The location (in character units) of the caret.
int anchor
The location (in character units) of the selection anchor.
string text
The contents of the buffer.
string selText
The contents of the selection (readonly).
long scrollWidth
The width of the scroll area (in pixels).
long xOffset
The horizontal scroll position (in pixels) of the start of the text view.
boolean viewEOL
Whether to show end-of-line markers or not.
long viewWS
Whether to show whitespace characters (0: no, 1: yes).
long eOLMode
The characters that are inserted when the user presses 'Enter': either 'CRLF' (0 - the default on
Windows), 'CR' (1) or 'LF' (2 - the default on Linux).
long tabWidth
The size of a tab as a multiple of the size of a space character.
long indent
The size of indentation in terms of the width of a space.
boolean useTabs
Whether indentation should be created out of a mixture of tabs and spaces (1) or be based purely on
spaces (0).
boolean indentationGuides
Whether to show indentation guides or not.
readonly long firstVisibleLine
The line number of the first visible line in the text view.
long lineCount
The number of lines in the text view.
long textLength
The length of the current buffer in characters.
long targetStart
JavaScript Macros 86
Komodo User Guide
scimoz Methods
void emptyUndoBuffer()
Empty the undo buffer.
void undo()
Undo the last action.
void cut()
Cut current selection (ko.commands.doCommand('cmdCut') is the preferred method).
void copy()
Copy current current selection.
void paste()
Replace current selection with the clipboard contents.
void clear()
Clear current selection.
long replaceTarget(in long length, in string text)
Replace the target text with the argument text. Text is counted so it can contain NULs. Returns the
length of the replacement text..
string getTextRange(in long min, in long max)
Return a range of characters from the current buffer.
void insertText(in long pos, in string text)
Insert text at a specified position.
void colourise(in long start, in long end)
Force the re-coloring of the specified range.
wchar getWCharAt(in long pos)
Get the (Unicode) character at the specified position.
void addText(in long length, in string text)
Add text to the end of the current buffer.
void selectAll()
Select the entire buffer.
void gotoLine(in long line)
Jump to the specified line.
void gotoPos(in long pos)
Jump to the specified position in the buffer.
void deleteBack()
Delete the character to the left of the cursor.
void newLine()
Add a newline (note: this is a less 'smart' newline than can be obtained using
ko.commands.doCommand('cmd_newlineExtra').
void redo()
Redo the last action.
boolean canRedo()
There is an action that can be redone.
void beginUndoAction()
Begin an undo block (see note).
void endUndoAction()
scimoz Attributes 87
Komodo User Guide
End an undo block (see note).
long getColumn(in long pos)
Get the column (0-based) of the specified position.
long getLineEndPosition(in long line)
Get the position corresponding to the last character on the specified line (not including EOL
characters).
void setSel(in long start, in long end)
Make selection start at start and end at end.
long lineFromPosition(in long pos)
Get the line number (0-indexed) from character position pos.
long positionFromLine(in long line)
Get character position which begins the specified line.
void lineScroll(in long columns, in long lines)
This will attempt to scroll the display by the number of columns and lines that you specify. Positive
line values increase the line number at the top of the screen (i.e. they move the text upwards as far as
the user is concerned). Negative line values do the reverse.
void scrollCaret()
If the current position (this is the caret if there is no selection) is not visible, the view is scrolled to
make it visible.
long lineLength(in long line)
Return the length of the current line.
void replaceSel(string)
Replace current selection with the text in the string.
void lineDown()
Move cursor down one line.
void lineDownExtend()
Extend selection down one line.
void lineUp()
Move cursor up one line.
void lineUpExtend()
Extend selection up one line.
void charLeft()
Move cursor one character to the left.
void charLeftExtend()
Extend selection one character to the left.
void charRight()
Move cursor one character to the right.
void charRightExtend()
Extend selection one character to the right.
void wordLeft()
Move cursor one word to the left.
void wordLeftExtend()
Extend selection one word to the left.
void wordRight()
Move cursor one word to the right.
void wordRightExtend()
Extend selection one word to the right.
void home()
Move cursor to the Home position.
void homeExtend()
Extend selection to the Home position.
scimoz Methods 88
Komodo User Guide
void lineEnd()
Move cursor to the end of the line.
void lineEndExtend()
Extend selection to the end of the line.
void documentStart()
Move cursor to the start of the document.
void documentStartExtend()
Extend selection to the start of the document.
void documentEnd()
Move cursor to the end of the document.
void documentEndExtend()
Extend selection to the end of the document.
void pageUp()
Page up.
void pageUpExtend()
Extend selection one page up.
void pageDown()
Page down.
void pageDownExtend()
Extend selection one page down.
void editToggleOvertype()
Toggle overtype mode.
void vCHome()
Move cursor to the first non-whitespace character on a line or, if none, the beginning of a line.
void vCHomeExtend()
Extend the selection to the first non-whitespace character on a line or, if none, the beginning of a line.
void zoomIn()
Increase font size.
void zoomOut()
Decrease font size.
void delWordLeft()
Delete word to the left of the cursor.
void delWordRight()
Delete word to the right of the cursor.
void lineCopy()
Copy line at the cursor.
void lineCut()
Cut line at the cursor.
void lineDelete()
Delete line at the cursor.
void lineTranspose()
Transpose current line and previous line.
void lineDuplicate()
Duplicate current line.
void lowerCase()
Convert selection to lower case.
void upperCase()
Convert selection to upper case.
void lineScrollDown()
Scroll display down one line.
void lineScrollUp()
scimoz Methods 89
Komodo User Guide
Scroll display up one line.
void deleteBackNotLine()
Delete last character except if at beginning of line.
void homeDisplay()
Move cursor to Home position for the current display line (as opposed to the buffer line when word
wrap is enabled).
void homeDisplayExtend()
Extend selection to the Home position for the current display line (as opposed to the buffer line when
word wrap is enabled).
void lineEndDisplay()
Move cursor to end of the current display line (as opposed to the buffer line when word wrap is
enabled).
void lineEndDisplayExtend()
Extend selection to the end of the current display line (as opposed to the buffer line when word wrap
is enabled).
void wordPartLeft()
Move cursor a word segment to the left. Word segments are marked by capitalization
(aCamelCaseIdentifier) or underscores (an_under_bar_ident).
void wordPartLeftExtend()
Extend selection a word segment (as described in void wordPartLeft()) to the left.
void wordPartRight()
Move cursor a word segment (as described in void wordPartLeft()) to the right.
void wordPartRightExtend()
Extend selection a word segment (as described in void wordPartLeft()) to the right.
void delLineLeft()
Delete to beginning of line.
void delLineRight()
Delete to end of line.
void paraDown()
Move cursor one paragraph down.
void paraDownExtend()
Extend selection one paragraph down.
void paraUp()
Move cursor one paragraph up.
void paraUpExtend()
Extend selection one paragraph up.
scimoz Notes
Invalid Parameters: The Scintilla API assumes that users of the API do their own error-checking. Passing
arguments that are out of bounds or otherwise erroneous can result in Komodo crashing.
The Undo Stack: Scintilla manages the "undo" stack. To treat a sequence of operations as a single operation
for the sake of Undo/Redo, wrap these operations in a beginUndoAction / endUndoAction pair. The
endUndoAction must be called even in the case of an exception in the code. Otherwise, the undo stack will
be corrupted and might lose data.
ko.views.manager.currentView.scimoz.beginUndoAction()
try {
scimoz Notes 90
Komodo User Guide
... // do your sequence here
} finally {
ko.views.manager.currentView.scimoz.endUndoAction()
}
ko.views.manager.currentView.koDoc
The ko.views.manager.currentView.koDoc object refers to the current document; the contents of
the file being edited. These contents will be different than those of the file on disk if the file is unsaved or
"dirty".
koDoc replaces the document object present in Komodo 5 and previous versions. If you need to write
macros compatible with earlier versions, use capability-detection style code such as:
JavaScript
Python
koDoc Attributes
string baseName
The basename of the document (e.g. "myfile.txt").
string displayPath
The display path of the document (e.g. "C:\Code\myfile.txt").
file
The koDoc.file object corresponding to the document (null if the document is unsaved).
string buffer
The contents of the document (Unicode string).
boolean isDirty
Whether there are unsaved changes to the document.
boolean isUntitled
Whether the document has never been saved.
string language
The language that this document is viewed as ("Python", "Perl", etc.
ko.views.manager.currentView.koDoc.file
The file object is an attribute of koDoc objects, and corresponds to a wrapper object around the file object.
document.file attributes
string URI
The URI to the file (e.g. "file:///C:/Code/myfile.txt").
string displayPath
The display path of the file (e.g. "C:\Code\myfile.txt"), or the URI if the URI is not of the
file:// scheme.
string baseName
ko.views.manager.currentView.koDoc 91
Komodo User Guide
ko.commands.doCommand()
Signature:
ko.commands.doCommand(commandId)
Command IDs and their corresponding functions are available in the Command ID reference.
Most editor-related commands require that the Editor Pane be in focus. To ensure focus before invoking
doCommand, set the focus explicitly as follows:
ko.views.currentView.setFocus()
ko.open.URI()
Signature:
ko.open.URI(uri_string#line_number)
Open the file specified by the URI string and move the cursor to the line number specified after '#' (if any).
All file access protocols used by Komodo are valid. For example:
ko.open.URI("file:///home/user/example.txt#33");
ko.open.URI("ftp://example.org/pub/example.xml");
ko.open.URI("scp:///host.example.org/home/user/file.txt#11");
ko.projects.findPart()
Signature:
Find a "part" (the internal name for a component such as a snippet, another macro, a run command, etc) in the
Toolbox or a project.
document.file attributes 92
Komodo User Guide
♦ "DirectoryShortcut"
• name: The component's name.
• where: A string corresponding to the component container that should be searched. Supported values
are:
"toolbox"
search in the Toolbox
"shared toolbox"
search in the Shared Toolbox (if enabled)
"toolboxes"
search in both the Toolbox and the Shared Toolbox
"container"
search the project or Toolbox that contains the current macro
"*"
search all of the above
ko.interpolate.interpolateString()
Signature:
ko.interpolate.getWordUnderCursor()
Signature:
This function returns the word under the cursor in the current buffer.
ko.run.runEncodedCommand()
Signature:
• window: Required (literal) argument indicating Komodo's top-level window object. This allows the
method to be called from dialog boxes or other sub-windows.
• command: The shell command to run. Can include arguments in Python dict format.
• callback: An optional callback function.
For example:
ko.projects.findPart() 93
Komodo User Guide
function did_it() {
alert("Done.");
}
ko.run.runEncodedCommand(window, 'sleep 5', did_it);
Command options and environment variables can be added in curly braces "{...}" after the command in
Python dict format. For example:
ko.run.runEncodedCommand(window,
'svn up "%F" {"cwd": "%D", "env": "SVN_SSH=plink.exe"}')
The following JavaScript macro uses Komodo's cmd_refreshStatus function as the callback in
ko.run.runEncodedCommand(). This updates the SCC status information after running 'svn up' on
the file in the current editor tab:
if (komodo.view) {
komodo.view.setFocus();
ko.run.runEncodedCommand(window,
'svn up "%F"',
(function (view) {
return function () {
view.setFocus();
komodo.doCommand('cmd_refreshStatus');
}
})(komodo.view)
);
};
Python Macros
Macros written in Python can use the XPCOM interface. Though it is deprecated, komodo. namespace is
still available for those functions (interpolate() and getWordUnderCursor()) which cannot be
done easily with XPCOM.
To use the XPCOM components described below, add the following to your macro:
The view object will have the same properties as ko.views.manager.currentView, exposing:
ko.run.runEncodedCommand() 94
Komodo User Guide
Opening a URI
To open a URI:
Interpolate a string
There is currently no equivalent in XPCOM for evaluating interpolation codes. This can be done using the old
komodo namespace as follows:
import komodo
komodo.interpolate()
Some interpolation shortcuts cannot be used within Python macros. These include %P and %ask, and the
:orask modifier on other shortcuts. A ValueError is raised if they are used.
import komodo
komodo.getWordUnderCursor()
Find a part
To find other components (snippets, run commands, other macros, etc):
Code Browser
Go to Definition cmd_codeBrowserGoToDefinition
Locate current scope... cmd_codeBrowserLocate
Code
Clean Line Endings cmd_cleanLineEndings
Clear Syntax Errors/Warnings cmd_lintClearResults
Collapse All Folds cmd_foldCollapseAll
Collapse Fold Recursively cmd_foldCollapseRecursive
Collapse Fold cmd_foldCollapse
Comment Region cmd_comment
Complete Word (backwards) cmd_completeWordBack
Complete Word cmd_completeWord
Convert Selection to Lower Case cmd_convertLowerCase
Convert Selection to Upper Case cmd_convertUpperCase
Convert the Selected Text from Hexadecimal cmd_convertFromHex
Convert the Selected Text to Hexadecimal cmd_convertToHex
Expand All Folds cmd_foldExpandAll
Expand Fold Recursively cmd_foldExpandRecursive
Expand Fold cmd_foldExpand
Go to Definition cmd_goToDefinition
Jump to Matching Brace cmd_jumpToMatchingBrace
Jump to corresponding line cmd_jumpToCorrespondingLine
Match Braces cmd_braceMatch
Debugger
Add Watch Variable cmd_dbgAddVariable
Add/Edit Breakpoint... cmd_dbgBreakpointAddOrEdit
Add/Edit Spawnpoint... cmd_dbgSpawnpointAddOrEdit
Break Now cmd_dbgBreakNow
Clear All Breakpoints cmd_dbgBreakpointClearAllInURI
Delete Selected Variable cmd_dbgDeleteVariable
Detach cmd_dbgDetach
Disable/Enable Breakpoint cmd_dbgBreakpointToggle
Edit Selected Variable Name cmd_dbgWatchedVariable
Edit Selected Variable Value cmd_dbgEditVariable
Go/Continue cmd_dbgGo
Inspect (probe) the Application in a Debugger Shell cmd_dbgInspect
Interactive Debugger Shell Clear Buffer cmd_dbgInteractiveClearBuffer
Listen for Remote Debugger cmd_debuggerListener
Load HTML Preview cmd_dbgViewAsHTML
Make Selection a Watched Variable cmd_dbgMakeWatchedVariable
New Session cmd_dbgNewSession
Pretty Print cmd_dbgPrettyPrint
Run Script cmd_dbgRun
Run to Cursor cmd_dbgStepCursor
Show Current Statement cmd_dbgShowCurrentStatement
Show Hidden Variables cmd_dbgShowHiddenVars
Start Default Interactive Shell cmd_startInteractiveShell
Start Perl Interactive Shell cmd_startPerlInteractiveShell
Start Python Interactive Shell cmd_startPythonInteractiveShell
Start Ruby Interactive Shell
Code 98
Komodo User Guide
cmd_startRubyInteractiveShell
Start Tcl Interactive Shell cmd_startTclInteractiveShell
Start/Find/Hide Default Interactive Shell cmd_toggleInteractiveShell
Step Forward cmd_dbgStepForward
Step In cmd_dbgStepIn
Step Out cmd_dbgStepOut
Step Over cmd_dbgStepOver
Stop the Interactive Debugger Shell cmd_dbgInteractiveStop
Stop cmd_dbgStop
Document Outline
Locate Current Node cmd_documentOutlineLocateCurrentNode
Show/Hide Details cmd_documentViewerToggleDetail
Editor
Add as Snippet to Toolbox cmd_makeSnippetFromSelection
Back cmd_back
Backspace cmd_backSmart
Beginning of Line (first visible char/first column) cmd_home
Beginning of Line cmd_homeAbsolute
Cancel AutoComplete cmd_cancel
Clear Current Tabstop State cmd_tabstopClear
Close All Buffers cmd_closeAll
Close Current Buffer cmd_bufferClose
Close Other Buffers cmd_bufferCloseOthers
Copy Region cmd_copyRegion
Copy cmd_copy
Create a Mapped URI for the current buffer cmd_createMappedURI
Current File Settings cmd_editPrefsCurrent
Cut Line cmd_lineCut
Cut Region cmd_cutRegion
Cut rest of line cmd_killLine
Cut cmd_cut
Decrease Line Indent cmd_dedent
Delete Blank Lines cmd_deleteBlankLines
Delete Line cmd_lineDelete
Debugger 99
Komodo User Guide
Editor 100
Komodo User Guide
Editor 101
Komodo User Guide
Editor 102
Komodo User Guide
Editor 103
Komodo User Guide
Editor 104
Komodo User Guide
Fast Open
Go to File... cmd_goToFile
Find
Find Next Result cmd_findNextResult
Find Next Selected cmd_findNextSelected
Find Next cmd_findNext
Find Previous Selected cmd_findPreviousSelected
Find Previous cmd_findPrevious
Find in Current Project... cmd_findInCurrProject
Find in Files... cmd_findInFiles
Find... cmd_find
Incremental Search Backwards cmd_startIncrementalSearchBackwards
Incremental Search cmd_startIncrementalSearch
Replace in Current Project... cmd_replaceInCurrProject
Replace in Files... cmd_replaceInFiles
Replace... cmd_replace
General
Close Project cmd_closeProject
Create Template From Project... cmd_saveProjectAsTemplate
Edit Properties cmd_editProperties
Export Selection as HTML... cmd_exportHTMLSelection
Export as HTML... cmd_exportHTML
Import From File System into Current Project cmd_importFromFS_Project
Least Recently Viewed File cmd_bufferNextLeastRecent
Most Recently Viewed File cmd_bufferNextMostRecent
New File (default type) cmd_new
New File... cmd_newTemplate
New Project From Template... cmd_newProjectFromTemplate
New Project... cmd_newProject
New Window cmd_newWindow
Next File cmd_bufferNext
Open File dialog... cmd_open
Open Project... cmd_openProject
Open Remote File dialog... cmd_open_remote
Open Template... cmd_openTemplate
Perform the import from file system again (refreshes) cmd_reimportFromFS_Project
Preferences... cmd_editPrefs
Find 106
Komodo User Guide
Help
About Komodo cmd_helpAbout
ActiveState Programmer Network cmd_helpASPN
ActiveState Website cmd_helpActiveState
Alternate Help on Selection cmd_helpLanguageAlternate
Help... cmd_helpHelp
Komodo Bug Database cmd_helpViewBugs
Komodo Community
General 107
Komodo User Guide
cmd_helpCommunity
Komodo Discuss Mailing List Archives cmd_helpKomodoMailLists
Language-Specific Help on Selection cmd_helpLanguage
PHP Mailing Lists cmd_helpPHPMailingLists
PHP Reference (Web) cmd_helpPHPRef_Web
Perl Mailing Lists cmd_helpPerlMailingLists
Perl Reference (Local) cmd_helpPerlRef_Local
Perl Reference (Web) cmd_helpPerlRef_Web
Python Mailing Lists cmd_helpPythonMailingLists
Python Reference (Local) cmd_helpPythonRef_Local
Python Reference (Web) cmd_helpPythonRef_Web
Ruby Mailing Lists cmd_helpRubyMailingLists
Ruby Reference (Web) cmd_helpRubyRef_Web
Show Keybindings... cmd_helpShowKeybindings
Start Page cmd_openStartPage
Tcl Mailing Lists cmd_helpTclMailingLists
Tcl Reference (Local) cmd_helpTclRef_Local
Tcl Reference (Web) cmd_helpTclRef_Web
Tip of the Day... cmd_helpTipOfTheDay
XSLT Mailing Lists cmd_helpXSLTMailingLists
XSLT Reference (Web) cmd_helpXSLTRef_Web
Macro
End Recording cmd_stopMacroMode
Execute Last Macro cmd_executeLastMacro
Pause Recording cmd_pauseMacroMode
Save to Toolbox cmd_saveMacroToToolbox
Start/Resume Recording cmd_startMacroMode
Help 108
Komodo User Guide
PDK
Launch Filter Builder cmd_pdkLaunchFilterBuilder
Launch PerlApp cmd_pdkLaunchPerlApp
Launch PerlCov cmd_pdkLaunchPerlCov
Launch PerlCritic cmd_pdkLaunchPerlCritic
Launch PerlCtrl cmd_pdkLaunchPerlCtrl
Launch PerlNET cmd_pdkLaunchPerlNET
Launch PerlSvc cmd_pdkLaunchPerlSvc
Launch PerlTray cmd_pdkLaunchPerlTray
Launch VBScript Converter cmd_pdkLaunchVBScriptConverter
Places
Copy the file or folder from its parent. cmd_copyPlaceItem
Cut the file or folder from its parent. cmd_cutPlaceItem
Filter out typically unwanted items like dotfiles. cmd_placeView_defaultView
Load Place... cmd_openDirectory
Load Remote Place... cmd_openRemoteDirectory
Load previous place cmd_goNextPlace
Manage custom view filters. cmd_placeView_customView
Move this item to the system trash. cmd_deletePlaceItem
Paste the file or folder into this folder. cmd_pastePlaceItem
Reload next place cmd_goPreviousPlace
Rename file or folder cmd_renamePlace_File
Search in this file/folder's directory. cmd_findInPlace
Show file/folder in the system's file manager cmd_places_showInFinder
View everything. cmd_placeView_viewAll
Projects/Toolbox
Add New File From Template... cmd_addNewFileFromTemplate
Add New File... cmd_addNewFile
Add New Folder... cmd_addFolderPart
Add Remote File... cmd_addRemoteFilePart
PDK 109
Komodo User Guide
Publishing
Create a New Configuration cmd_publishingNewConfiguration
Diff Selected Places Files cmd_publishingPlacesDiffFile
Show Changes (Diff) for the Current File cmd_publishingDiffCurrentFile
Source Code
Vi: Decrease Line Indent cmd_vim_dedent
Vi: Increase Line Indent cmd_vim_indent
Vi: Jump to Matching Brace cmd_vim_jumpToMatchingBrace
Spell Check
Check Spelling... cmd_checkSpelling
TDK Communit
DK Community cmd_tdkCommunity
Publishing 110
Komodo User Guide
TDK
Launch Tcl Package Editor cmd_tdkLaunchTclPE
Launch TclApp cmd_tdkLaunchTclApp
Launch TclCompiler cmd_tdkLaunchTclCompiler
Launch TclInspector cmd_tdkLaunchTclInspector
Launch TclSvc cmd_tdkLaunchTclSvc
Launch TclVFSE cmd_tdkLaunchTclVFSE
Launch TclXref cmd_tdkLaunchTclXref
Toolbox
Export Package cmd_toolboxExportPackage
Tools
HTTP Inspector cmd_httpInspector
Run Command... cmd_toolsRunCommand
Runs the current test plan selected in the Test tab cmd_runCurrentTestPlan
Rx Toolkit cmd_toolsRx
Watch File... cmd_toolsWatchFile
User Interface
Browser Preview cmd_browserPreview
Focus on Bottom Pane cmd_focusBottomPane
Focus on Editor cmd_focusEditor
Focus on Projects Pane cmd_focusProjectPane
Focus on Toolbox Pane cmd_focusToolboxPane
Focus other split editor pane cmd_switchpane
Full Screen cmd_viewFullScreen
Internal Browser Preview in Other Tab Group cmd_browserPreviewInternal
Internal Browser Preview in Same Tab Group cmd_browserPreviewInternalSameTabGroup
Move tab to a new window cmd_moveTabToNewWindow
Move tab to another tab window cmd_movetab
Open tab in a new window cmd_openTabInNewWindow
Replace in Place
Replace in place cmd_replaceInPlace
Komodo includes templates for a number of languages languages, and lets you create and use your own.
Templates can contain Interpolation Shortcuts or Tabstops. They can be stored in a project or in the Toolbox
for quick access, and shared via the Common Data Directory.
To create a new file from a template file, in the New File dialog box, select the category in the Left Pane, then
double-click the template name in the Right Pane. A new file is created in the Komodo editor using the code
stored in the template.
When using the New File button on the Standard Toolbar, the template (if any) associated with the language
in the new files preferences is used to create the new file.
Alternatively, templates can be stored in a project or the Toolbox, and can be associated with a key binding.
1. Create Template File: In Komodo, create a file with the desired contents for the template.
2. Save as Template: Select File|Save As Template.
Custom templates are stored in the "My Templates" folder (as displayed in the Save File dialog box). Due to a
Komodo bug (41829), OS X users must navigate manually to:
Optionally, create shortcuts (on Windows), aliases (Mac OS X) or symlinks (on Linux or Mac OS X) in the
"My Templates" directory structure that point to files located elsewhere on the system. Files should have an
extension that allows Komodo to correctly detect the language (according to the settings configured in
Komodo's File Associations preference).
If you create a directory alongside My Templates with the same name as a template group that already
exists in Komodo (such as Common or Web), the contents of the two directories are merged. If files of the
same name exist in both directories, the file in the directory at the same level as My Templates is used.
For example:
Templates 113
Komodo User Guide
templates\
My Templates\ <--directory
MyCGI.pl <--file in the My Templates directory
TestSystem.tcl <--file in the My Templates directory
Corporate <--shortcut/symlink to corporate templates
Common\ <--directory
Python.py <--file; takes precedence over the Python.py template
MyCGI.pl <--file; displays in the Common folder
To edit an existing template, select File|Open|Template File. The directory containing the My Templates
directory (and any "merge" directories, as described above) is displayed. Select the desired template and make
the desired changes.
For example, if a template file contains the interpolation shortcut [[%date:%d/%m/%Y %H:%M:%S]],
when a new file is created from that template, the interpolation shortcut is converted to the current date and
time in the following format: 27/06/2004 11:10:21.
Interpolation shortcuts within templates use the bracketed syntax. Refer to the interpolation shortcut section
for a complete description of the code, syntax and usage.
Project Templates
Just as template files contain the basic structure for new files, project templates provide a basic framework for
new projects.
To create a new project from a project template, click Project|New From Template and choose from one of
the available templates.
To save any project as a template, click Project|New From Template|Create Template From Project... and
select a location to save the template (e.g. the My Templates directory).
Komodo ships with project templates for, Ruby on Rails, Komodo Extensions, and Firefox Extensions.
Template Options
Right-click a template to access the following options:
• Open Template: Use this option to create a new file from the selected template.
• Cut/Copy/Paste: Used to duplicate or move a template when dragging is not convenient (e.g. to a
project which is currently closed).
• Show in File Manager: Shows the JSON file for the template in the system's default file manager.
• Export as Zip File...: Exports the template in a standard ".zip" archive.
• Rename: Changes the template name.
• Delete: Permanently removes the selected template from the toolbox.
1. On the Projects or Toolbox tab, right-click the desired template and select Properties.
2. Click Reset, then click OK. The default icon is displayed next to the template.
Refer to Adding, Removing and Managing Tools for instructions on adding components a Toolbox. In
addition, URL shortcuts can be created by dragging a URL from a browser address bar or from a Komodo tab
onto a project or Toolbox. URLs must be preceded by "http://".
To open a URL, double-click the URL name (which opens the URL in an external browser), use the assigned
key binding, or right-click the URL and select Open URL in browser or Open URL in tab.
• Open URL in browser: Use this option to launch the default web browser (as specified in the Web
and Browser preference) and display the stored URL.
• Open URL in tab: Use this option to display the stored URL in a tab in the Komodo Editor Pane.
• Cut/Copy/Paste: Used to duplicate or move a URL shortcut when dragging is not convenient (e.g. to
a project which is currently closed).
• Show in File Manager: Shows the JSON file for the URL shortcut in the system's default file
manager.
• Export as Zip File...: Exports the URL shortcut in a standard ".zip" archive.
• Rename: Changes the URL shortcut name.
• Delete: Permanently removes the selected URL shortcut from the toolbox.
The default URL shortcut icon can be replaced with custom icons. Komodo includes more than 600 icons;
alternatively, select a custom image stored on a local or network drive (use 16x16-pixel images for best
results).
1. In the Projects or Toolbox sidebar, right-click the desired URL shortcut and select Properties.
2. Click Reset, then click OK. The default icon is displayed next to the URL shortcut.
Custom key bindings can be assigned to URL shortcuts stored in the Toolbox. Use the Key Binding tab in the
URL shortcut's Properties to specify the keystrokes that invoke the URL shortcut. See Key Bindings for
Custom Components for more information.
• Run Commands
Feature Showcase
Run commands are operating system commands run from within Komodo. Use the Run Command dialog box
to interact with the system command line or shell while editing or debugging files in Komodo. Besides
making it easy to run simple and complex custom commands from within Komodo, the Run Command dialog
box can insert the results of shell commands into a document in the Editor Pane, or pass the contents of a
document to the system command line or shell.
To view examples of run commands, see the "Samples" folder in the Toolbox.
Run commands can be stored for re-use in a project or the Toolbox, where they can be assigned key bindings.
Access the last ten commands executed in the Run Command dialog box by selecting Tools|Recent
Commands. The prefixes [i], [l] and [il] indicate that Insert output, Pass selection as input or both were
selected with the original command.
The Run Command dialog box can be toggled between its "simple" or "advanced" form by clicking the
More/Less button.
• Add to Toolbox: If this check box is selected, the command is saved in the Toolbox.
• Start in: Enter the directory where the command should be run, or click the Browse button to
navigate the filesystem. Click the arrow button to the right of the Start in field to select interpolation
shortcuts pertinent to the Start in setting. Interpolation shortcuts are inserted at the current cursor
position in the Run field.
• Run in: Specify the environment in which the command should be run. The options are:
♦ Command Output Tab: The command is run in Komodo's Bottom Pane.
♦ New Console: The command is run in a new shell or command window.
♦ No Console (GUI Application): The command launches the specified application without
displaying output in a shell or on the Command Output tab.
• Do not open output pane: If this check box is selected, the Bottom Pane containing the Command
Output tab does not automatically open when the command is run. To manually view the Bottom
Pane, select View|Command Output. (This option is only accessible if the Run in field is set to
Command Output tab.)
• Parse output with: If this check box is selected, the field to the right is used to enter a regular
expression that parses the output. See Parsing Command Output in the Run Command Tutorial for an
example. (This option is only accessible if the Run in field is set to Command Output tab.)
• Show parsed output as list: If output parsing is configured, select Show parsed output as list to
display the output in list format on the Command Output tab. (This option is only accessible if the
Run in field is set to Command Output tab.)
• Environment Variables: Use the Environment Variables section of the dialog box to configure
new environment variables or change the value of existing environment variables for the duration of
the run. To add or alter an environment variable, click New and configure the following values:
♦ Variable Name: Enter a name for the variable.
♦ Variable Value: Enter a value for the variable.
♦ Interpolation Shortcut: Click the arrow button to the right of the Variable Value field to
insert an interpolation shortcut pertinent to the Variable Value setting. The interpolation
shortcut is inserted at the current cursor position in the Variable Value field.
♦ Add Path: Click this button to insert a directory as the variable value.
• Save advanced options as defaults: If this check box is selected, the current settings are stored as the
defaults for the Run Command dialog box.
If the command prompts for input, enter it directly on the Command Output tab. Output written to "stderr"
(standard error output) is displayed in red at the top of the tab. Click the Close button at the top right of the
Command Output tab to terminate a running command. Click the Toggle Raw/Parsed Output View button
to jump from parsed results to raw output and vice versa. (Parsing is enabled and configured via the Parse
output with field.)
Note: For more information on parsing command output, see the Parsing Command Output section of the Run
Command Tutorial.
To run a command stored in a Toolbox, double-click the run command's name, use the assigned key binding,
or right-click the run command and select Run.
To access run command options for the selected run command, right-click the run command's name. The
options are as follows:
The default run command icon can be replaced with custom icons. Komodo includes more than 600 icons;
alternatively, select a custom image stored on a local or network drive (use 16x16-pixel images for best
results).
1. In the Projects sidebar or Toolbox, right-click the desired run command and select Properties.
Alternatively, single click the run command to highlight it in the sidebar then select
Projects|runcommand_name|Properties or Toolboxruncommand_name|Properties.
2. In the Properties dialog box, click Change Icon.
3. In the Pick an Icon dialog box, select a new icon and click OK. Alternatively, click Choose Other,
and browse to the desired image file.
4. In the properties dialog box for the run command, click OK. The custom icon is displayed next to the
run command.
1. In the Projects or Toolbox sidebar, right-click the desired run command and select Properties.
2. Click Reset, then click OK. The default icon is displayed next to the run command.
Custom key bindings can be assigned to run commands stored in the Toolbox or in a Project. Use the Key
Binding tab in the run command's Properties to specify the keystrokes that invoke the run command. See Key
Bindings for Custom Components for more information.
Any component that can be stored in a Toolbox can be stored in a custom toolbar or menu. They are useful for
exposing, snippets, commands, macros or links which are used often.
Custom toolbars and menus are created within a toolbox. Those in project-specific toolboxes are only
displayed when that project is active; those contained in the global toolbox (i.e. at the top level) are always
displayed.
Custom menus are displayed between the default Tools and Help menus. If multiple custom menus are in
effect, the display order depends on the menu's Priority setting. New menus have a default priority of 100;
alter the priority of custom menus to control the left-to-right order of display.
Custom toolbars are displayed to the right of default Komodo toolbars. If necessary, a new row is created for
their display. If multiple custom toolbars are in effect, the display order depends on the toolbar's Priority
setting. New toolbars have a default priority of 100; alter the priority of custom toolbars to control the
left-to-right order of display.
To assign a letter to be used in combination with the 'Alt' key for menu access, enter a shortcut letter in the
Menu Access Key field. If the letter is already assigned to a Komodo core function, you are prompted to enter
a different letter.
• Perl tutorial
• Python tutorial
• PHP tutorial
• Ruby tutorial
• XSLT tutorial
Feature Showcases
• conditional breakpoints
• XSLT debug view
The Komodo debugger is a tool for analyzing programs on a line-by-line basis, monitoring and altering
variables, and watching output as it is generated. Debugging features include:
The sections that follow contain general information about the debugger that is applicable to each language.
Komodo provides debugging support for Perl, Python, PHP, Ruby, XSLT and Tcl. For information about
configuring languages and language-specific debugger functions, see:
• Debugging Perl
• Debugging Python
• Debugging PHP
• Debugging Ruby
• Debugging Tcl
• Debugging XSLT
Notes
• Be sure you meet the software prerequisites for debugging, as described in the Installation Guide.
By default, the Debugging Options dialog box is displayed (unless the debugger preference has been
configured to start without displaying the dialog box). To override the debugger preference on Windows and
Linux systems, hold down the 'Ctrl' key while invoking the key binding for starting the debug session. (Select
Help|List Key Bindings to view the current key bindings; use the key bindings preference to configure
custom key bindings.) Alternatively, the 'Ctrl' key can be used to suppress the display of the Debugging
Options dialog box.
If multiple files are open in the Editor Pane, the program that is currently displayed is debugged. If no
breakpoints are set, Go/Continue causes the debugger to run to the end without stopping. Step In moves
through the program one line at a time.
By default, the debugger will break on the first line of executable code when it starts. This is useful for adding
breakpoints if none have been set yet. To change this behavior, set Initial break behavior to Run to first
breakpoint in the debugger preferences (Edit|Preferences|Debugger).
Multi-Session Debugging
Komodo supports the concurrent debugging of multiple applications, or multi-session debugging. With
multi-session debugging, Komodo debugs more than one project at a time, regardless of the supported
languages used in the programs being debugged.
When debugging multiple sessions, each session has a unique Debug tab (located in the Bottom Pane) for
controlling the debug actions specific to that process. A Debug tab is created each time a new debugger
session is started. To close a Debug tab, click the X button at the top right corner.
Debugging Options
When the debugger is invoked, the Debugging Options dialog box is displayed. Use this to configure the
system environment, command-line arguments, CGI environment, and other debugging options.
Not all of the debugging options described below apply to all languages. The available tabs and fields depend
on the interpreter used to debug the file. The interpreter is determined by the File Associations configured for
the active file in the Editor Pane.
To suppress the display of the Debugging Options dialog box on Windows and Linux systems, hold down the
'Ctrl' key while clicking the desired debugging button on the Debug Toolbar, or use the desired keyboard
shortcut. Change the default display by selecting Skip debug options dialog from
Edit|Preferences|Debugger.
Global Options
These options are displayed regardless of which configuration tabs are available.
General Tab
• Interpreter Arguments: As required, enter command line options and arguments for the interpreter
in this field. Use the Shortcut button to the right of the input field to select common
language-specific options.
• Script: Enter the name of the script to be debugged. By default, this field contains the full path and
name of the program displayed in the Editor pane. When manually specifying a script, UNC or SMB
paths (which identify remote machines on a local area network via the "\\" prefix) are not supported.
Instead, map the network share to a drive letter (Windows) or mount the share on the filesystem (OS
X and Linux). When set as a Project setting, this is the script that Komodo opens for debugging when
a session is started from any file in the project. This is useful when working in modules which are
called by a 'main' program.
• Script Arguments: As required, enter arguments for the script in this field as they would appear on
the command line. Multiple Arguments must be separated with spaces. If the Simulate CGI
Environment box is selected, and CGI Input variables of the type GET are set, the contents of this
field are ignored.
• Directory: Specify the directory to start the program in. If unset, the program starts in the directory
where it resides.
• Select the input XML file: (XSLT only) Specify the name and location of the input XML file.
• Select the interpreter to use for debugging: (PHP and Tcl only) For Tcl programs, select tclsh or
the wish interpreter, depending on whether you are debugging a console or a GUI application. For
PHP programs, select the CLI (Command Line Interface) or CGI (Common Gateway Interface)
interpreter. These selections reference the interpreters configured under Edit|Preferences... in the
Language Configuration section.
• Select the directory that contains the php.ini file: (PHP only) If more than one version of PHP
exists on the system, specify the directory that contains the php.ini file you wish to use.
• Disable Output Buffering (PHP only): Output from the PHP interpreter is not buffered (it is
displayed as it occurs) if this option is enabled. This option has no effect when Simulate CGI
Environment is selected. To disable output buffering in CGI emulation mode, comment out the
output_buffering setting in php.ini with a ";" character, or set it to "off".
• Enable Implicit Flush (PHP only): The PHP output layer flushes itself automatically after every
output block. If this option is not enabled, output is buffered by the operating system and is flushed
periodically by the operating system, or when the application is finished. This option has no effect
when Simulate CGI Environment is selected.
Environment Tab
The Environment tab displays all environment variables set on the system. Use this tab to add new variables
or change the values of existing variables for the duration of the debug session. The Default Environment
Variables pane displays environment variables that have been declared on your system. The User
Environment Variables pane displays environment variables set in the saved configuration which override
the Default Environment Variables.
Change variables by adding a new variable with the same name and a new value. These changes have no
effect outside of the Komodo debugger and are stored in each saved configuration.
• To Add New Variables: Click New and enter the Variable Name and Variable Value in the
Environment Variable dialog box. To add one or more directories to the Variable Value field, click
Add Path and navigate to the desired directory.
• To Edit Existing Variables: Select the variable, click Edit, then change as desired. This creates a
new variable with the same name and the desired value. (User Environment Variables take
precedence over Default Environment Variables.)
• To Delete a Variable: Select the variable from the User Environment Variables pane and click
Delete. Default Environment Variables cannot be deleted, but can be set to an empty value.
• To Add New Variables: Click New, and enter the Variable Name and Variable Value in the
Environment Variable dialog box. To add one or more directories to the Variable Value field, click
Add Path and navigate to the desired directory.
• To Edit Existing Variables: Select the variable, click Edit, then change as desired. This creates a
new variable with the same name and the desired value. (User CGI Environment Variables take
precedence over Default CGI Environment Variables.)
• To Delete a Variable: Select the variable from the User CGI Environment Variables pane and
click Delete.
• Request Method: Select the request method that has been assigned to the form in the CGI program.
• Post Type: Select the format in which data is sent from the browser to the server.
Use the Request Variable section of the dialog box to create variables that are processed by your CGI
program. These variables are displayed in the Browser Arguments section of the dialog box.
• Type: Specify the type of input associated with the variable (GET, POST, cookie or file).
To alter variables: Click on the desired variable in the Browser Arguments section of the dialog box, make
changes in the Type, Name and Value fields, then click Update.
To delete variables: click on the desired variable in the Browser Arguments section of the dialog box, and
click Delete.
1. Click New...
2. Enter a unique Configuration Name.
3. Click OK.
Existing saved configurations can be selected from the drop-down list. If you wish to delete a saved
configuration, select it from the list and click Delete.
If the file being debugged is part of a project that is currently open, these preferences are saved in that project.
If not, this configuration is automatically saved as part of the file's Properties and Settings (although they
cannot be altered via the file's Properties dialog box).
Spawnpoints are set at points in a Tcl script where you want an external application to execute (spawn). When
a spawnpoint is encountered during the debugging process, Komodo configures the spawned application to
start as a new debugger session. Both the initial and spawned debugger sessions run concurrently. Enabled
spawnpoints appear as solid green arrows in the left margin of the Editor pane and are also listed on the
Breakpoints tab during debugging. Disabled spawnpoints appear as white arrows with a green outline.
Double-clicking an enabled or disabled spawnpoint from the Breakpoints tab opens the associated file in the
Editor pane and shifts focus to the line number coinciding with that spawnpoint location.
• toggle breakpoints
• toggle spawnpoints
• go to source code
• set breakpoint properties
Toggling Breakpoints
Breakpoints and Spawnpoints can be toggled between enabled, disabled and deleted. To toggle a breakpoint,
do one of the following:
• Breakpoint Margin: Click on the line you wish to break at once to enable a breakpoint, a second
time to disable it, and a third time to delete it.
• Debug Menu: Click Enable/Disable Breakpoint once to enable a breakpoint on the current line, a
second time to disable it, and a third time to delete it.
• Keyboard: Press 'F9' ('Cmd'+'\' on Mac OS X) once to enable a breakpoint on the current line, a
second time to disable it, and a third time to delete it.
1. Click the New button and then select New Breakpoint or right-click in the Breakpoints pane and
select Add|New Breakpoint on the context menu.
2. The following Breakpoint Properties are required:
3. ♦ Language: By default, the language of the program being debugged.
♦ File: The location of the file where the breakpoint is being set.
♦ Line: The line number in the file where the spawnpoint is to be set.
♦ Enable: Select the check box to enable the breakpoint.
4. Click OK.
• On the Breakpoints tab, click the Disable/Enable All Breakpoints button. All breakpoints are
disabled if previously enabled, or enabled if previously disabled.
Toggling Spawnpoints
1. Click the New button and then select New Tcl Spawnpoint or right-click in the Breakpoints list and
select Add|New Tcl Spawnpoint on the context menu.
2. The following properties are configurable in the Spawnpoint Properties dialog box:
3. ♦ Language: Tcl
♦ File: The location of the file where the spawnpoint is to be set (for example,
C:\samples\tcl_sample.tcl).
♦ Line: The line number in the file where the spawnpoint is to be set.
♦ Enable: Select the check box to enable the spawnpoint. Deselect the check box to disable the
spawnpoint.
4. Click OK.
• On the Breakpoints tab, click the Disable/Enable All Breakpoints button. All spawnpoints are
disabled if previously enabled, or enabled if previously disabled.
Note: Breakpoints and spawnpoints added or modified while a program is running are not necessarily updated
in the breakpoint manager. To add breakpoints while debugging, interrupt the debugging session using the
Break button to ensure that the new breakpoint is properly updated.
To open the source code in the Editor Pane at the line number where the breakpoint or spawnpoint is set, do
one of the following:
• Breakpoints Tab: Double-click the breakpoint to view the associated source code.
• Breakpoints Tab: Select the desired breakpoint and click the Go to the Source Code button.
Breakpoint Properties
When adding or editing a breakpoint in the Breakpoint tab, a Breakpoint Properties dialog box appears.
This dialog box contains a tab for each available breakpoint type. Change the breakpoint type by switching to
a different tab.
Each tab is split into two parts, separated by a horizontal line. The top section contains configuration items
that are required; the bottom section contains configuration options that are optional. The last item on this tab
is the Enable checkbox.
for 1 in range(256):
print 'hello'
2. Define a hit condition 'Break when hit count is a multiple of'.
3. Enter the value 5. The debugger breaks every 5th time it passes the line with the print
statement.
Not all breakpoint types are supported for all languages. The following table shows breakpoint support by
language:
Forcing a Break
Use the Break Now function to stop debugging an application at the current execution point, and then
continue debugging from that point. For example, use this control when debugging applications running long
processes. To force a break while debugging an application, do one of the following:
Remote Debugging
Komodo can be set to Listen for Debugger Connections continuously. Additionally, you can set remote
debugger preferences and check listener status of the current listener configuration. For instructions on
configuring specific languages for remote debugging, see:
• Debugging Perl
• Debugging Python
• Debugging PHP
• Debugging XSLT
• Debugging Tcl
Consult the language-specific debugging documentation listed above for configuration instructions.
Note: A check mark appears when Listen for Debugger Connections is enabled. Otherwise, this feature is
disabled.
1. On the Debug menu, select Listener Status. The Debugger Listener status screen appears.
2. Click OK after reviewing listener status, or use the associated key binding.
Multi-User Debugging
When multiple users are running Komodo session, configure Komodo's Debugger Connection Options to
listen for debug connections on port "0" (see Set Debugger Preferences). The system provides Komodo with a
unique port each time Komodo is started, allowing multiple users on the system to debug applications
simultaneously. In remote debugging, this requires the remote debugger application to be manually set to
connect on the system-allocated port unless the Debugger Proxy is used.
For example, the file '/www/htdocs/php/info.php' on a server named 'myserver', would send the
following URI to Komodo:
file://myserver/www/htdocs/php/info.php
If 'myserver' was accessible via SFTP, you could add the following mapping in Komodo's Preferences:
URI: file://myserver/www
Path: sftp://user@myserver/apache/www
This mapping would apply to all files in www and its subdirectories.
The Path can include remote files accessed via FTP, SFTP or SCP as well as files on the local filesystem.
Mapped URIs can also be specified by right-clicking on the editor tab and selecting Create Mapped URI
from the context menu. By default, the Path field will show the full path of the file in that editor tab. This
path can be shortened to include more files and directories in the mapping (as above).
Debugger Proxy
Remote debugger processes can communicate with Komodo through the DBGP proxy (debugger protocol
proxy). The proxy allows Komodo to use a system-allocated listener port for debugging without the user
having to manually configure the same port number on the remote debugger. This is useful for running
multiple remote debugging sessions and on networks where a remote debugging process can not connect to
Komodo directly. The proxy can run on the local machine, the remote machine, or a separate machine.
Example
If you are debugging scripts on a remote web server that cannot connect to Komodo directly because of a
firewall, you can run dbgpProxy on an intermediary server (e.g. a gateway) which can connect to Komodo and
the web server on specified ports. The three servers in this example are:
1. workstation: The machine running Komodo. The following preferences are set:
♦ Listen for Debugger Connections is enabled.
♦ Enable Debugger Proxy is selected.
♦ Listen for debug connections on port is set to '0' (use system-assigned port)
♦ Proxy Listener Address is set to gateway:9001
♦ Proxy Key is set to "jdoe"
Debug|Listener Status displays a system-assigned Host Port of 37016.
2.
3. gateway: A gateway server with access to the internal and external networks. The proxy is running
with the following options:
The remote debugger running on 'webserver' (dbgpClient.py in this case) connects to the proxy
(dbgpProxy.py) running on 'gateway'. The proxy uses the IDE Key "jdoe" to connect the debugger process to
the Komodo instance listening with a Proxy Key of "jdoe". The proxy continues to communicate with the
remote debugger on port 9000, but routes the debugging session to Komodo on port 37016.
• Step In: Executes the current statement and pauses at the following statement.
• Step Over: Executes the current statement. If the line of code calls a function or method, the function
or method is executed in the background and the debugger pauses at the statement that follows the
original one.
• Step Out: When the debugger is within a function or method, Step Out will execute the code without
stepping through the code line by line. The debugger will stop on the line of code following the
function or method call in the calling program.
When stepping through a program which calls a function or method from an external program (e.g. a module
or package) the debugger steps into the external program at the point where the function or method is called,
opening it in a new tab. Stepping continues in the external program until the function call is completed.
Note: Perl operators sort, map, and grep behave like other looping constructs with respect to stepping
behavior in the debugger. When Komodo has stopped at one of these operators, Step Over stops at the first
statement or expression used within the first argument of these operators.
For example, if the debugger steps over a statement containing a foreach, while, map, grep, or sort
looping construct that evaluates its body five times, the debugger remains inside that loop for five iterations.
When it steps over on the sixth iteration, the debugger exits the loop and stops at the next statement.
To skip execution of such looping constructs, set a breakpoint on the statement following the construct, and
continue until Komodo reaches that breakpoint.
When debugging more than one session at a time (multi-session debugging), a Debug tab for each session is
accessible in the Bottom Pane. The Debug tab selected is the session currently being debugged. To change to
another debug session, select the Debug tab for that session (identified by the filename of the program). When
a new session is started, a new Debug tab is created and Komodo automatically switches to that new session.
The Debug tab is divided into two sub-panes, which have tabs of their own. The right sub-pane contains the
Output, Call Stack, and HTML Preview tabs. The left sub-pane contains variable tabs.
Viewing Variables
The variables section of the Debug tab is divided into tabs that vary according to the language of the program
being debugged. (Language variations are described below.) Variables with multiple values (such as arrays)
are indicated by plus and minus symbols to the left of the variable name.
To Expand or Collapse Variables: Plus symbols indicate variables with multiple values that can be
expanded; minus symbols indicate variables that can be collapsed. Click on the plus or minus symbol to
expand or collapse the variable list.
To Change Variable Values: Double-click in the variable's Value field and enter the desired value. (The
value of nodes in XML documents cannot be changed.)
While debugging Python programs, variables and objects are displayed on the Locals, Globals, and Code
Objects tabs:
• Locals: Displays variables referenced within the current function. If the program is currently outside
of a function, all variables are displayed.
• Globals: Displays all used program variables.
• Code Objects: Displays an expandable tree view of all classes, functions, and their attributes.
During Python debugging sessions, click the Show Hidden Variables button to display special Python
variables prefixed with double underscores, such as __doc__, __dict__, etc.
While debugging PHP and Tcl programs, variables are displayed on the Locals and Globals tabs:
• Locals: Displays variables referenced within the current function. If the program is currently outside
of a function, all variables are displayed.
• Globals: Displays all used program variables. Note: PHP "Super Globals" ($_POST, $_GET, etc.) are
hidden by default. The Show Hidden Variables button will toggle them on and off.
Perl Variables
While debugging Perl programs, Argument and Special tabs are displayed in addition to the Locals and
Globals tabs listed above.
XSLT Variables
While debugging XSLT programs, data nodes and variables are displayed on the Locals and Globals tabs:
• Locals: Displays data nodes from the input XML document. Only nodes contained in the context of
the template specified in the Call Stack are displayed.
• Globals: Displays xsl:param and xsl:variable elements declared at the top level of the
program.
Watched variables can be added, manipulated and removed regardless of whether the debugger is currently
running.
• Click the Add button on the Watch variables tab and type a variable name in the dialog box
• Select the variable in the editor (or any other drag-and-drop aware application), then drag and drop
the variable into the Watch tab
• Right-click a variable in one of the other variable tabs and select Add to Watch from the context
menu.
The Watch variable tab supports viewing the results of expressions made with watched variables. For
example, in a Perl program with scalar variables $base and $height the following expression could be
entered:
($base / 2) * $height
• Double-click the variable on the Watch variable tab and specify a value. Currently, only the values of
simple variables can be changed. For example, values of variables such as 'a.b[3]' (in Python) or
'$a{b}->[3]' (in Perl) cannot be changed.
• Note: This function is not available for arbitrary expressions.
• Double-click the variable on the Locals or Globals pane and specify a value in the dialog box.
To remove a variable from the Watch variable tab, select the variable and click Delete on the bottom right
toolbar. Alternatively, right-click the desired variable and select Remove Watch on the context menu.
Output Tab
The Output tab is used to view program output and to send input to the program being debugged. The
following standard data streams are handled in the Output tab:
• stderr: errors
• stdin: program input (not supported for Perl or PHP during remote debugging)
When debugging Tcl and Python, if stdin is requested by the program, a red percent character is shown in
the margin of the Output tab.
To view the call stack in a current debugging session, select the Call Stack tab in the right pane of the Debug
tab.
There is one line in this tab per stack frame at any point in the execution of a program. The calling frame
contains the information about a function call, including the filename, the line number, and any parameters or
local variables.
Watching Files
When debugging a program that writes output to another file, or when watching programs execute, you can
watch the output or the log file using Komodo's File Watcher.
The Watch File tool shows a file as the file is being updated on disk. It has no relationship with variable
viewing, except that, while debugging, it is often useful to watch variables change state and files change
content.
To detach application execution from the debugging process, do one of the following:
• Perl Tutorial
Komodo can debug Perl programs locally or remotely, including debugging in CGI and mod_perl
environments. The instructions below describe how to configure Komodo and Perl for debugging. For general
information about using the Komodo debugger, see Komodo Debugger Functions.
Debugger commands can be accessed from the Debug menu, by shortcut keys, or from the Debug Toolbar.
For a summary of debugger commands, see the Debugger Command List.
On the Debug menu or Debug Toolbar, click Go/Continue or Step In to invoke the debugging session. See
Komodo Debugger Functions for full instructions on using Komodo's debugging functionality.
To enable Break Now, include the setting 'async=1' in the PERLDB_OPTS environment variable. This can
be done in Komodo's Environment preferences (Edit|Preferences...|Environment).
Perl remote debugging works on any system that can run the version of perl5db.pl distributed with Komodo.
ActivePerl and most other distributions of Perl (version 5.6 or greater) will work.
Note: If you have the ActiveState Perl Development Kit (PDK) installed, follow the instructions for PDK
users to disable the PDK debugger before continuing.
1. Copy Komodo's perl debugger and its associated libraries to the remote machine by copying the entire
dbgp/perllib sub-directory of the Komodo installation to the new machine, or download a package
from the Komodo Remote Debugging page.
Note: Do not copy perl5db.pl to the standard "lib" directory of the Perl installation on the remote
machine, as this will overwrite the standard perl5db.pl file.
2. On the remote machine, set the PERL5LIB environment variable to the location of the new
perl5db.pl and its libraries. For example, if the remote machine is running Windows and perllib
directory was copied to C:\misc\perllib, set the variable as follows:
set PERL5LIB=C:/misc/perllib
For CGI debugging with IIS, you would also need to set the PERL5DB environment variable as
follows:
Note the forward slashes "/" in place of the regular Windows backslash path separators. This is
optional for PERL5LIB, but necessary for PERL5DB.
Another example: If the remote machine is running Linux or Mac OS X and perllib was copied to the
/home/me/perl/komodo_perl_debugging directory, set the variable as follows:
export PERL5LIB=/home/me/perl/komodo_perl_debugging/perllib
3. On the remote machine, set the PERLDB_OPTS and DBGP_IDEKEY variables. This tells the Perl
interpreter on the remote machine where to connect to Komodo or the DBGP Proxy and how to
identify itself.
PERLDB_OPTS=RemotePort=<hostname>:<port>
DBGP_IDEKEY=<ide_key>
♦ The port number must match the port number specified in Edit|Preferences|Debugger. Click
Debug|Listener Status to check the current port.
♦ Replace <hostname> with the name or IP address of the machine running Komodo.
♦ If DBGP_IDEKEY is unset, the USER or USERNAME environment variable is used as the
IDE Key.
♦ The variable definitions must be on one line.
For example:
Windows Me
Use the MSCONFIG utility (Start|Run|MSCONFIG). Select the Environment tab, and create a new
variable with the Variable Name of PERLDB_OPTS, and the Variable Value of
RemotePort=127.0.0.1:9000.
export PERLDB_OPTS="RemotePort=127.0.0.1:9000"
export DBGP_IDEKEY="jdoe"
Note: As with local debugging, the Break Now function is disabled by default. To enable this button
and functionality, add the option 'async=1' to the PERLDB_OPTS environment variable. For
example, on Windows:
perl -d program_name.pl
Click Step In, or Go/Continue to run to the first breakpoint. See Komodo Debugger Functions for full
instructions on using Komodo's debugging functionality.
Disabling and Enabling the Perl Dev Kit (PDK) Debugger 143
Komodo User Guide
Option 1:
Windows
Linux
export PERLDB_OPTS=
To re-enable the PDK debugger, set the PERL5DB variable to an empty string.
Option 2: (Windows)
These changes take effect in new Command Prompt windows. To re-enable the PDK debugger, delete the
PERL5DB variable, and change the PERLDB_OPTS variable back to its original value.
The settings and paths listed are examples only. Substitute these with the specific paths, hostnames and port
numbers of your server as necessary
Note: The path for the PERL5LIB directory shown above is the correct path in a default installation.
That path must be changed if you have installed Komodo in a different location. Forward slashes, "/",
are used in place of the normal Windows path separator, "\", in the PERL5DB environment variable.
• Modify the Internet Information Services Configuration: A "-d" option must be added to the
Executable Path for the Perl CGI script mapping.
• ♦ IIS 4 and 5:
1. Open the Internet Information Services manager.
2. Select one web site or the entire Web Sites node as desired.
3. Click Action|Properties
4. On the Home Directory tab, click the Configuration button.
5. Add (or modify) an entry for Perl with the following characteristics:
Extension = .pl
Executable Path = c:\perl\bin\perl.exe -d "%s" %s
♦ IIS 6:
1. Open the Internet Information Services manager.
2. Select the Web Service Extensions node.
3. Add (or modify) the Web Service Extension for Perl CGI as above.
♦ IIS 7:
1. Open the Internet Information Services manager.
2. Select the level at which you want the debugger configuration applied (e.g. at the host
level for a specific website).
3. In the center pane in the IIS section, double-click Handler Mappings
4. Add (or modify) an entry for Perl CGI (ActivePerl adds one called "Perl CGI for
.pl"). For example:
⋅ Request path: *.pl
⋅ Executable: C:\Perl\bin\perl.exe -d "%s" %s
• Reboot: The system must be rebooted for the changes to take effect. Environment variables are not
updated by restarting the IIS service.
• Modify the httpd.conf file: The following values can be configured for a specific virtual host or all
hosts. Add the following values in the appropriate sections:
• Modify the Perl Script: Add the "-d" flag to the "shebang" line:
#!/perl/bin/perl -d
Debugging mod_perl
Debugging mod_perl handlers is similar to debugging any Perl program remotely (see Debugging Perl
Remotely to familiarize yourself with the terminology). Debugging mod_perl is different in that you'll
typically invoke the code indirectly with a web browser, and that the Perl code is running inside an Apache
web server.
1. Copy the entire dbgp/perllib sub-directory of the Komodo installation to a convenient directory on the
server, or download and unpack the Perl Remote Debugging package from the Komodo Remote
Debugging page. If you are running Apache on your local workstation, you can use Komodo's copy
directly (e.g. <Komodo-install-dir>/lib/support/dbgp/perllib ) for the following steps. Note: Do not
copy perl5db.pl to the standard "lib" directory of the Perl installation on the remote machine, as this
will overwrite the standard perl5db.pl file.
2.
3. In the directory containing perl5db.pl, create a new directory called Apache. For example:
$ cd Komodo/lib/support/dbgp/perllib
$ mkdir Apache
4. Create a symlink or shortcut to perl5db.pl within the new Apache directory. For example:
$ cd Apache
$ ln -s ../perl5db.pl .
5. Install the Apache::DB perl module on the server:
$ cpan Apache::DB
6. Add the following snippet to your httpd.conf file (replace "/path/to/dbgp/perllib" with the full path to
the directory containing perl5db.pl):
<Perl>
use ModPerl::Registry;
use lib qw(/path/to/dbgp/perllib);
$ENV{PERLDB_OPTS} = "RemotePort=localhost:9000 LogFile=stderr";
use Apache::DB ();
Apache::DB->init;
</Perl>
Make sure that RemotePort is set to the hostname and port Komodo using to listen for debugger
connections (see the PERLDB_OPTS setting in the "Configure the Remote Machine" section of
Debugging Perl Remotely).
7. You will probably already have a <Location> section in httpd.conf (or apache.conf) for your perl
scripts. Add the following line to that section:
For example:
<Location /perl-bin>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options +ExecCGI
PerlOptions +ParseHeaders
PerlFixupHandler Apache::DB
</Location>
8. Restart Apache in debug mode (e.g. apache -X), and open the page you wish to debug in a
browser.
• Python Tutorial
Komodo can be used to debug Python programs locally or remotely, including debugging in CGI
environments. The instructions below describe how to configure Komodo and Python for debugging. For
general information about using the Komodo debugger, see Komodo Debugger Functions.
Debugger commands can be accessed from the Debug menu, by shortcut keys, or from the Debug Toolbar.
For a summary of debugger commands, see the Debugger Command List.
Note: Breakspoints will not work with the Psyco Python extension enabled. The Komodo FAQ has a
work-around solution.
On the Debug menu or Debug Toolbar, click Go/Continue or Step In to invoke the debugging session. See
Komodo Debugger Functions for full instructions on using Komodo's debugging functionality.
Windows
<komodo-install-directory>\lib\support\dbgp\pythonlib\
<komodo-install-directory>\lib\support\dbgp\bin
Linux
Mac OS X
<komodo-install-directory>/Contents/SharedSupport/dbgp/pythonlib/
<komodo-install-directory>/Contents/SharedSupport/dbgp/bin
1. The Python remote debugging package requires the logging package, which is included in Python
2.3 and later. However, if you have Python 2.2 (the earliest supported version), you must download
and install the logging package. To verify that the logging package is installed correctly, run the
following command:
If this command prints the word "ok", you can move to the next step. If this command results in an
ImportError, you need to resolve the error before continuing.
2. Download and unzip the Komodo-PythonRemoteDebugging package for your platform and Komodo
version from the Komodo Remote Debugging page.
3. Set up your Python installation so the dbgp Python package is on your PythonPath. You can do this
by copying the dbgp directory to the site-packages directory of your Python installation.
Alternatively, you can copy the dbgp directory to a convenient location, and then add that directory to
your PYTHONPATH environment variable. For example, on Windows, if you copied the files to a
directory called C:\debugger, enter the following at the command line:
set PYTHONPATH=%PYTHONPATH%;C:\debugger
If this command prints the word "ok", you can move to the next step. If this command results in an
ImportError then you need to resolve the error before continuing.
4. Put the bin\pydbgp.py script (bin/pydbgp on Linux and Mac OS X) somewhere convenient. This is the
main script that you run to start a remote debugging session.
Tip: Placing the pydbgp.py script in a directory that is on your PATH environment variable, makes the script
easier to run. On Windows, also make sure that your PATHEXT environment variable includes .py. On Linux
and Mac OS X, ensure that the pydbgp script is executable by running this command:
pydbgp --help
If the setup is correct, the internal help documentation for running pydbgp is displayed.
Note: The debugging client relies on certain core python library files (e.g. sys, os, getopt, socket,
types). If you have added custom modules to your python site-packages, PYTHONPATH or sys.path with
the same name as those imported by pydbgp, the debugger may not work properly.
All methods require that the Python remote debugger client package is installed on the remote machine (see
Installing the Python Remote Debugger).
1. On the Debug menu, ensure that Listen for Debugger Connections is checked.
2. Log in to the remote machine. (Note: the "remote" machine can be the same machine on which
Komodo is running.)
3. On the remote machine, run the pydbgp.py driver program with the appropriate options:
where host:port identifies the port on which Komodo is listening. By default, Komodo listens for
remote debugger connections on port 9000. For example, if the "remote" machine is the same
machine on which Komodo is running, start a debugging session with this command:
Other options for using the pydbgp.py driver are available by running:
If you are connecting to a DBGP Proxy, you must specify an ide_key value with the -k option to
pydbgp.py. Listener port and DBGP Proxy settings are configurable via Edit|Preferences|Debugger.
Select Debug|Listener Status to view the current settings.
To break into a remote debugging session directly from within your Python code:
1. On the Debug menu, ensure that Listen for Debugger Connections is checked
2. Import and use the brk() function in the dbgp.client module to set a hard breakpoint. For
example, the following simple Python script will break into a debugging session when execution
reaches the brk() call:
• host: machine running Komodo or the DBGP Proxy (uses localhost if unspecified)
• port: port to connect on (uses 9000 if unspecified)
• idekey: key used to identify the debugging session to Komodo or the DBGP Proxy (uses the value of
the USER or USERNAME environment variable if unspecified)
"Just-in-time debugging" allows the remote debugger to connect to Komodo if an uncaught exception occurs
during execution (i.e. if a Python exception reaches the top level of your Python program). By adding the
following lines of code to the beginning of your script, you can trap and explore the execution state of your
Python program when an exception reaches the top level:
If and when an exception reaches the top level of your Python program, a post-mortem debugging session is
started in Komodo at the line at which the exception is raised. The debug session is automatically placed in
interactive mode so that you can inspect the current program environment, exactly like a Python interactive
shell.
The brkOnExcept() function takes the same arguments as brk(). As with brk(), brkOnExcept()
attempts to connect to localhost on port 9000 with an idekey of USER or USERNAME if no arguments
are specified.
CGI Debugging
To debug CGI applications written in Python:
• Configure Python to be used as the CGI (or embedded extension) for your Web server. For
information on configuring Python, refer to the Python documentation.
• Follow the steps outlined in Using dbgp.client Functions in Python Programs to call the Python
remote debugger from within the application. Start the remote application through a web browser
instead of running it from the command line.
• PHP Tutorial
Komodo can be used to debug PHP programs locally or remotely. Remote PHP debugging encompasses all
types of PHP debugging not initiated from within Komodo, including debugging PHP scripts running under a
local web server.
The instructions below describe how to configure Komodo and PHP for debugging. For general information
about using the Komodo debugger, see Komodo Debugger Functions.
Debugger commands can be accessed from the Debug menu, by shortcut keys, or from the Debug Toolbar.
For a summary of debugger commands, see the Debugger Command List.
Komodo uses a PHP debugger extension called Xdebug that must be installed for Komodo to debug PHP
scripts. Komodo automatically configures itself to use Xdebug for local PHP debugging, but the configuration
must be done manually for remote PHP debugging. Pre-built binaries named "php_xdebug.dll" (for Windows)
or "xdebug.so" (for Linux and Mac OS X) are provided with Komodo and are also available for download
from the Komodo Remote Debugging page.
See www.xdebug.org/install.php for instructions on compiling Xdebug from source on other platforms.
Installing PHP
PHP debugging in Komodo will work with PHP 4.4 or later, with the exception of versions 5.0.0 through
5.0.2. If you are using PHP 5.0, you will need at least 5.0.3 or greater. Download PHP from
http://www.php.net/downloads.php.
To debug PHP scripts in a web environment, be sure PHP is operating correctly with your web server before
configuring the debugger extension. Consult the PHP documentation for details on configuring PHP with
various web servers.
Windows
If you are unfamiliar with the installation of PHP, we recommend using the Windows InstallShield package.
To install the PHP executable or SAPI module manually, see the PHP website. Be sure that the PHP directory
is included in your system's PATH.
Linux
Your Linux system may already have PHP installed. Login and type 'php -v' to determine the version of your
current PHP interpreter. If it is earlier than version 4.3.11 (or 5.0.0 through 5.0.2) you must upgrade. PHP
must also support loading dynamic extensions (the default for PHP under Linux). If it does not, reinstall PHP
as per the instructions on the PHP website.
When installing PHP to a non-default directory, you must add the following argument to the ./configure
command:
--with-config-file-path=/path/to/php.ini
where /path/to/php.ini is the full path to the directory where the php.ini file is located.
Mac OS X
Although both the Jaguar and Tiger releases of OS X include a version of PHP, it is recommended that you
obtain a more recent version. Either build from source code, or download a PHP module for OS X's Apache
web server from www.entropy.ch/software/macosx/php/.
When debugging locally, certain environment variables are not available, such as those provided by the CGI
environment. However, it is possible to simulate a CGI environment by specifying CGI environment variables
and CGI input in the Debugging Options dialog box. It is is not necessary to install a web server to use
Komodo's local debugging features. Once you have configured PHP to use the debugger extension as
described below, you can debug your scripts by opening a PHP file and using Komodo Debugger Functions.
If you receive an error message when attempting to debug a PHP script, check the PHP troubleshooting
section of the Komodo FAQ.
Linux 153
Komodo User Guide
To run the script to the first breakpoint, from the Debug menu, select Go/Continue.
See Komodo Debugger Functions for full instructions on using Komodo's debugging functionality.
When a PHP script is run through a web browser, the web server uses the PHP interpreter to execute the
script. If PHP is configured for remote debugging, the server contacts Komodo to start a debugging session.
Komodo controls the debugging (e.g. stepping and breakpoints) once the session starts. CGI variables are
available, as are all other variables that are available when running PHP under a web server.
Though remote PHP debugging allows PHP scripts to be run in their true environment, it may be slower than
local PHP debugging.
Single User Remote PHP Debugging: In single user remote debugging, PHP is configured to always look for
a specific instance of Komodo on a specific machine. This configuration requires no changes to the PHP
script. Your web server and your instance of Komodo can be on one machine or two machines
Multi-User Remote PHP Debugging: When multiple users need to debug PHP scripts on a single web
server, use the DBGP Proxy with the remote PHP debugging instructions below. While it is possible to
configure Apache with Virtual Hosting, it is easier to configure multi-user remote PHP debugging with the
proxy.
Remote PHP debugging must be configured manually. The following procedure assumes that you have
already installed PHP.
Before debugging PHP scripts in Komodo, PHP must be configured to use the Xdebug extension
(php_xdebug.dll or xdebug.so).
Find the appropriate extension for the version of PHP you are running and manually copy it into a directory
on the server that the PHP interpreter and web server can access. The Xdebug files can be found in the php
sub-directory of the Komodo installation. For example:
Windows
• File: php_xdebug.dll
• Location:
<komodo-install-directory>\lib\support\php\debugging\<PHP-version> or
Linux
• File: xdebug.so
• Location:
<komodo-install-directory>/lib/support/php/debugging/<PHP-version>/
or the Komodo Remote Debugging page.
Mac OS X
• File: xdebug.so
• Location:
<komodo-install-directory>/Contents/SharedSupport/lib/support/php/debuggin
or the Komodo Remote Debugging page.
In the downloadable packages, the extensions are found in version-specific subdirectories of the unpacked
archive.
The Xdebug extension does not have to be installed in the PHP extension_dir because its location is
specified explicitly in php.ini (see below).
Open the php.ini configuration file on the server. There may be multiple copies of this file, so check the value
of "Loaded Configuration File" in the phpinfo() output to see which one is being used by the web server
(e.g. create a phpinfo.php file containing the line '<?php phpinfo(); ?>' in a web server directory, then
open the corresponding URL in a browser).
• Windows
The php.ini configuration file is generally in your operating system directory (e.g. C:\WINDOWS or
C:\WINNT) or in the same directory as php.exe (e.g. C:\PHP). Check phpinfo() as described
above if you cannot find the file or have multiple copies.
zend_extension_ts or zend_extension
Should be set to the full path to the xdebug library on your system. Use zend_extension_ts
("thread safe") on Windows PHP <= 5.2, else zend_extension for Windows PHP >= 5.3 and for
all other platforms (i.e. Mac, Linux).
xdebug.remote_enable
Enables remote debugging.
xdebug.remote_handler
Should be set to dbgp for use with Komodo.
xdebug.remote_mode
Set to req to have the script connect to Komodo when it starts. Set to jit to connect only on an
error condition (see PHP Just-in-Time Debugging / Break on Exception).
xdebug.remote_host
Set to the hostname or IP address of the computer running Komodo or the DBGP Proxy. Use
'localhost' or '127.0.0.1' if Komodo and the web server are running on the same system.
xdebug.remote_port
Set to the same value as the debugging listener port configured in the Debugger Connection
preferences (or the system assigned Host Port displayed under Debug|Listener Status)
xdebug.idekey (optional)
If you are using the DBGP Proxy, set this to the Proxy Key configured in the Debugger Connection
preferences.
Once the php.ini file is updated, verify that Xdebug is configured by checking the output of phpinfo()
(described in Step 2). There should be an Xdebug section in the alpabetical list of modules which shows all of
the relevant settings.
Note: Recent versions of PHP are set to buffer program output by default. While debugging, it is useful to
disable output buffering so that results of print and echo statements can be seen immediately when
stepping through code. To disable output buffering, comment out the output_buffering setting in
php.ini with a ";" character, or set it to "off".
1. Ensure PHP is installed and configured properly for your web server.
2. Ensure Komodo and PHP are configured for remote debugging (as described in "Configuring Remote
PHP Debugging").
3. Click Debug | Listen for Debugger Connections.
4. In your browser, enter the URL of the script you want to debug. Append
?XDEBUG_SESSION_START=1 to the end of the URL (an HTTP GET with a true boolean value).
For example:
http://example.org/sample.php?XDEBUG_SESSION_START=1
If you are using the DBGP Proxy, the value for the GET method should match the Proxy Key value
shown in Debug|Listener Status. For example:
http://example.org/sample.php?XDEBUG_SESSION_START=jdoe
Note: This is only required for the first request. After that, Xdebug tracks the debugging session with
a cookie. For more information on how this works, see
www.xdebug.org/docs-debugger.php#browser_session
5. A PHP debugging session starts in Komodo. On the Debug menu, click Step In or Go/Continue to
run to the first breakpoint.
On Windows:
On Linux/Mac OS X:
php -f sample.php
5. A PHP debugging session will start in Komodo. Click Step In to start stepping through the script or
Go/Continue to run to the first breakpoint.
On Windows:
On Linux/Mac OS X:
php -f sample.php
4. A PHP debugging session will start in Komodo. On the Debug menu, Click Step In to start stepping
through the script or Go/Continue to run to the first breakpoint.
Output from the debug session appears in the Bottom Pane of the Komodo Workspace. Komodo does not
support a console for remote debugging. The browser will not show the script output until debugging is
complete.
On the Debug menu, select Stop or pass the XDEBUG_SESSION_STOP=1 variable by appending it to the
URL or adding it to a form (as with XDEBUG_SESSION_START=1 above).
See Komodo Debugger Functions for full instructions on using Komodo's debugging functionality.
If you receive an error message while debugging a PHP script that is not caused by the errors in the script
itself, check the PHP troubleshooting section of the Komodo FAQ.
Using xdebug_break()
The xdebug_break() function is used to hard-code a break in a PHP program. It can be used instead of a
Komodo breakpoint. For example:
<?php
echo "<p>Breaks after this line.</p>";
xdebug_break();
echo "<p>Breaks before this line.<p>";
?>
This function breaks the code during a debugging session but will not initiate a new session. Use
xdebug_break() in conjunction with the methods described above for starting debugging sessions.
Xdebug Logging
To log xdebug sessions on the server, add the following line to the xdebug config section of the php.ini
configuration file:
xdebug.remote_log=/tmp/xdebug.log
You can replace "/tmp/xdebug.org" with any writable directory and the filename of your choice.
To turn this on, change the xdebug.remote_mode setting in php.ini from 'req' to 'jit' or override the
setting in your code:
<?php
ini_set('xdebug.remote_mode', 'jit');
...
?>
Whenever an exception is thrown, a debugging session is initiated with a break at the line that caused the
problem.
This may generate a lot of breaks if PHP is configured with verbose error handling (e.g.
error_reporting = E_ALL). In PHP 5, you can define your own Exception class which enables JIT
debugging only for specific exceptions:
<?php
class KoException extends Exception
{
function __construct($message, $code = 0) {
ini_set('xdebug.remote_mode', 'jit');
parent::__construct($message, $code);
}
}
• Ruby Tutorial
Komodo can debug Ruby programs locally or remotely. The instructions below describe how to configure
Komodo and Ruby for debugging. For general information about using the Komodo debugger, see Komodo
Debugger Functions.
Debugger commands can be accessed from the Debug menu, by shortcut keys, or from the Debug Toolbar.
For a summary of debugger commands, see the Debugger Command List.
On the Debug menu or Debug Toolbar, click Go/Continue or Step In to invoke the debugging session. See
Komodo Debugger Functions for full instructions on using Komodo's debugging functionality.
Note: Mac OS X users may have to install a more recent version of Ruby (1.8.4 or greater). Linux users on
x86_64 systems will need to install a 64 bit version of the ruby-debug library (see the Komodo FAQ entry
for more information).
1. Install the Ruby debugger application and associated files on the remote machine. All of these files
are included in /lib/support/dbgp/rubylib beneath the Komodo installation directory
(/Contents/SharedSupport/dbgp/rubylib on ac OS X). Copy rdbgp.rb and the contents of the DB
directory to a convenient location on the remote machine. Note:Some of these files are shared library
files (.so), which are platform specific. If your Komodo installation is on a different platform,
download the Komodo-PythonRemoteDebugging package for the appropriate platform and Komodo
version from the Komodo Remote Debugging page.
2. Start Komodo on the local machine.
3. On the remote machine, set the dbgdir variable to specify the location of the remote mahcine
directory where you copied rdbgp.rb and its associated files.
Windows
set dbgdir=<Path_To_rbdbgp.rb>
Linux/Mac OS X
dbgdir=<Path_To_rbdbgp.rb>
4. On the remote machine, set the RUBYDB_OPTS variable his supplies the Ruby interpreter with the
information that is necessary to connect to the Komodo application running on the local machine.
Windows
set RUBYDB_OPTS=remoteport=<ServerName>:<Port>
set RUBYOPT=
Linux/Mac OS X
export RUBYDB_OPTS=remoteport=<Server_Name>:<Port>
unset RUBYOPT
5. Start the debugger and open the program that you want to debug.
6. Windows
Linux/Mac OS X
The remote file will open in Komodo with the debugger stopped at the first line of executable code. A
yellow arrow indicates the current position. You can now set breakpoints in this file, step through, and
use other Komodo debugging features as if it were a local file. However, you cannot modify the file.
ENV['RUBYDB_OPTS'] = 'remoteport=<Server_Name>:<Port>'
$:.push('<Path_To_rdbgp.rb>')
require 'rdbgp'
The first two lines set up the environment for remote debugging (similar to steps three and four above). The
third line loads the debugger which breaks immediately by default.
Once the debugger has been loaded, subsequent breaks can be specified in the program with the
Debugger.current_context.stop_next function. It's a good idea to wrap this function in a begin
... end block in case the module wasn't loaded:
begin;
Debugger.current_context.stop_next = 1;
rescue Exception;
These in-code breakpoints can be easily toggled by changing the boolean value (i.e. 1 = enabled, 0 =
disabled).
• Set a breakpoint on the first line of the main file, and start the debugger with Go instead of the Step
Into.
• In Komodo's Environment preferences, set the RUBYOPT environment variable an empty string.
• When you start the debugger, choose the Environment tab in the Debugging Options dialog box, add
a new entry for RUBYOPT in the User Environment Variables box, and leave its value empty.
Windows
Linux/Mac OS X
The remote files will open in Komodo with the debugger stopped at the first line of executable code. A yellow
arrow indicates the current position. You can now set breakpoints in this file, step through, and use other
Komodo debugging features as if it were a local file. However, you cannot modify the file.
Debugger commands can be accessed from the Debug menu, by shortcut keys, or from the Debug Toolbar.
For a summary of debugger commands, see the Debugger Command List.
Note: Tcl Beta releases contain only version-specific executables (e.g. tclsh85.exe and wish85.exe).
Komodo does not automatically find these in the path. To use them, specify them manually in the Interpreters
section of the Tcl language preferences rather than selecting Find on Path.
To start a local Tcl debugging session, click Go/Continue or Step In on the Debugger menu or toolbar. See
Komodo Debugger Functions for full instructions on using Komodo's debugging functionality.
Windows
<komodo-install-directory>\lib\support\tcl
Linux
<komodo-install-directory>/lib/support/tcl
Mac OS X
<komodo-install-directory>/Contents/SharedSupport/tcl
This application is also available for download from the Komodo Remote Debugging page.
1. In Komodo, select Listen for Debugger Connections from the Debug menu.
2. Log in to the remote machine.
3. On the remote machine, run the dbgp_tcldebug executable from the command line. To specify
command line arguments for the script that you are debugging, simply add those arguments to the end
of the command, after the dbgp_tcldebug arguments.
♦ -dbgp: Sets the hostname (or IP address) and port where Komodo or the DBGP Proxy is
running. In Komodo, select Debug|Listener Status to check the current port setting.
♦ -app-file: Specifies the Tcl program to debug. Program arguments should follow a "--"
delimiter after the Tcl program name (e.g. ... -app-file test.tcl -- arg_0
arg_1).
♦ -app-shell: Sets the path to the Tcl interpreter (tclsh or wish).
♦ -help: Displays a complete list of options.
4. A Tcl Debug tab opens in Komodo. Click Step In, or Go/Continue) to run to the first breakpoint (see
Komodo Debugger Functions for full instructions).
• The file dbgp_tcldebug.exe has been copied into the C:\remote_debug directory.
• The Tcl file to be debugged is called test.tcl and is located in the current working directory.
• The Tcl interpreter is C:\Tcl\bin\wish.exe.
Local Machine:
• XSLT Tutorial
Komodo does not need to be manually configured for local XSLT debugging. It uses the libxslt and libxml
libraries directly to transform XML documents into HTML, text, or other XML document types. See
www.libxml.org for more information on this XML C parser and toolkit.
For general information about debugging with Komodo, see General Debugger Functions. Debugger
commands can be accessed from the Debug menu, by shortcut keys, or from the Debug Toolbar. For a
summary of debugger commands, see the Debugger Command List.
The XSLT program, the input XML file, and the results of the transformation appear simultaneously. By
default, Komodo splits the Editor pane horizontally.
A yellow arrow on the breakpoint margin shows the current line of execution in both the XSLT and XML file.
Breakpoints can be set in the both files before starting the debugging session, or while stepping through the
code.
• Step In: Executes the current XSL element or template line and pauses at the following line.
• Step Over: Not applicable. Behaves the same as Step In.
• Step Out: When the debugger is within an XSL element, Step Out will execute the entire block
without stepping through the code line by line. The debugger will stop on the line following the
Though the current line is highlighted in both the XSLT and XML files, the stepping behavior is only
applicable to the XSLT file.
To create a project-specific test plan, right-click on a project and select Create New Test Plan....
Project-specific test plans can be edited and managed in the project preferences.
To edit an existing test plan, select the test plan from the drop list in the Test Results tab and click the Edit
Current Test Plan button.
Project-specific test plans can be run by right-clicking on the project to bring up the context menu, then
selecting the test plan from the Test sub-menu.
To copy or move a global test plan into the current document's preferences, select Tools|Test|Move Global
Test Plans to Document. This opens the "Import Global Test Plans" dialog. Select the desired test plans and
click Move (deletes the global test plans), or Copy (leaves them available for other documents).
Transactions highlighted in the Transaction table are displayed in detail in the Request and Response panes
below.
Alternatively, set Komodo to start the HTTP Inspector proxy automatically at startup. Under
Preferences|HTTP Inspector, select Run HTTP Inspector in the background when Komodo starts up. If
you want to run the Inspector on a port other than 8080 (the default) specify it in the Listen on port field.
If you are working behind a web proxy (i.e. at your network gateway) you can specify the hostname and port
of the proxy for the HTTP Inspector to forward connections through. Select Enable proxy forwarding and
enter the hostname and port (e.g. host.example.org:18080) of the proxy. If no port is specified
Komodo will attempt to use port 8080.
Debugging HTTP connections may require you to switch back and forth from using the Inspector to making a
direct connection to the internet. If this is the case you may find it useful to configure a separate browser for
debugging HTTP, or use a browser plugin (e.g. SwitchProxy Tool for Firefox) that allows you to change your
proxy configuration quickly.
Note: The HTTP Inspector does not unencrypt HTTPS (encrypted) sessions.
Break on Request/Response
Selecting Break on every Request or Break on every Response in the toolbar will stop on the
appropriate part of the next transaction. The request or response can then be edited before being submitted.
The current break state of the transaction will appear in the State column in the main Inspector window.
Editing a Request/Response
All fields, headers and data buffers in the Request and Response panes are editable in the relevant break
state.
If the response is returned in a compressed format (i.e. the response headers contain a "gzip"
content-encoding) the unzipped data will be displayed in the data buffer. If any modifications are made, the
data will be re-compressed before being passed back to the browser.
When modifying request or response data, the content-length header will be automatically modified to match
the length of data in the corresponding data buffer.
Rules
Rules perform specified actions when a certain HTTP request or response is detected. They can be created
(New...), edited (Edit...), removed (Delete) and ordered (Move Up and Move Down). The order of the rules
can be important as all matching rules are processed sequentially.
Rules 174
Interactive Shell Komodo IDE only
Tutorial
• Python Tutorial
Feature Showcase
• interactive shell
Komodo's interactive shell implements individual language shells within Komodo. Shells are used to directly
communicate with the specified language interpreter.
Statements, expressions, and code fragments can be entered independent of program files. The shell can be
used as a stand-alone interactive tool or as a shell that interacts from within a debugging session.
• prototyping code
• identifying bugs
• experimenting with a library
• programming interactively
• learning new syntax
The interactive shell supports history recall, AutoComplete and CallTips (Tcl only), and custom colors and
fonts.
The interactive shell supports history recall, AutoComplete and CallTips (Tcl only), and custom colors and
fonts.
Each Komodo interactive shell is associated with a corresponding interpreter and is thus language-specific.
Each time a command or multi-line string is entered into the Shell tab, that code is sent to the corresponding
interpreter for evaluation. The interpreter evaluates the command, and then returns output and error text.
• Select Tools|Interactive Shell, and then select the desired language (Python, Tcl, Perl, or Ruby).
Alternatively, click the down arrow for the Shell button on the Workspace toolbar and select the
desired language.
The interactive shell opens in a Shell tab in the Bottom Pane beside the Command Output and Breakpoint
tabs.
• On the active Debug tab, click the Inspect (>>) button on the Debug toolbar, or select
Debug|Inspect. The Debug tab toggles to a Shell tab. Enter code as desired. To toggle back to the
Debug tab, click the Inspect button on the Debug Toolbar.
View debugging and code inspection functions by clicking the "Collapse/Expand Pane" button at the left side
of the Bottom Pane. This splits the shell into a left and right pane. The left pane performs debugging functions
while the right pane contains the interactive shell.
Komodo can also detect when further data is required at the command prompt. When insufficient
programming data is entered at the prompt, Komodo displays a language-dependent "more" prompt. This
prompt indicates that the language interpreter requires more information before the code can run. Once
enough data is entered, Komodo executes the code and the standard language-dependent input prompt returns.
Python 2.2.2 (#37, Nov 25 2002, 13:15:27) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
>>>
The following example shows a series of Python statements with resulting output:
With an error:
With an error:
Use the Perl shell to enter function definitions, long strings, and specify if and while blocks interactively.
The Perl shell also handles multiple line input delimited by braces, curly braces, single quotes, and double
quotes. The following examples demonstrate this usage.
% $b = 'abc
> def
> ghi
> jkl'
abc
def
ghi
jkl
%
Example: Using curly braces "{}" to define a function and enter multiple line input.
% sub foo {
> my $arg = shift;
> my $arg2 = shift;
> return $arg + $arg2;
> }
% foo(10, 12)
22
%
% $name = 'Bob'
Bob
% print qq(<html><head><title>
> Browser Window Caption Text
> </title></head><body bg="white">
> <p>Welcome to my fine web site, $name
> </body>
> </html>)
<html><head><title>
Browser Window Caption Text
</title></head><body bg="white">
<p>Welcome to my fine web site, Bob
</body>
</html>
%
% $first_long_variable_name = 3
3
% $second_long_variable_name = 4
4
% $third_long_variable_name_to_store_result = $first_long_variable_name + \
> $second_long_variable_name
7
When more information is required for execution (e.g. within any flow control construct) or when requesting
user input, a "*" is displayed. No prompt is displayed when program output is sent to the screen.
> mylist = []
[]
> for x in (0..3)
* puts "Enter a value:"
* mylist[x] = gets.chomp!
* end
Enter a value:
*
> mylist[wrong]
undefined local variable or method `wrong' for main:Object
• Code Browser: A sidebar in the left pane that displays a hierarchical view of all code constructs (for
example, variables, methods, imports) in all open files. In the Code Browser, symbols can be sorted
and filtered; the current scope of a symbol can be located. To access the Code Browser, click
View|Tabs & Sidebars|Code Browser.
•
• AutoComplete and CallTips: The Code Intelligence system is used to drive autocomplete and calltip
functionality for Perl, Python, Ruby, JavaScript, Tcl, XSLT, CSS, HTML and XML.
The Python Tutorial demonstrates the Code Browser and other Code Intelligence tools. See the Python
Tutorial to explore a Python program in Komodo.
where it is declared.
• Locate all variables used within a file.
• View a symbol definition signature.
• Find all defined symbols matching a pattern.
Context Menu
Right-click in the Code Browser Pane to access code searching options. The following options are available:
• Go to Definition: Jumps to the definition of the associated symbol in the editor. Alternatively,
double-click the symbol name in the Code Browser tree. Objects defined within the file, in
user-defined modules, and in the site library are accessible in this way; objects defined in a language's
standard library are not. (See also Editor: Navigating within Files)
• Copy: Copies the symbol name to the clipboard.
• Sort By File Order: Sorts all symbols in the tree by file order.
• Sort Alphabetically: Sorts all symbols in the tree alphabetically.
Sorting
Use the Sort By button to organize all Code Browser symbols by file order or alphabetically. To sort all
symbols by file order, click Sort By, and then select Sort By File Order from the drop-down list. To sort all
symbols alphabetically, click Sort By, and then select Sort Alphabetically from the drop-down list.
Alternatively, use the context menu (right-click in the Code Browser) to access sorting options.
Use the Locate Current Scope button to find the scope of a symbol (for example, namespace, command, or
variable definition). To view the scope of a symbol, place the cursor on the desired symbol in the source code
and then click the Locate Current Scope button. The Code Browser tree opens to the associated scope.
Alternatively, click Navigation|Locate Current Scope in Code Browser to open the Code Browser tree to
the associated scope.
Filtering Symbols
The Filter Symbols text box limits the Code Browser display to matching symbols. To filter symbols in the
Code Browser, enter the desired symbol name, or partial name, in the text box. The filter supports regular
Press 'Tab' to switch focus between the Filter text box and the Code Browser tree. Press 'Esc' to clear the
current filter pattern.
• If the window focus is on the DOM Viewer, it moves the cursor in the editor tab to the node selected
in the DOM Viewer.
• If the window focus is on the editor tab, it finds the node in the tree corresponding to the current
cursor position in the document.
The Show/hide attributes button toggles the visibility of element attributes. Attributes are hidden by default.
For example, when viewing an HTML document, entering table in the Filter box might limit the tree view
to the <table ...> element and the parent <body> and <html> elements. If a node matching the search
string is found in a collapsed branch, the branch is automatically expanded.
For documents that use namespace prefixes, like XSLT, use the format prefix:element-name in the search (e.g.
xsl:template).
The Filter box uses the XPath syntax supported in Python's ElementTree.
DOM Resources
More information on various aspects of the Document Object Model can be found here:
• W3C DOM Recommendations: The canonical source for DOM Technical Reports (specifications).
• What does each DOM Level bring?: Abstracts of the three DOM Level specs by Fabian Guisset.
• W3 Schools XML DOM Tutorial: A straightforward tutorial with links to an XML DOM object
reference and examples. See also their HTML DOM Tutorial.
• CVS
• Subversion (SVN)
• Perforce (P4)
• Git
• Mercurial (Hg)
• Bazaar (bzr)
From within Komodo, you can perform the following SCC actions:
Depots, repositories, branches, and projects cannot be created or configured from within Komodo. This must
be done using the SCC software directly. Komodo's SCC features become available when files are checked
out from the source code repository.
Komodo can work in conjunction with external graphial SCC clients such as TortoiseCVS and TortoiseSVN,
and P4Win. However, the command line executables (i.e. cvs, svn and p4) must be present on the local
system.
• Toolbox Context Menu: Right-click a file in the Toolbox to access the Source Control menu
options. Source code control functions can also be performed on Folders in the Toolbox; right-click a
folder and select Source Control on Contents to access the menu.
• Projects sidebar context menu: Right-click a file in the Project Manager to access the Source
Control menu options. SCC functions can also be performed on Folders in the Toolbox; right-click a
folder and select Source Control on Contents to access the menu. Two source code control options
are available from the Projects sidebar and Toolbox context menus:
♦ Source Control applies source code functions to the selected file only.
♦ Source Control on Contents applies source code functions to the contents of the selected
project or folder.
• Editor Pane: Right-click a file in the Editor Pane to access the Source Control menu options.
• Filename Tab: Right-click the filename tab above the Editor Pane to access the Source Control
menu options.
• File Menu: Select the Source Control option from the File menu.
The Source Control submenu options are the same regardless of which method is used to access the menu.
Access common source code control commands from the SCC Toolbar at the top of the Komodo workspace.
Refer to the command descriptions below for more information. The toolbar commands only apply to the file
currently active in the Editor Pane.
Invoke source code control context menus by right-clicking files or folders in the following areas:
• Projects sidebar
• Toolbox
• Editor Pane
The SCC Output tab is located in the Bottom Pane of the Komodo workspace. As you execute source code
control commands, such as editing or checking in files, details of the commands are displayed on the SCC
Output tab.
Error messages and warnings are also displayed on the SCC Output tab. Additionally, error messages and
warnings are displayed on the status bar in the bottom left corner of the Komodo workspace.
• Checkout: Launches the SCC Checkout wizard for fetching a local copy from a repository.
• Add: Add a file from a designated source code directory on your local drive to the source code
repository.
• Edit: Unlock a file for editing.
• Revert Changes: Check the file back into the repository, abandoning any changes made since it was
checked out.
• Remove: Delete the file from both the source code repository and the corresponding local directory.
• Update: When the local version no longer matches the repository version of a file, select this
command to update the local version of the file.
• Diff (Compare Files): Compare the version of a file open in the Editor Pane with the version in the
source code repository. Depending on the setting in Preferences, the diff display is shown on another
Komodo editor tab or in a separate window. If the display style for diffs (Edit|Preferences|Source
Code Control) is set to Create new window, press 'F9' or select Jump to Corresponding Line to
open and/or shift focus to the original file in the Editor Pane. If viewing a diff in an editor tab,
right-click and select Jump to Corresponding Line to shift focus to the editor tab containing the
source code. Selecting this option opens the source code tab in the Editor Pane if it is not already
The icons can appear in a variety of combinations, depending on the status of the file and where they are
displayed in the Komodo workspace. For example, a pencil icon next to a padlock icon on a tab in the Editor
Pane indicates that the file has been locally modified and that the version of the file in your local directory is
in sync with the version in the source code repository.
Refresh Status
To refresh the SCC status of the current file do one of the following:
• Right-click the on file tab or within the editor pane and select Refresh Status
• Right-click on the file in the Projects sidebar and select Refresh Status
• Click Refresh Status on the File menu
• Press 'Ctrl' + 'K', 'R'
Step One: Set the SCC handler and the checkout data
Set the following options:
• SCC Handler: Choose the SCC system to use (e.g. svn, git, bzr, etc.)
• Checkout URL: Specify the specific URL of the branch being checked out (e.g.
"http://svn.openkomodo.com/repos/komododoc/trunk/"). Specify the protocol to use (e.g. "http://",
"rsync://", "git://" etc.).
• Save to: Specify the local directory to download to. Some SCC clients, such as CVS, will require that
the specified directory already exists. Others, such as SVN, will create the directory if it does not exist
already.
• bzr:
♦ Revision: The revision to check out. User the revision number or other revision identifier.
♦ Hard-link working tree files where possible: Uses the "--hardlink" command line option.
• cvs:
♦ Module: A path within the repository or a CVS module name (required field).
♦ Branch or Tag: The branch or "sticky tag" of the branch to be checked out.
♦ Specific date: Checkout version from a specific date. Accepts a variety of date formats (e.g.
"YYYY-MM-DD HH:MM").
♦ Checkout Type: Normal (for working on the modules) or Export (for making a software
release).
• git:
♦ Local repository: Used if the repository to clone is locally available. Uses the "--local"
command line option.
♦ Do not perform a HEAD checkout after cloning: Uses the "--no-checkout" option.
♦ Make a bare GIT repository: Uses the "--bare" option.
• hg:
♦ Revision: The revision number to check out. Current if unspecified.
♦ Do not update the new working directory: Uses the "--noupdate" option.
♦ Use pull protocol to copy metadata: Uses the "--pull" option.
♦ Use uncompressed transfer (fast over LAN): Uses the "--uncompressed" option.
• svn:
♦ Revision: The revision number to check out (HEAD by default).
♦ Only check out the top folder: Users the "--non-recursive" option.
♦ Omit externals: Uses the "--ignore-externals" option.
Options mentioned above are explained with more detail in the documentation for each SCC handler:
Step One: Set the SCC handler and the checkout data 189
Komodo User Guide
Note: The SCC Checkout wizard does not correctly handle password authentication. SCC checkouts requiring
password authentication should be done at the command line. You can do this by copying the command
shown in the command line summary and pasting it into a terminal.
The bottom pane shows a list of files for inclusion in the check-in. Komodo scans the current directory and all
subdirectories under SCC control to populate this list and show the SCC status of each with an icon.
Check the box for each file you would like to include in the check-in, or use the Check All button. Use the
Add File and Add Directory buttons to expand the list as necessary (e.g. files in adjacent or parent
directories).
The Show Diff button shows a diff that includes all checked files. This can be used to create multi-file
patches.
The Commit button starts the check-in. Command line output is displayed in the SCC Output tab in the
bottom pane.
1. If you have not already done so, install the cvs command-line utility on your system.
2. Check out files: Komodo does not have integrated SCC checkout functions. As necessary, run cvs
from the command line (e.g. 'cvs checkout repository ...').
3. Enable CVS support in Komodo: Under Preferences|Source Code Control|CVS and ensure that the
"CVS Integration" option is checked and that the cvs executable is available in your PATH or is
specified with a full pathname.
4. Open any file under CVS control in Komodo.
Komodo should now recognize that the file is under CVS source code control and the SCC menus and status
icons should be enabled. If not, click Refresh Status on the File menu (or Ctrl-K, R) to force it to reset.
Some CVS repositories (e.g. SourceForge) will only support CVS access over SSH (secure shell). When
accessing these repositories, an SSH client is required. See Configuring SSH Support for CVS and
Subversion below for details on configuring SSH support.
1. If you have not already done so, install the svn command-line client on your system.
2. Enable Subversion support in Komodo: Under Preferences|Source Code Control|Subversion and
ensure that the "SVN Integration" option is checked and that the svn executable is available in your
PATH or is specified with a full pathname.
3. Check out files: If you haven't checked out a local working copy of the files yet, use the SCC
checkout wizard or run svn checkout ... from the command line.
4. Open any file under Subversion control in Komodo.
Komodo will recognize the files is under Subversion source code control and the SCC menus and status icons
should be enabled. If not, click Refresh Status on the File menu (or Ctrl-K, R) to force it to reset.
Some Subversion repositories only support Subversion access over SSH (secure shell). When accessing these
repositories, an SSH client is required. See Configuring SSH Support for CVS and Subversion below for
details on configuring SSH support.
1. If you have not already done so, install Perforce on your system.
2. Check out files: Komodo does not have integrated SCC checkout functions. As necessary, run p4
from the command line (e.g. 'p4 sync path').
3. Enable Perforce support in Komodo: Under Preferences|Source Code Control|Perforce and ensure that
the "Perforce Integration" option is checked and that the p4 executable is available in your PATH or is
specified with a full pathname.
4. Set P4 environment variables: Unless Komodo is always started from a shell with all necessary P4
environment variables set (e.g. P4CLIENT, P4PORT, P4USER), you will need to specify them in
Komodo's Environment preferences.
5. Open any file under Perforce control in Komodo.
Komodo should now recognize that the file is under Perforce source code control and the SCC menus and
status icons should be enabled. If not, click Refresh Status on the File menu (or Ctrl-K, R) to force it to reset.
Users of Perforce's P4CONFIG feature may find that Komodo's source code control doesn't work unless
Komodo is started from within the client view of the Perforce repository.
Configuring Preferences
Use the Source Code Control page in Komodo's Preferences to configure Source Code Control integration.
To open the Komodo Preferences dialog box, select Edit|Preferences.
This is a basic guideline for configuring CVS and Subversion to use SSH, however, because server
configurations can vary, you should consult the documentation for the control system you are using, or request
help from you system administrator.
The use of Pageant (on Windows) or ssh-agent (OS X and Linux) with Komodo is strongly recommended.
1. Install Putty
http://www.chiark.greenend.org.uk/~sgtatham/putty/
• putty.exe
• puttygen.exe
• pageant.exe
• pscp.exe
• plink.exe
Ensure that the directory where Putty is installed is specified in your system's PATH environment variable.
Run the pageant program. This loads the Putty Authentication Agent into the Windows System Tray.
Right-click the Pageant icon in the Windows System Tray. Select Add Key. Navigate to the directory where
you saved the public and private keys in the previous step, and select the file private1.key.ppk.
1. Specify Server: On the Session page of the Configuration form, enter the host name or IP address of
the server.
2. Specify Protocol: On the Session page, in the Protocol field, select the "SSH" protocol.
3. Create Saved Session: In the Saved Sessions field, enter the host name again. Click the Save button.
4. Configure Connection: on the Connection page of the Configuration form, enter your username for
the server in the Auto-login username field.
5. Configure SSH Protocol: On the SSH page of the Configuration form, specify "2" for the Preferred
SSH protocol version.
6. Enable Agent Forwarding: On the Auth page of the Configuration form, check Allow agent
forwarding. In the Private key file for authentication field, specify the path and filename of the
private key created above (private1.key).
7. Save Session Information: On the Session page of the Configuration form, click the Save button.
You must store the public key file generated in step 2 (public1-openssh.key) on the CVS or Subversion server.
...where c:\path\to\public1-openssh.key specifies the location of the key file created in step two, and
[email protected] specifies your username and URL on the remote server. You are prompted to
confirm the legitimacy of the host, and may be prompted to enter your password for the server.
3. Connect Using Putty: If necessary, run the putty program. In the Saved Sessions field,
double-click the configuration created in Step 4. This establishes a connection to the server.
4. Configure the Key on the Server: After logging on to the server, enter the following commands to
configure the SSH key:
mkdir ~/.ssh
chmod 700 .ssh
cat ~/public1-openssh.key >> ~/.ssh/authorized_keys
rm ~/public1-openssh.key
chmod 600 ~/.ssh/*
5. Log Off and Exit Putty: Enter exit to close the session of the server.
Restart Putty. In the Saved Sessions field, double-click the configuration created in Step 4. You should not be
prompted to log in. If you are, the configuration failed. Review the steps above and ensure that they were
completed correctly.
Use the following additional steps if you are using CVS with Komodo.
1. Create Local CVS Directory: Create a directory to store a copy of the CVS repository.
2. Copy Files to Local Directory: At a command prompt, enter:
set CVS_RSH=plink
set PLINK_PROTOCOL=ssh
cvs -d :ext:[email protected]:/repository_name co cvs_module
...where [email protected] specifies your username on the CVS server and the URL of the
CVS server, repository_name specifies the name of the repository on the server, and cvs_module
specifies the name of the module in the chosen working repository.
Login is handled by SSH. The files are copied to the local system. These environment variables do
not interfere with non-SSH repositories.
Ensure that these variables are permanently configured in your system environment (for example, by adding
them to the autoexec.bat file or configuring them in the system properties).
You can also execute Pageant and load the key via a batch file. For example:
Use the following additional steps if you are using Subversion with Komodo.
1. Create Local Subversion Directory: Create a directory to store a copy of the Subversion repository.
2. Copy Files to Local Directory: At a command prompt, enter:
...where svn.server.com specifies the server domain name of the Subversion server,
repository_path/module specifies the path of the repository on the server, and local_path specifies the
preferred location on your local system for your copy of the repository. The local_path can be
ommited, in which case the local path is the last part of the repository_path.
Login is handled by SSH. The files are copied to the local system.
Ensure that these variables are permanently configured in your system environment (for example, by adding
them to the autoexec.bat file or configuring them in the system properties).
• PLINK_PROTOCOL=ssh
• SVN_SSH=c:/path/to/plink.exe -batch
Specify the full path to plink.exe using forward slashes "/" or escaped back slashes "\\". The -batch
argument is used to prevent plink from prompting for user input. You can specify a specific private key by
adding "-i C:/path/to/private_keyfile". For example:
SVN_SSH="c:/path/to/plink.exe" -i "c:/path/to/private_keyfile"
You can use the Subversion configuration file instead of setting the SVN_SSH environment variable:
[tunnels]
ssh = $SVN_SSH plink.exe
This permits configuration of different connection types. The config file is located in the Subversion directory,
typically inside the Application Data area of the user's profile directory (eg. C:\Documents and
Settings\USERNAME\Application Data\Subversion). See the Subversion documentation for more
information.
If you use "plink = $SVN_SSH plink.exe" in the tunnels section of the config file, use "svn+plink" for your
checkout url rather than "svn+ssh".
Run pageant to enable the authentication agent. Ensure that the private1.key is loaded. You can start
Pageant and load the key using a batch file. For example:
CVS_RSH=ssh
CVS determines when to use SSH, depending on how you check out the modules. If you use the "cvs login"
method with the "pserver" protocol, CVS does not use SSH, even if CVS_RSH=ssh is set in the environment.
...where [email protected] specifies your username on the CVS server and the URL of the
CVS server, repository_name specifies the name of the repository on the server, and cvs_module
specifies the name of the module in the chosen working repository.
5. Start Komodo within the cygwin shell as follows:
/path/to/komodo/bin/komodo
After completing the configuration steps above, follow these steps to open Komodo with CVS-SSH enabled:
/path/to/komodo/komodo.exe
Subversion determines when to use SSH depending on how you check out the modules. If you use http:// or
file:/// URIs, Subversion will not use SSH.
1. Open a shell.
2. Enter exec ssh-agent bash.
3. Enter ssh-add /path/to/public/key (e.g. 'ssh-add ~/.ssh/id_rsa.pub')
4. To check out a Subversion module, enter:
...where svn.server.com specifies the server domain name of the Subversion server,
repository_path/module specifies the path of the repository on the server, and local_path specifies the
preffered location on your local system for your copy of the repository. The local_path can be
ommited, in which case the local path is the last part of the repository_path.
5. Start Komodo from within the shell. Komodo inherits the environment set in the shell by ssh-agent
Feature Showcase
Komodo's Rx Toolkit is a tool for building, editing and debugging regular expressions. Build a regular
expression in the Regular Expression pane, and enter the sample search string in the Search Text pane.
Adjust the regular expression as necessary to produce the desired matches in the Match Results pane.
If you are new to Regular Expressions, see the Regular Expressions Primer. In addition, online references for
Python, Perl, PHP, Ruby, and Tcl regular expressions are available via the Rx Toolkit's Help menu.
Selecting a Language
Regular expression syntax is similar in most programming languages, but there are some important
differences. The Rx Toolkit can evaluate regular expressions using:
• JavaScript
• Perl
• PHP
• Python
• Ruby (requires the JSON module)
Select the regular expression engine you want to use from the drop-down list in the Regular Expression panel.
Many of the display characteristics available in the Editor Pane can be enabled in the Regular Expression
field. However, these characteristics must be manually enabled via key bindings. For example, to display line
numbers in the Regular Expression field, press 'Ctrl'+'Shift'+'6' ('Cmd'+'Shift'+'6' on Mac OS X) if the
default key binding scheme is in effect.
Note: Do not enclose regular expressions in forward slashes ("/"). The Rx Toolkit does not recognize
enclosing slashes.
If you already know the metacharacter you need, just type it in the Regular Expression pane.
• Match: Scan the search text for the first instance of a match for the regular expression.
• Match All: Find all matches for the regular expression in the search text and display them as a series
of matches in the Match Results pane.
• Split: Scan the search text for regular expression matches and split the string apart wherever there is
match. Each match is displayed on a separate line in the Match Results pane.
• Replace: Scan the text for the first occurrence of the regular expression and replace it with text
specified in the Replacement pane. The Replacement pane is only displayed when either the
Replace or Replace All is selected.
• Replace All: Scan the text for all occurrences of the regular expression and replace them with the text
specified in the Replacement pane. The Replacement pane is only displayed when either the
Replace or Replace All is selected.
Note: You must use the Modifiers check boxes to add modifiers to a regular expression. The Rx Toolkit does
not recognize modifiers entered in the Regular Expression pane.
• Ignore Case: Ignore alphabetic case distinctions while matching. Use this to avoid specifying the
case in the pattern you are trying to match.
• Multi-line Mode: Let caret "^" and dollar "$" match next to newline characters. Use this when a
pattern is more than one line long and has at least one newline character.
• Single-line Mode: Let dot "." match newline characters. Use this when a pattern is more than one line
long and has at least one newline character.
• Verbose: Permit the use of whitespace and comments in regular expressions. Use this to pretty print
and/or add comments to regular expressions.
• Unicode (Python Only): Make the special characters "\w", "\W", "\b" and "\B" dependent on
Unicode character properties.
• Locale (Python Only): Make the special characters "\w", "\W", "\b" and "\B" dependent on the
current locale.
If there is a match...
If there is no match...
• If a regular expression does not match the test string, an error message is displayed in the Match
Results pane.
• If a regular expression is invalid, the title bar of the Match Results pane becomes red and details of
the error are displayed in that pane.
Match Results
If a regular expression collects multiple words, phrases or numbers and stores them in groups, the Match
Results pane displays details of the contents of each group.
The Match Results pane is displayed with as many as four columns, depending on which match type is
selected. The Group column displays a folder for each match; the folders contain numbered group variables.
The Span column displays the length in characters of each match. The Value column lists the values of each
variable.
Modifier Examples
This section shows some sample regular expressions with various modifiers applied. In all examples, the
default match type (Match All) is assumed:
• Ignore Case
• Multi-line
• Single-line
• Multi-line and Single-line
• Verbose
Testing123
...you could use the following regular expression with Ignore case selected:
^([a-z]+)(\d+)
Discussion
The ^ matches the beginning of a string. The [a-z] matches any lowercase letter from "a" to "z". The +
matches any lowercase letter from "a" to "z" one or more times. The Ignore case modifier lets the regular
expression match any uppercase or lowercase letters. Therefore ^([a-z]+) matches "Testing". The
(\d+)matches any digit one or more times, so it matches "123".
"okay?"
...you could use the following regular expression with Multi-line selected:
^(\"okay\?\")
Discussion
The ^ matches the beginning of any line. The \" matches the double quotes in the test string. The string
matches the literal word "okay". The \? matches the question mark "?". The \" matches the terminal double
quotes. There is only one variable group in this regular expression, and it contains the entire test string.
...you could use the following regular expression with Single-line selected:
(:[\t ]+)(.*)work\?
Discussion
This regular expression matches everything in the test string following the word "Subject", including the
colon and the question mark.
The (\s+) matches any space one or more times, so it matches the space after the colon. The (.*) matches
any character zero or more times, and the Single-line modifier allows the period to match the newline
character. Therefore (.*) matches "Why did this <newline> match". The \? matches the terminal question
mark "?".
...you would need both the Multi-line and Single-line modifiers selected for this regular expression:
([\t ]+)(.*)^work\?
Discussion
This regular expression matches everything in the test string following the word "Subject", including the
The ([\t ]+) matches a Tab character or a space one or more times, which matches the space after the
colon. The (.*) matches any character zero or more times, which matches "Why did this <newline>". The
^work matches the literal "work" on the second line. The \? matches the terminal question mark "?".
If you used only the Single-line modifier, this match would fail because the caret "^" would only match the
beginning of a string.
If you used only the Multi-line modifier, this match would fail because the period "." would not match the
newline character.
Using Verbose
The Verbose modifier ignores whitespace and comments in the regular expression. Use this when you want to
pretty print and/or add comments to a regular expression.
testing123
...you could use the following regular expression with the Verbose modifier selected:
Discussion
The .* matches any character zero or more times, the ? makes the * not greedy, and the Verbose modifier
ignores the spaces after the (.*?). Therefore, (.*?) matches "testing" and populates the "Group 1"
variable. The (\d+) matches any digit one or more times, so this matches "123" and populates the "Group 2"
variable. The Verbose modifier ignores the spaces after (\d+) and ignores the comments at the end of the
regular expression.
Perl
This Perl code uses a regular expression to match two different spellings of the same word. In this case the
program prints all instances of "color" and "colour".
while($word = <STDIN>){
print "$word" if ($word =~ /colou?r/i );
}
The metacharacter "?" specifies that the preceding character, "u", occurs zero or one times. The modifier "i"
(ignore case) that follows /colou?r/ means that the regular expression will match $word, regardless of
whether the specified characters are uppercase or lowercase (for example, Color, COLOR and CoLour will all
match).
Python
This Python code uses a regular expression to match a pattern in a string. In Python, regular expressions are
available via the re module.
import re
m = re.search("Java[Ss]cript", "in the JavaScript tutorial")
if m:
print "matches:", m.group()
else:
print "Doesn't match."
The re.search() function returns a match object if the regular expression matches; otherwise, it returns
none. The character class "[Ss]" is used to find the word "JavaScript", regardless of whether the "s" is
capitalized. If there is a match, the script uses the group() method to return the matching strings. Otherwise
the program prints "Doesn't Match".
Tcl
This Tcl code uses a regular expression to match all lines in a document that contain a URL.
This while loop searches every line in a file for any instance of a URL and displays the results. Tcl
implements regular expressions using the regexp and regsub commands. In the example shown above, the
regexp is followed by the -nocase option, which specifies that the following regular expression should
match, regardless of case. The regular expression attempts to match all web addresses. Notice the use of
backslashes to include the literal dots (.) that follow "www" and precede "com".
PHP
This PHP code uses a Perl Compatible Regular Expressions(PCRE) to search for valid phone numbers in the
United States and Canada; that is, numbers with a three-digit area code, followed by an additional seven
digits.
$numbers = array("777-555-4444",
Perl 205
Komodo User Guide
"800-123-4567",
"(999)555-1111",
"604.555.1212",
"555-1212",
"This is not a number",
"1234-123-12345",
"123-123-1234a",
"abc-123-1234");
function isValidPhoneNumber($number) {
return preg_match("/\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}$/x", $number);
}
This PHP example uses the preg_match function for matching regular expressions. Other PCRE functions
are also available. If the function isValidPhone returns true, the program outputs a statement that includes
the valid phone number. Otherwise, it outputs a statement advising that the number is not valid.
Ruby
This Ruby code uses a regular expression that does simple email addresses validation.
The regular expression is stored in the addrtest variable, which is compared to the cmdline variable
using the match method. The regular expression specifies that the address must have:
It will accept some addresses that are not fully RFC compliant, and will not accept long user or domain
names. A more robust regular expression is:
/^([a-z0-9]+[._]?){1,}[a-z0-9]+\@(([a-z0-9]+[-]?){1,}[a-z0-9]+\.){1,}[a-z]{2,4}$/i
This does not limit the length of the username or domain. It also enforces some additional requirements:
• only letters, numbers, "." and "_" can be used in the username
PHP 206
Komodo User Guide
• only letters, numbers, and "-" can be used in the username
• "_" and "." cannot be used at the beginning or end of the username
• "-" cannot be used at the beginning or end of the domain name
• the top-level domain can only contain letters
Writing a regular expression that is fully compliant with RFC 822 is quite a bit more complicated.
Ruby 207
Regular Expressions Primer
About this Primer
The Regular Expressions Primer is a tutorial for those completely new to regular expressions. To familiarize
you with regular expressions, this primer starts with the simple building blocks of the syntax and through
examples, builds to construct expressions useful for solving real every-day problems including searching for
and replacing text.
A regular expression is often called a "regex", "rx" or "re". This primer uses the terms "regular expression"
and "regex".
Unless otherwise stated, the examples in this primer are generic, and will apply to most programming
languages and tools. However, each language and tool has its own implementation of regular expressions, so
quoting conventions, metacharacters, special sequences, and modifiers may vary (e.g. Perl, Python, grep, sed,
and Vi have slight variations on standard regex syntax). Consult the regular expression documentation for
your language or application for details.
import re
n = re.compile(r'\bw[a-z]*', re.IGNORECASE)
print n.findall('will match all words beginning with the letter w.')
Komodo can accept Python syntax regular expressions in its various Search features.
Komodo IDE's Rx Toolkit can help you build and test regular expressions. See Using Rx Toolkit for more
information.
Literal Match
The simplest type of regex is a literal match. Letters, numbers and most symbols in the expression will match
themselves in the the text being searched; an "a" matches an "a", "cat" matches "cat", "123" matches "123"
and so on. For example:
• Regex:
at
• Matches:
at
• Doesn't Match:
it
a-t
At
Wildcards
Regex characters that perform a special function instead of matching themselves literally are called
"metacharacters". One such metacharacter is the dot ".", or wildcard. When used in a regular expression, "."
can match any single character.
• Regex:
t...s
• Matches:
trees
trams
teens
• Doesn't Match:
trucks
trains
beans
Escaping Metacharacters
Many non-alphanumeric characters, like the "." mentioned above, are treated as special characters with
specific functions in regular expressions. These special characters are called metacharacters. To search for a
literal occurence of a metacharacter (i.e. ignoring its special regex attribute), precede it with a backslash "\".
For example:
• Regex:
c:\\readme\.txt
• Matches:
c:\readme.txt
• Doesn't Match:
c:\\readme.txt
c:\readme_txt
Precede the following metacharacters with a backslash "\" to search for them as literal characters:
^ $ + * ? . | ( ) { } [ ] \
These metacharacters take on a special function (covered below) unless they are escaped. Conversely, some
characters take on special functions (i.e. become metacharacters) when they are preceeded by a backslash
(e.g. "\d" for "any digit" or "\n" for "newline"). These special sequences vary from language to language;
consult your language documentation for a comprehensive list.
Quantifiers
Quantifiers specify how many instances of the preceeding element (which can be a character or a group) must
appear in order to match.
Question mark
The "?" matches 0 or 1 instances of the previous element. In other words, it makes the element optional; it can
be present, but it doesn't have to be. For example:
• Regex:
colou?r
• Matches:
colour
color
• Doesn't Match:
colouur
colur
Asterisk
The "*" matches 0 or more instances of the previous element. For example:
• Regex:
www\.my.*\.com
• Matches:
www.my.com
www.mypage.com
www.oursite.com
mypage.com
As the third match illustrates, using ".*" can be dangerous. It will match any number of any character
(including spaces and non alphanumeric characters). The quantifier is "greedy" and will match as much text as
possible. To make a quantifier "non-greedy" (matching as few characters as possible), add a "?" after the "*".
Applied to the example above, the expression "www\.my.*?\.com" would match just
"www.mysite.com", not the longer string.
Plus
The "+" matches 1 or more instances of the previous element. Like "*", it is greedy and will match as much as
possible unless it is followed by a "?".
• Regex:
bob5+@foo\.com
• Matches:
[email protected]
[email protected]
• Doesn't Match:
[email protected]
[email protected]
Number: '{N}'
To match a character a specific number of times, add that number enclosed in curly braces after the element.
For example:
• Regex:
w{3}\.mydomain\.com
• Matches:
www.mydomain.com
• Doesn't Match:
web.mydomain.com
w3.mydomain.com
To specify the minimum number of matches to find and the maximum number of matches to allow, use a
number range inside curly braces. For example:
• Regex:
60{3,5} years
Asterisk 211
Komodo User Guide
• Matches:
6000 years
60000 years
600000 years
• Doesn't Match:
60 years
6000000 years
Quantifier Summary
Quantifier Description
Matches any preceding element 0 or 1
?
times.
Matches the preceding element 0 or
*
more times.
Matches the preceding element 1 or
+
more times.
Matches the preceding element num
{num}
times.
Matches the preceding element at least
{min,
min times, but not more than max
max}
times.
Alternation
The vertical bar "|" is used to represent an "OR" condition. Use it to separate alternate patterns or characters
for matching. For example:
• Regex:
perl|python
• Matches:
perl
python
• Doesn't Match:
ruby
• Regex:
(abc){2,3}
• Matches:
abcabc
abcabcabc
• Doesn't Match:
abc
abccc
• Regex:
gr(a|e)y
• Matches:
gray
grey
• Doesn't Match:
graey
Strings that match these groups are stored, or "delimited", for use in substitutions or subsequent statements.
The first group is stored in the metacharacter "\1", the second in "\2" and so on. For example:
• Regex:
Character Classes
Character classes indicate a set of characters to match. Enclosing a set of characters in square brackets "[...]"
means "match any one of these characters". For example:
• Regex:
[cbe]at
• Matches:
cat
bat
eat
• Doesn't Match:
sat
Since a character class on its own only applies to one character in the match, combine it with a quantifier to
search for multiple instances of the class. For example:
• Regex:
[0123456789]{3}
• Matches:
123
999
376
• Doesn't Match:
W3C
2_4
If we were to try the same thing with letters, we would have to enter all 26 letters in upper and lower case.
Fortunately, we can specify a range instead using a hyphen. For example:
• Regex:
[a-zA-Z]{4}
• Matches:
Perl
ruby
SETL
• Doesn't Match:
1234
AT&T
Most languages have special patterns for representing the most commonly used character classes. For
example, Python uses "\d" to represent any digit (same as "[0-9]") and "\w" to represent any alphanumeric, or
"word" character (same as "[a-zA-Z_]"). See your language documentation for the special sequences
applicable to the language you use.
• Regex:
[^a-zA-Z]{4}
• Matches:
1234
$.25
#77;
• Doesn't Match:
• Regex:
^From: root@server.*
• Matches:
From: [email protected]
• Doesn't Match:
• Regex:
.*\/index.php$
• Matches:
www.example.org/index.php
the file is /tmp/index.php
• Doesn't Match:
www.example.org/index.php?id=245
www.example.org/index.php4
Sometimes it's useful to anchor both the beginning and end of a regular expression. This not only makes the
expression more specific, it often improves the performance of the search.
• Regex:
^To: .*example.org$
• Matches:
To: [email protected]
To: [email protected], [email protected]
• Doesn't Match:
There are many variations in substitution syntax depending on the language used. This primer uses the
"/search/replacement/modifier" convention used in Perl. In simple substitutions, the "search" text will be a
regex like the ones we've examined above, and the "replace" value will be a string:
For example, to earch for an old domain name and replace it with the new domain name:
• Regex Substitution:
s/https:\/\/2.gy-118.workers.dev/:443\/http\/www\.old-domain\.com/http://www.new-domain.com/
• Search for:
http://www.old-domain.com
• Replace with:
http://www.new-domain.com
Notice that the "/" and "." characters are not escaped in the replacement string. In replacement strings, they do
not need to be. In fact, if you were to preceed them with backslashes, they would appear in the substitution
literally (i.e. "https:\/\/2.gy-118.workers.dev/:443\/http\/www\.new-domain\.com").
The one way you can use the backslash "\" is to put saved matches in the substitution using "\num". For
example:
• Substitution Regex:
s/(ftp|http):\/\/old-domain\.(com|net|org)/\1://new-domain.\2/
• Target Text:
http://old-domain.com
• Result:
http://new-domain.com
This regex will actually match a number of URLs other than "http://old-domain.com". If we had a list of
URLs with various permutations, we could replace all of them with related versions of the new domain name
(e.g. "ftp://old-domain.net" would become "ftp://new-domain.net"). To do this we need to use a modifier.
Modifiers
Modifiers alter the behavior of the regular expression. The previous substitution example replaces only the
first occurence of the search string; once it finds a match, it performs the substitution and stops. To modify
this regex in order to replace all matches in the string, we need to add the "g" modifier.
• Substitution Regex:
/(ftp|http):\/\/old-domain\.(com|net|org)/\1://new-domain.\2/g
• Target Text:
The "i" modifier causes the match to ignore the case of alphabetic characters. For example:
• Regex:
/ActiveState\.com/i
• Matches:
activestate.com
ActiveState.com
ACTIVESTATE.COM
Modifier Summary
Modifier Meaning
i Ignore case when matching exact strings.
Treat string as multiple lines. Allow "^''
m and "$'' to match next to newline
characters.
Treat string as single line. Allow ".'' to
s
match a newline character.
Ignore whitespace and newline
x characters in the regular expression.
Allow comments.
o Compile regular expression once only.
Match all instances of the pattern in the
g
target string.
Intermediate:
Modifiers 217
Komodo User Guide
• Regexp Power, The O'Reilly Perl Resource Center
Advanced:
Language-Specific:
• Perl: http://perldoc.perl.org/perlre.html
• PHP: http://www.php.net/manual/en/ref.pcre.php
• Python: http://docs.python.org/lib/module-re.html
• Ruby: http://www.rubycentral.com/book/ref_c_regexp.html
• Tcl: http://www.tcl.tk/man/tcl8.4/TclCmd/re_syntax.htm
• Javascript: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Regular_Expressions
Instructions for using these tools can be found in the Perl Dev Kit documentation.
1. Click File|Open|File...
2. Navigate to the /lib/support/modules/ subdirectory of your Komodo installation.
3. Select the perlapp.xpi package and click Open.
4. The Software Installation dialog will appear. Click Install to add the extension.
To use this extension, select Tools|Build Standalone Perl Application with a Perl script open in Komodo's
Editor Pane.
After configuring options using the tabs in the Build Standalone Perl Application dialog box, use the buttons
at the bottom of the dialog box to:
• Add to Toolbox - Once you have created a new script, click this button to add it to the Toolbox as a
run command.
• Build - Create a new build or overwrite an existing build.
• Debug - If the Komodo debugging option is selected on the General tab, click this button to start the
debugger.
Note: When using the Build Standalone Application feature with Perl 5.8.0 on a Linux installation where
the environment is set to use UTF-8, you must add the module 'utf8' on the Modules tab. This is the
Komodo and the Perl Dev Kit Komodo IDE only 219
Komodo User Guide
equivalent of perlapp --add utf8. The module is not required for Perl 5.8.1 or higher.
• Enter the name of the script to build using the PDK - Specify the path and filename of the source
Perl script. This option is equivalent to the -script command-line argument.
• Build the script using - Select the type of output to generate.
• Enter the name of the target executable or control - Specify the path and name of the output file.
This option is equivalent to the -exe command-line argument.
• Dependencies
♦ None - Include all necessary files in the output file, so that it can be run on systems that do
not have Perl56.dll or ActivePerl. This option is equivalent to the -freestanding
command-line argument.
♦ Perl Dll required on target - Reduce the size of the generated executable by excluding
Perl56.dll from the output file. Target systems must have the Perl56.dll installed. This setting
corresponds with the -xclude command-line argument.
♦ ActivePerl required on target - Create an output file to run on systems where ActivePerl
and any modules included via use and require statements are installed. This option is
equivalent to the -dependent command-line argument.
• Verbose build information - Generate detailed output messages while the output file is being built.
This option corresponds to the -verbose command-line argument.
• Hide console (for GUI applications) - Similar to running wperl.exe, this option is useful for building
applications that run in the background. This setting corresponds with the PerlApp -gui
command-line argument and is only available for the PerlApp tool.
• Overwrite existing build - Replace the existing build with a new build. If you attempt to overwrite a
build without selecting this option, a pop-up dialog box warns that the .exe file already exists. You
can then choose to overwrite the file, overwrite the file and enable the check box, or cancel the
command. This option is equivalent to the -force command-line argument.
• Delete temp files after each run - Freestanding Perl applications, services and controls sometimes
contain embedded DLLs that are extracted and cached in the host system's temporary directory. Select
this check box to delete these files after each run. This setting corresponds with the -clean
command-line argument.
• Debugging - To debug the Perl executable, control or service as it is being built, select the desired
debugger from the drop-down list. If you are not using either the Komodo or PDK debugger, specify a
Hostname and Port for another debugger in the fields provided.
To add a module to the output program, enter the name of the module in the Module name field, and click
Add. The module to be added is displayed in the list box above. Remove modules from the list box using the
Delete and Delete All buttons.
To remove an unwanted module from the build, enter the name of the module in the Modules field, and click
Add. The module to be trimmed is displayed in the list box above. Remove modules from the list box using
the Delete and Delete All buttons.
Adding Files
To add a file to the output program, click Add. In the pop-up dialog box, enter the source location of the file
on your system, and the location where the file should be extracted when the output file runs.
Editing Files
To edit a file that has been added to the output program, click Edit. In the dialog box, as required, alter the
source location of the file on your system, and the location where the file should be extracted when the output
file runs.
Deleting Files
To remove a file that was to be added to the output program, click the file, then click Delete.
To alter any of the version options, select the desired option in the Version field column, and enter the desired
value in the field below. This information is assembled as a version information (VERINFO) resource and
displayed to users if they view the properties for the script in Windows Explorer.
To add a lib or blib directory to include in an output file, click Add. In the Browse for Folder dialog box,
select the directory path to include, and click OK. The path can contain multiple directories that are separated
in the same way as in the PATH environment variable.
Use Delete and Delete All to remove directories that you do not want to add from the "lib" and "blib" list
boxes.
To include .ico files in a build, click Add. From the Add Icon dialog box, select the icon(s) you want to add,
and click Open. The complete path for the icon file is displayed in the Icon File list box.
If you want to specify any command-line parameters in addition to those selected using the options in the
Build Standalone Perl Application dialog box, enter them in the field provided.
Interpolation shortcuts can be inserted in Run Commands using the drop-down list to the right of Command
field in the "Add Command..." and "Properties" dialog boxes, or entered manually. When using interpolation
shortcuts in snippets or templates, insert the interpolation code using bracketed syntax. Run commands and
snippets can be stored in a project or the Toolbox for frequent use.
Code Description
%% a literal percent sign (%) (e.g. %%PATH%% instead of %PATH% on Windows)
%f the basename of the current file
%b the basename of the current file without its extension
%F the full path and name of the current file
%L the line where the editing cursor is located within the current file
%d the base directory of the current file
%D the entire directory path of the current file
%P the full path of the active project
%p the directory path of the active project
%w the word under the cursor in the editor
URL-escaped word under cursor; replaces characters that are not valid in a query string,
%W
such as spaces and ampersands
%s the current selection; interpolates the text that is currently selected in the editor
URL-escaped selection; replaces characters that are not valid in a query string, such as
%S
spaces and ampersands
%(perl) the perl interpreter specified in Komodo's Perl preference
%(php) the php interpreter specified in Komodo's PHP preference
%(python) the python interpreter specified in Komodo's Python preference
the pythonw interpreter for python scripts that display a GUI (Windows and OS X only -
%(pythonw)
requires ActivePython)
Non-Bracketed Syntax
The syntax for a non-bracketed interpolation code is:
%<code>
%(<code><backref>:<options>...)
For example:
%(perl)
%w
%guid2
%(ask:Your Name:Trent Mick)
The parentheses are optional if the block does not contain spaces. For example, the following two commands
are equivalent:
%ask:Name:Trent
%(ask:Name:Trent)
Bracketed Syntax
The syntax for a bracketed interpolation code is:
[[%(<code><backref>:<options>...)]]
<code> is one of the codes shown in the table above, <backref> is a number and <options>... depend on the
specific code. Back-references and options are discussed in other sections. The following are examples of
bracketed syntax:
[[%perl]]
[[%w]]
[[%guid2]]
[[%ask:Your Name:Trent Mick]]
With bracketed interpolation codes, the parentheses are always optional. The double brackets enclose spaces,
making parentheses unnecessary. For example, both of the following commands are valid:
Bracketed interpolation code blocks permit some excess space immediately adjacent to the double brackets.
For example the following are equivalent:
%(s:orask:Element Name)
If there is no selected text, a pop-up dialog box appears with a text field called "Element Name".
See Using Command Query Shortcuts in the Run Command Tutorial for examples of %(ask) and
%(...:orask) shortcuts.
%(date)
A %(date) shortcut is replaced with the current date, formatted according to a given optional format or the
default format.
%(date) Syntax
The syntax of the %(date) shortcut is as follows:
%(date<backref>:<optional-format>)
[[%(date:<optional-format>)]]
As noted in the Basic Interpolation Code Syntax section, the parentheses are optional. The <backref> optional
parameter is discussed in the Back-references section. The following examples are valid:
%date
[[%date]]
%(date)
%date:%H:%M:%S
[[%date:%d/%m/%Y %H:%M:%S]]
If this format is not appropriate, you can specify a different one using the following date formatting codes
(from Python's time.strftime() method):
Directive Meaning
%a Locale's abbreviated weekday name.
%A Locale's full weekday name.
%b Locale's abbreviated month name.
%B Locale's full month name.
%c Locale's appropriate date and time representation.
%d Day of the month as a decimal number [01,31].
%H Hour (24-hour clock) as a decimal number [00,23].
%I Hour (12-hour clock) as a decimal number [01,12].
%j Day of the year as a decimal number [001,366].
%m Month as a decimal number [01,12].
%(ask[:NAME:[DEFAULT]])
%(askpass[:NAME:[DEFAULT]])
"NAME" appears next to the corresponding field in pop-up dialog box, and "DEFAULT" is an optional
default value. A "DEFAULT" cannot be specified without a "NAME".
Typical usage of the %(askpass) shortcut would use "Password" for the "NAME" and not set a
"DEFAULT". For example:
%(askpass:Password)
As noted in Basic Interpolation Code Syntax, usage of parentheses depends on the context. The following
examples are valid:
%(ask<backref>:<optional-question>:<optional-default>)
[[%(ask<backref>:<optional-question>:<optional-default>)]]
%(path)
The "path" codes are used to provide special directory paths based on the installation of Komodo that is
currently running. These include such items as the common data directory, which may be necessary if you are
building run commands that you intend to work on shared files.
%(path) Syntax
The syntax of the path shortcut is as follows:
%(path:<pathName>)
[[%(path:<pathName>)]]
%(path) Options
The %(path) shortcut takes one required parameter, "pathName". The pathName may be one of the following:
%(debugger)
The %(debugger) shortcuts are used to provide runtime values from the debugger subsystem in Komodo.
These codes can be used to provide debugging information to applications such as PerlApp.
%(debugger) Syntax
The syntax of the debugger shortcut is as follows:
%(debugger:<value>)
[[%(debugger:<value>)]]
%(debugger) Options
The %(debugger) shortcut requires a <value> parameter, which can be one of the following:
Debugger
Meaning
Value
address The hostname or address Komodo is running on.
port The TCP/IP port number that the debugger system is listening on.
proxyAddress The hostname or address of a debugger proxy that Komodo is using.
proxyPort The TCP/IP port number of a debugger proxy that Komodo is using.
A session key, typically retrieved from the USER environment variable, that the proxy
proxyKey
uses to match debug sessions with a specific running instance of Komodo.
%(pref)
The %(pref) shortcut is used to provide values from Komodo's Preferences. The back-end of Komodo's
preference system is undocumented, but you can examine the settings in the prefs.xml file in the user data
directory to find the preference IDs.
%(pref) Syntax
The syntax of the %(pref) shortcut is:
%(pref:<prefName>)
[[%(pref:<prefName>)]]
Back-References
Back-references are particularly useful for code snippets. You can use back-references to interpolate the same
value any number of times in the snippet. Back-references make it possible to prompt the user for an input
value only once, and then insert that value multiple times. For example, you could create a snippet that
prompts for a value, which would then be entered at various places in the snippet text.
Back-Reference Syntax
You create a back-referenced set of shortcuts by suffixing the interpolation code with a number. The syntax
for back-reference is as follows:
%(<code><backref>:<options>...)
[[%(<code><backref>:<options>...)]]
For example:
%(ask1:Name:Trent)
%w1:else:Foo
[[%guid1]]
All interpolation blocks with the same shortcut/number pairs are part of the same back-reference set. All
members of the same back-reference set will be replaced with the first code block in that set. For example:
This opens a pop-up dialog box prompting for one entry, "Name", with a default of "Trent". Whatever value
the user entered for "Name" would then be inserted in two places in the command, resulting in the following
command:
Another useful application of back-references is the "guid" code. A guid code is replaced with a new GUID
(Globally Unique Identifier). Sometimes it is desirable to have the same GUID inserted in more than one
place in a file. In snippets, this can be done by using a code "%guid1" instead of just "%guid" wherever you
want the GUID inserted.
Back-References 230
Preferences
Komodo's preferences are used to set the default behavior of Komodo. Preferences can be set for various
aspects of Komodo functionality, such as editor behavior, preferred language interpreters, the Komodo
workspace layout, etc.
Some preferences can also be configured on a per-file basis. For example, the configuration of line endings,
indentation style and word wrap can be configured for individual files. File-specific settings override the
default preferences described in this section. To configure file-specific defaults, see File Properties and
Settings in the File section of the Komodo documentation.
Appearance Preferences
Use the Appearance preferences to customize the default layout of the Komodo workspace. The functions
described below can also be changed using keyboard shortcuts; see Key Bindings for more information. To
customize the Komodo workspace, select Edit|Preferences|Appearance. Configure the following options:
Toolbar Configuration
• Show Komodo Start Page on startup: Select to display the Start Page in the Editor Pane when
Komodo launches.
• Hide Tutorials Pane: Select to hide the Tutorials section of the Komodo Start Page.
• Hide Quick Links Pane: Select to hide the Quick Links section of the Komodo Start Page.
• Number of Projects: The number of projects displayed on Komodo's Start Page, and on the Recent
Projects menu.
• Number of Files: The number of files displayed on Komodo's Start Page, and on the Recent Files
menu.
Preferences 231
Komodo User Guide
• Enable automatic autocomplete and calltip triggering while you type: Toggles automatic
autocomplete triggering and calltips (Enabled by default). Click OK to save changes.
• Enable autocomplete fill-up characters: Toggles"fill-up" characters. Typing certain characters, like
'(' or '.', during an autocomplete session will trigger insertion of the current completion before the
character itself is inserted.
• Maximum number of lines shown in calltip: Used to control how much calltip information can be
displayed.
API Catalogs
Komodo uses API catalogs to provide autocomplete and calltips for 3rd-party libraries. In the API Catalogs
panel, select the libraries that you use in your code to enable them. Selecting multiple API catalogs for a
particular language can yield confusing results if there are overlapping namespaces, classes or function names.
• When starting a new debug session: Specify whether Komodo should Ask me what files to save
(which displays a list of changed files); Save all modified files (whereby all modified files are
automatically saved); or Save no files (whereby the debugging session starts without saving any
files).
• When receiving a remote debugging connection: Specify whether Komodo should Ask me to
allow connection (Komodo prompts to allow the connection request); Allow the connection
(Komodo accepts the connection without prompting); or Refuse the connection (Komodo refuses the
connection without prompting).
• Initial break behavior: Specify whether Komodo should Break on first executable line or Run to
first breakpoint. Breaking on the first line of code is useful for adding breakpoints if none have been
set yet (e.g. in a non-local JavaScript file).
• Skip debugging options dialog: To block the display of the debugger dialog box when the debugger
is invoked, check this box. Using the 'Ctrl' key in conjunction with a debugger command key toggles
the value specified here. However, commands invoked from the Debugger drop-down menu always
use the convention specified here.
• Confirm when closing debugger session tab: If the debugger is running when you attempt to close
the Debug tab, this check box determines whether you are prompted to halt the debug session and
close the tab, or whether this happens without prompting.
• Show expression values in hover tooltip: If this is enabled, while you are debugging, you can hover
the mouse pointer over a variable or expression in Komodo to see a tooltip with the value of that
variable.
• Try to find files on the local system when remote debugging: By default, when Komodo performs
remote debugging, it retrieves a read-only copy of the file to be debugged from the debug engine.
• Children per page: The number of child nodes displayed for an object in a variable view. Clicking
"...Next Page..." at the end of the list will fetch another "page" of nodes.
• Variable Data retrieved: The maximum number of bytes stored for a value in a variable view.
• Recursive Depth retrieved: Recursion depth for nested objects (e.g. arrays of arrays etc.).
Editor Preferences
To configure editing preferences, select Edit|Preferences|Editor.
General Preferences
• Show whitespace characters: Display or hide whitespace characters in the editor. Spaces are
displayed as dots; tab characters appear as right arrows.
• Show end-of-line characters: This option sets the default for displaying end of line markers. Display
can also be toggled using the View|View EOL Markers menu option.
• Show line numbers: This option sets the default for displaying line numbers. If enabled, line
numbers are displayed on the left side of the Editor Pane. Line numbers can also be toggled using the
View|View Line Numbers menu option.
Options set through the Preferences dialog box are the default for all files opened in Komodo. Some display
characteristics can be assigned to individual files.
Cursor options
Confirmation Dialogs
When files that are opened in the Komodo editor are changed by another application, Komodo can be
configured to respond in various ways:
• Detect when files are changed outside the environment: When this option is enabled, Komodo
pays attention to changes made to files outside the Komodo environment.
• If files have been changed: When files are changed outside Komodo, select whether Komodo should
Ask me what files to reload (prompt for reload confirmation); Reload all files (reload without
prompting); or Reload no files (do nothing).
• If files have been deleted: When files are deleted outside Komodo, select whether Komodo should
Ask me what files to close (prompt for close confirmation); Close all files (close without prompting);
or Close no files (do nothing).
If Ask me what files to reload Ask me what files to close are selected, the prompt is displayed when:
Scrolling
The Scrolling setting determines the number of lines that are be displayed above or below the editing cursor.
As the editing cursor moves, the number of lines specified here are displayed between the cursor and the top
or bottom of the Editor Pane. You can also set the horizontal scroll bar width by entering the desired size in
pixels.
On Linux systems, key bindings defined in the window manager (including default key bindings) take
precedence over Komodo key bindings. If certain keys or key combinations do not work as expected in
Komodo, check the window manager's key binding scheme. In the case of conflicts, change either the
Komodo key bindings or the window manager key bindings.
To configure key binding defaults, select Edit|Preferences|Editor|Key Bindings. By default, menu key
bindings are accessed using 'Alt' key combinations on Windows and Linux. For example, the File menu is
opened via 'Alt'+'F'. Select Remove Alt-<letter> shortcuts from menus to disable menu access via these key
bindings. The 'Alt' key still activates the File menu.
Key binding "schemes" are sets of pre-configured key bindings. Click the links below to view a list of key
bindings for each of the schemes.
Pre-configured schemes cannot be modified. When you attempt to modify a key binding, you are prompted to
make a copy of the scheme with a new name before making changes.
Some Emacs key bindings use 'Alt'+'letter' combinations that are also used to access Komodo menus. To
avoid this conflict, select Remove Alt-<letter> shortcuts from menus.
Vi Emulation
Vi emulation mimics the modal behavior of the Vi editor. Selecting Enable Vi emulation when a scheme
other than Vi is selected prompts you to create a new scheme. This scheme is based on the current scheme
with the Vi emulation behavior added.
Schemes created with Vi emulation enabled (including the default Vi scheme) will always require Vi
emulation. The Enable Vi emulation checkbox cannot be toggled.
To alter or view a specific key binding, scroll the Commands list or enter characters in the filter field. If
multiple key bindings are assigned to a single command, the Current Key Sequence field displays as a
drop-down list. Click the Clear button to delete the key binding displayed for the selected command; click
Clear All to delete all key bindings for the selected command.
To add a new key binding for the selected command, enter the desired key binding in the New Key Sequence
field. If the key sequence is already assigned to another command, the current assignment is displayed in the
Key Sequence Already Used By field. Click Change to update the key binding displayed in the Current
Key Sequence field; click Add to make the new key binding an additional key binding. If the key binding is
already assigned, the original assignment is cleared.
• URLs
• Run Commands
• Macros
• Snippets
• Templates
When the key binding associated with a toolis invoked, it has the same action as double-clicking the tool in
the Toolbox sidebar.
Key bindings assigned to tools in a project toolbox are only available for the active project. Key bindings for
tools in the global toolbox are always available.
To assign a key binding to a tool, or to alter or delete an existing key binding, right-click the tool and select
Properties, then click the Key Binding tab. Configure as described above.
Sharing Keybindings
Keybindings can be shared between Komodo installations by copying the keybinding (*.kkf) scheme files.
Configuring Indentation
From the Edit menu, select Preferences, then click Editor|Indentation.
• Number of spaces per indent: Number of spaces Komodo inserts on the left margin when indenting
a line of code.
• Width of each Tab character: Number of spaces that are equal to a Tab character.
• Fold mark style: Use the drop-down list to select the style of node used in code folding.
• Use horizontal line on folds: Displays collapsed code with fold marks; a thin line also spans the
width of the Editor Pane.
• 'Backspace' decreases indentation in leading whitespace: If this option is enabled, pressing
'Backspace' clears an entire indentation, rather than a single space, if there is nothing between the
editing cursor and the left margin. For example, if the number of spaces per indent is set to four, and
there are five spaces between the left margin and the editing cursor, pressing 'Backspace' once clears
one space; pressing 'Backspace' a second time clears four spaces.
• Restore fold state on document load (slows down file opening): If this option is enabled, the
current state of code folding is remembered when a file is closed, and reinstated when the file is next
opened.
Options set through the Preferences dialog box are the default for all files opened in Komodo. Some
indentation characteristics can be assigned to individual files.
Smart Editing
Options set through the Preferences dialog box are the default for all files opened in Komodo. Some Smart
Editing features can be assigned to individual files.
The Komodo editor maintains an index of words in the current file. Instead of re-entering words that already
exist in the current file, you can use the Complete Word function to finish words. If you are using the default
key binding scheme, word completion is invoked from the keyboard by pressing 'Ctrl'+'Space' ('F5' or
'Alt'+'Esc' on Mac OS X). If you also want to be able to complete words by pressing the 'Tab' key, select the
check box labeled Use tab character to complete words like Ctrl+Space. Note that the 'Tab' key can still be
used for other purposes when this check box is selected. Word completion only occurs when the cursor is
positioned to the right of characters in a word that has been stored in the editor's index.
Select an option from the Word wrap long lines drop-down list to have lines automatically "wrapped"; that
is, when a line exceeds the width of the Editor Pane, it wraps to the next line. This is merely a display
characteristic - no end-of-line marker is inserted. You can choose Word, Character, or leave it as the default
value of None. The Character option wraps the line at the immediate position where the line exceeds the
width of the Editor Pane; the Word option wraps the line from the beginning of the word that extends beyond
the width of the Editor Pane.
Note: For lines that have been wrapped automatically, the behavior of the 'Home' and 'End' keys is slightly
different. Pressing 'Home' or 'End' moves the cursor to the beginning or end of the current line. Pressing the
same key a second time moves the cursor to the previous or next end-of-line marker.
Select an option from the Word wrap markers drop-down list to display markers in the Editor Pane. You can
choose to view End of line markers, Start of line markers, Both or None. The default is None.
• Show edge line / Highlight characters beyond edge line: Select to show where the line wraps, and
to highlight characters beyond the wrap column. With fixed-width fonts, a line is drawn at the column
specified. With proportional-width fonts, those characters beyond the specified column are drawn on
a colored background. The line or background color is configured on the Fonts and Colors preference
page.
• Edge line column: Specify the column position of the vertical marker.
Soft Characters
Enable soft characters turns on language-specific autocompletion for brackets, braces and other delimiters.
The highlighted closing character is inserted after the cursor and can be "typed over". See Soft Characters in
the Editor section for more information.
Line Cut/Copy
Cut/Copy with no selection... changes the behavior of Cut and Copy operations when there is no selection in
the current buffer. By default, the current line is cut or copied if there is no selection.
Hyperlinks
Background syntax checking validates code against the language interpreter as you type. (If Code Intelligence
is enabled for Python, the code intelligence database is used to validate Python code.) Syntax errors and
warnings are underlined in the Editor Pane. See Background Syntax Checking for more information.
By default, Komodo performs a background syntax check one second (1000 msecs) after you stop typing. In
very large files, this background process can slow down editing. If you notice slowness in the editor pane, try
extending the delay or disabling background syntax checking. Syntax checking can be run manually by
clicking the syntax checking icon ( or ) in the status bar.
The level of background syntax checking for Perl is determined by the setting on the Perl Language
preference page.
Enable checking of mixed end-of-line (EOL) characters" checks for inconsistent end-of-line characters
caused by editing a file on multiple platforms (e.g. CR-LF on Windows vs. LF on Linux).
Configuring Folding
Komodo can fold (i.e. hide and un-hide) logical segments of code in many languages and data file types. The
following options define how code folding looks and works:
Save Options
To automatically fix whitespace errors when saving files:
• Clean trailing whitespace and EOL markers: Eliminates unnecessary empty space between text
and EOL markers, and fixes inappropriate EOL markers.
• Ensure file ends with EOL marker: Adds an EOL marker to the last line in a file if one does not
already exist.
Based on the specified Minutes between auto-save, Komodo saves backup copies of all files open in the
editor. When Komodo is shut down normally, the backup copies are deleted. If Komodo is shut down
abnormally (such as through a system crash), Komodo prompts to restore the backup copy when the file is
next opened. If you respond "Yes", the backup copy of the file, rather than the (older) disk copy, is opened in
the editor.
When files without extensions are saved, Komodo can be configured to prompt for an action. Configure the If
filename has no extension drop-down list:
• Ask me what to do: Komodo prompts you with a dialog box to decide what to do when a particular
file is saved without an extension.
• Add appropriate extension: Komodo automatically adds an extension based on file content.
• Leave filename alone: Komodo does nothing when a file is saved without an extension.
Environment
At startup, Komodo loads all environment variables it can access. If it is launched from a desktop icon rather
than a shell, environment variables set in the default shell will not be loaded automatically.
To ensure that Komodo runs with the correct environment variables, (e.g. SCC settings, library locations, SSH
options, etc.) set them in the User Environment Variables (override defaults) list box. Three buttons are
available for manipulating this list:
Find
Highlighting
• Enable highlighting of find and replace results: Toggles the highlighting of matching strings in the
current buffer. To guard against performance problems caused by slow searches, Komodo will stop
highlighting matches after the timeout configured here.
Incremental Search
These options set the defaults for the Incremental Search feature.
• Uses: Specify the search syntax type. Plain Text exactly matches the search string; Regular
Expressions interprets the search text as a regular expression; Wildcard interprets asterisk and
question mark characters as wildcards.
File Associations
Komodo's file associations determine the functionality of editing features such as autocomplete and code
coloring. Use the File Associations preference to associate file extensions and characteristics with particular
languages.
1. Enter the desired pattern in the Pattern field. The pattern consists of the wildcards and the naming
convention. Typically, file associations are made by the filename extension; for example, a Perl script
has the extension ".pl". The pattern for a Perl script is therefore "*.pl".
2. Select the language to associate with the pattern from the Language drop-down list.
Komodo can be configured to identify the language of a file based on its contents rather than its extension.
The following characteristics can be used to override the file associations settings for syntax checking and
debugging configuration.
• XML Declarations: The Use XML Declarations option checks for XML declarations that specify
the language of a file (e.g. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> for XHTML 1.0).
• Shebang (#!...) Line: The Use shebang line option checks for a "#!/..." line at the top of a file that
specifies the interpreter (e.g. #!/usr/bin/perl).
• Emacs-Style Mode Variable: When this check box is selected, as Komodo opens files, it checks for
an embedded Emacs "mode" specification used to set the syntax checking and debugging
configuration.
The Sample Text window at the top of the Fonts and Colors page offers a preview of the current scheme. If
multiple schemes are configured, select the desired scheme from the Scheme drop-down list.
Find 240
Komodo User Guide
1. Select the scheme that you want to base your new scheme upon.
2. Click the New button and enter a name for the new scheme.
3. Make any necessary changes using the controls on the Fonts, Colors, Common Syntax Coloring, and
Language-Specific Coloring tabs.
4. Click OK to save the new scheme.
Schemes are added to the Scheme drop-down list. Remove the selected scheme by clicking the Delete button.
System schemes appear in bold and cannot be deleted.
Fonts
The Fonts tab is used to configure the display characteristics for fixed-width and/or proportional fonts. Note
that the default font characteristics configured on this tab are not overridden by any language-specific font
configurations.
To create a scheme that affects characters in specific encodings, select the type of encoding from the
Encoding drop-down list. If you do not specify the encoding, Komodo uses the system's default encoding.
The Fonts tab contains two identical sets of font controls, one for fixed-width fonts on the left, and the other
for proportional fonts on the right. Select the Prefer Fixed or Prefer Prop. option button to set the desired
font type and then use the drop-down list immediately beneath the selected option to choose a specific font.
• Font: Select specific fixed-width or proportional fonts from the drop-down lists. (On Linux, the same
list of fonts is displayed in both drop-down lists. On GTK, there is no programmatic way to identify
whether a font is proportional or not; therefore, you must know the properties of the individual fonts
when modifying these values.)
• Font Size: Select the size of the font from the drop-down list.
• Bold: If you want the default font to be displayed in bold, click the "B".
• Italic: If you want the default font to be displayed in italics, click the "I".
• Font Color: Set the font color by clicking on the "Fore" color box. Select the desired color from the
color picker dialog box. Click the small arrow button to set the font color using the system color
palette (Windows and Mac OS X only).
• Background Color: Set the background color for the Editor Pane by clicking on the "Back" color
box. Select the desired color from the color picker dialog box. Click the small arrow button to set the
background color using the system color palette.
• Reset: Click this button to return the font and color preferences to Komodo's original, default settings.
Colors
Use the Color Choice drop-down list on the Colors tab to configure general color properties for the Editor
Pane. After selecting an interface component from the list, click the box to the right of the drop-down list to
choose a color from the color palette, or click the small arrow button to select a color from the system color
palette.
• Current Line Background Color: The color configured here does not take effect unless the
Highlight Current Line check box is selected. This sets the highlighting color of the line in which
The Override Text Color in Selection check box activates the "Selection Text Color" setting described
above. The Highlight Current Line check box activates the coloring specified in the "Current Line
Background Color" setting described above.
• Face: Select the typeface of the font from the drop-down list. You can choose either "Fixed-width" or
"Proportional".
• Size: Select the size of the font from the drop-down list.
• Bold: If you want the default font to be displayed in bold, click the "B".
• Italic: If you want the default font to be displayed in italics, click the "I".
• Font Color: Set the font color by clicking on the foreground color box. Select the desired color from
the color picker dialog box, or click the small arrow button to select a color from the system color
palette.
• Background Color: Set the background color for the Editor Pane by clicking on the background
color box. Select the desired color from the color picker dialog box, or click the small arrow button to
select a color from the system color palette.
• Reset: Click this button to return the font and color preferences to Komodo's original, default settings.
Colors 242
Komodo User Guide
Language-Specific Coloring
The colors configured on the Language-Specific Coloring tab apply to elements that appear in a specific
language. Select a language from the Language drop-down list and an element from the Element Type
drop-down list, then use the controls described below to set the font characteristics.
• Face: Select the typeface of the font from the drop-down list. You can choose either "Fixed-width" or
"Proportional".
• Size: Select the size of the font from the drop-down list.
• Bold: If you want the default font to be displayed in bold, click the "B".
• Italic: If you want the default font to be displayed in italics, click the "I".
• Font Color: Set the font color by clicking on the foreground color box. Select the desired color from
the color picker dialog box, or click the small arrow button to select a color from the system color
palette.
• Background Color: Set the background color for the Editor Pane by clicking on the background
color box. Select the desired color from the color picker dialog box, or click the small arrow button to
select a color from the system color palette.
• Reset: Click this button to return the font and color preferences to Komodo's original, default settings.
You can configure one or more formatters for any language. Each language will have one formatter marked as
Default, which is the one used by the Format Code or Text ('cmd_format') function. By default, this
command does not have a key binding. You can assign one in the Key Bindings preferences.
• Run HTTP Inspector at startup: If selected, this starts the proxy when Komodo is launched. If not,
the proxy can be started from the HTTP Inspector interface.
• Listen on port: Specify the port the proxy runs on. Most proxies use port 8080.
• Only accept connections from the local machine: Enabled by default.
Proxy forwarding:
• Enable proxy forwarding: Enable this option if you use an HTTP proxy to connect to the internet
(i.e. at your network gateway).
• Forward proxy connections on to this host: If you have enabled proxy forwarding, enter the proxy
information in the format <hostname>:<port>. If no port is specified, Komodo will attempt to
use port 8080.
• Preferred Language: Specify which language interpreter's shell is launched when the interactive
shell is invoked.
• Session Control:
♦ Close tab when interactive shell session ends: If this option is selected, the Shell tab closes
when the Stop button is clicked. Otherwise, the tab remains visible (although you must
invoke another interactive shell session to use the shell).
♦ Confirm when closing interactive shell: When you attempt to close the Shell tab before
stopping the session (by clicking the Stop button), this option determines whether you are
prompted for confirmation. The confirmation dialog box has an option to disable the warning;
to re-enable the warning, set this field to Ask me each time.
• Working Directory: This option sets the "current" directory for the interactive shell session. Specify
the desired directory.
Internationalization Preferences
Language encodings provide support for files containing characters in non-ASCII character sets.
1. File Preference: If a specific encoding has been assigned to a file via the file's Properties and Settings
context menu, the assigned encoding is always used when that file is opened.
2. Auto-Detect: If the Auto-Detect File Encoding when Opened box is checked, Komodo analyzes the
existing encoding of the file by first looking for a Byte Order Marker (BOM), then by checking for an
XML declaration, and then by performing heuristic analysis on the file's contents. If an encoding can
be determined, it is applied.
3. Language-specific Default Encoding: Specific encodings can be assigned to programming
languages. (Komodo determines the programming language of a file based on the File Association
preferences.) If an encoding is associated with a programming language, that encoding is used. Check
Signature (BOM) to embed a Byte Order Marker (BOM) at the beginning of the file. If the specified
encoding is set to the default encoding, the System Encoding or Custom Encoding is used.
4. System Encoding or Custom Encoding: If the Use Encoding Defined in Environment box is
checked, Komodo uses the encoding specified in the operating system. The following system
variables are checked:
♦ Windows: The Control Panel's "Regional Settings" (Windows 98, ME, and NT); "Regional
Options" (Windows 2000); "Regional and Language Options" (Windows XP).
♦ Mac OS X: The "International" settings accessed via the the OS X System Preferences.
♦ Linux: LC_CTYPE, LANG and LANGUAGE.
To use a different encoding, uncheck this box and select the desired encoding from the Custom
Encoding drop-down list.
When you create a new file, only the third and fourth methods described above are used to set the file's
encoding.
The following settings override all other encoding settings except the File Preference setting.
• Allow XML Declaration to Override Auto-Detection: Komodo always uses the XML encoding
declaration contained in the XML file when opening XML files (if applicable).
• Allow HTML META tag to Override Auto-Detection: Komodo uses the charset setting defined
in META tags in HTML documents.
• Allow 'coding:' tag to Override Auto-Detection: If the file contains a
"coding: <encoding_name>" directive within the first two lines, that encoding is used.
The Date & Time format determines the display format of the date and time for items listed on the Start Page,
and for the Current File settings display.
The General Help field is used to specify a help location that does not specifically apply to a language (or
applies to a language not available in the above list).
To reset any of the help settings to their original value, click Reset beside the pertinent field.
Language Configuration
To configure the languages supported by Komodo, select Edit|Preferences|Languages, then select the
desired language.
Configuring JavaScript
Syntax Checking: Use the checkboxes to enable or disable basic and strict warnings from the JavaScript
interpreter.
JavaScript Directories: Specify any directories that you want Komodo to use for autocompletion and
calltips. Komodo scans these directories recursively (up to 5 directories deep) for information.
Configuring Perl
• Use this interpreter: Select Find on Path to use the first Perl interpreter that occurs in the system's
PATH variable. The paths to interpreters found in the PATH variable are available from the drop-down
list; select a specific interpreter as desired. Alternatively, click Browse and navigate the filesystem to
select the desired interpreter.
• Background Syntax Checking: Perl syntax checking is configurable; the degree of syntax checking
is determined by switches sent to the interpreter. Specify the desired level of syntax checking by
selecting the corresponding interpreter switch combination from the drop-down list. If a setting that
uses "taint" mode is selected, the PERL5LIB environment variable is ignored; syntax checking is not
performed on modules located in directories specified via PERL5LIB.
• Perl Critic options: Sets the strictness level for Perl::Critc checking. The 'Perl::Critic' and 'criticism'
modules must be installed in order to enable this.
• Debugger Logging: If this option is enabled, the Komodo debugger logs the debugging session to a
file in the directory specified in the Debugger Log Path field (or the directory specified in the
system's TEMP variable, if no directory is specified). This is primarily for debugging the debugger, as
opposed to gaining additional insight on the debug session itself. The debugger log file is named
perl-dbgp.log. The contents of the log file are overwritten each time the debugger is invoked.
• Additional Perl Import Directories: Directories specified in this field are inserted at the beginning
of Perl's @INC array (in the same manner as Perl's "I" command-line argument). Modules in the
specified directories are used for debugging, syntax checking and during interactive shell sessions.
• Use this installation: Use the drop-down list or the Browse button to specify the path to the PDK
executable file.
Configuring PHP
Komodo will try to automatically configure itself for local PHP debugging. If this fails then you'll need to
manually configure PHP debugging, refer to Debugging PHP for instructions.
• Use this interpreter: Select Find on Path to use the first PHP interpreter that occurs in the system's
PATH variable. The paths to interpreters found in the PATH variable are available from the drop-down
list; select a specific interpreter as desired. Alternatively, click Browse and navigate the filesystem to
select the desired interpreter.
• Path to alternate PHP configuration file: The php.ini file to be used by Komodo PHP functions,
enter the path in this field, or use the Browse button.
• PHP Directories: Specify any directories that you want Komodo to use for autocompletion and
calltips. Komodo scans these directories recursively (up to 5 directories deep) for information.
• Comment Style: PHP can use "//" or "#" for comments. Choose one of these styles for use by the
Comment Region and Un-comment Region features.
Note: Be sure your php.ini configuration file is located in your operating system directory. If you used the
PHP Windows installer, this file should be in the correct location. To verify, on Windows 2000/NT the
php.ini file should be in \winnt; on Windows 98/Me the php.ini file should be in \windows. On
Windows XP, the system directory is either \winnt or \windows, depending on whether XP was a native
installation or was an upgrade from a previous Windows version.
Use Komodo's shared support functionality to share PHP preferences, run commands, code snippets,
templates, .tip files, or other items that have special usefulness within your PHP programming group. See
Configuring Shared Support for more information.
Configuring Python
Python 2.x and 3.x are different enough that they need to be evaluated with different interpreters. The Python
preference group should be set up with Python 2.x interpreters and libraries, and the Python3 group should be
set up with Python 3.x interpreters and libraries.
Komodo performs basic syntax analysis to determine which version of Python to use when a Python file is
opened in the editor. This version information can be seen (and changed) in the File Type section at the right
side of the status bar.
• Use this interpreter: Select Find on Path to use the first Python interpreter that occurs in the
system's PATH variable. The paths to interpreters found in the PATH variable are available from the
drop-down list; select a specific interpreter as desired. Alternatively, click Browse and navigate the
filesystem to select the desired interpreter.
• Additional Python Import Directories: Directories specified in this field are inserted at the
beginning of Python's PYTHONPATH environment variable. Modules in the specified directories are
used for debugging, syntax checking and during interactive shell sessions.
Configuring Ruby
• Use this interpreter: Select Find on Path to use the first Ruby interpreter that occurs in the system's
PATH variable. The paths to interpreters found in the PATH variable are available from the drop-down
list; select a specific interpreter as desired. Alternatively, click Browse and navigate the filesystem to
select the desired interpreter.
• Background Syntax Checking: Ruby syntax checking is configurable; the degree of syntax checking
is determined by switches sent to the interpreter. Specify the desired level of syntax checking by
selecting the corresponding interpreter switch combination from the drop-down list.
• Debugger Logging: If this option is enabled, the Komodo debugger logs the debugging session to a
file in the directory specified in the Debugger Log Path field (or the directory specified in the
system's TEMP variable, if no directory is specified). This is primarily for debugging the debugger, as
opposed to gaining additional insight on the debug session itself. The debugger log file is named
ruby-dbgp.log. The contents of the log file are overwritten each time the debugger is invoked.
• Additional Ruby Import Directories: Directories specified in this field are inserted at the beginning
of Ruby's PATH_LOAD environment variable. Modules in the specified directories are used for
debugging and syntax checking.
Configuring Tcl
Komodo can use the standard tclsh interpreter, the Tk-enabled wish interpreter, or any other Tcl core
compatible extended shell.
• Use this Wish interpreter: Select Find on Path to use the first Wish interpreter that occurs in the
system's PATH variable. The paths to interpreters found in the PATH variable are available from the
drop-down list; select a specific interpreter as desired. Alternatively, click Browse and navigate the
filesystem to select the desired interpreter.
• Use this Tclsh Interpreter: As described above, specify the desired Tclsh interpreter.
• Enable Debugger Log: If this option is enabled, the debugger logs sessions to a file called
tcl-dbgp.log in the directory specified in Debugger Log Path (or the the system's TEMP directory if
no path is specified). The contents of the log file are overwritten each time the debugger is invoked.
This file is primarily useful in troubleshooting debugger sessions.
• Additional Tcl Include Directories: Directories specified in this field are inserted at the beginning of
Tcl's TCLLIBPATH environment variable. Modules in the specified directories are used for
debugging, syntax checking and during interactive shell sessions.
Note: Tcl Beta releases contain only version-specific executables (e.g. tclsh85.exe and wish85.exe).
Komodo does not automatically find these in the path. To use them, specify them manually in the Interpreters
section rather than selecting Find on Path.
Syntax checking support in Komodo Edit requires the TCL Syntax Checker extension.
• Warning messages to suppress: The warning messages listed in this dialog box can be disabled. This
prevents Komodo's syntax checking functionality from reporting these warnings.
• Error messages to suppress: The error messages listed in this dialog box can be disabled. This
prevents Komodo's syntax checking functionality from reporting these errors.
• Additional options: Configure the level of error and warning checking by using the switches -W1
(display parsing and syntax errors), -W2 (display parsing and syntax errors, and usage warnings),
-W3 (display parsing and syntax errors, portability warnings, upgrade warnings, performance
warnings, and usage warnings), and -Wall (displays all messages and errors (the default)).
Additionally, specific warning and error messages can be suppressed using the -suppress error
switch.
• Force checking for specific Tcl/Tk Version: To use a version of Tcl other than the default (8.4) for
warning and error checking, select the desired version from the drop-down list.
Tcl Debugging
Komodo's Tcl debugger has additional preferences for instrumenting files and logging debug sessions.
• Tcl Instrumented Files: By default, all files are instrumented. However, once modules are added to
this list box, you can choose to not instrument specific modules by clearing the appropriate check
boxes next to the module names. To instrument modules in the list box, select the check box beside
the module name. To add a module to the list (e.g. "incrtcl, "TclX"), click the "Add Entry" button,
specify the Module Name, and click OK. To remove a module, select one or more module names in
the list box, and click "Delete Entries".
• Debugger Logging: If this option is enabled, the Komodo debugger logs the debugging session to a
file in the directory specified in the Debugger Log Path field (or the directory specified in the
system's TEMP variable, if no directory is specified). This is primarily for debugging the debugger, as
opposed to gaining additional insight on the debug session itself. The debugger log file is named
tcl.log. The contents of the log file are overwritten each time the debugger is invoked.
Use Komodo's shared support functionality to share Tcl preferences, run commands, code snippets, templates,
.tip files, or other items that have special usefulness within your Tcl programming group. See Configuring
Shared Support for more information.
Configuring HTML
Komodo works in conjunction with HTML Tidy to provide configurable syntax checking for HTML files.
The following options can be configured:
• Error Level: Errors Only displays all HTML errors with a red underline; Errors and Warnings
displays both errors and warnings with a red underline.
• WAI Accessibility Conformance level: The Web Accessibility Initiative (WAI) provides HTML
developers with guidelines for making web content accessible to those with disabilities. These
guidelines include methods for making content understandable and navigable (for example, adding
"alt" text to an "img" tag for those who cannot view images). WAI accessibility levels are:
♦ Off: WAI accessibility is off. No WAI-related syntax errors are reported.
♦ Priority 3: The lowest WAI conformance level. One or more groups will have difficulty
accessing the information in this document.
♦ Priority 2: Satisfying this level removes significant barriers to accessing content in this
document.
♦ Priority 1: The highest WAI conformance level. A web content developer must satisfy this
level for the greatest content accessibility.
• Configuration File: Tidy functionality can be customized via a custom configuration file. See
teaching Tidy about new tags on the W3C site for information on building a custom configuration
file. To specify a custom Tidy configuration file, click Browse beside the Configuration File text
box to locate the configuration file on your filesystem.
Click the Delete... button to delete the currently selected catalog from the list.
Use the arrow buttons to rearrange the order of the catalogs. Catalogs at the top of the list take precedence
over those below. All catalogs specified here (and the DTDs and RelaxNG Schemas referenced by them) take
precedence over the ones that ship with Komodo.
Mapped URIs
Mapped URIs are associations that allow Komodo to open files specified at one location using a different
path.
/var/www/index.html
• remote debugging
• dragging URLs into the Editor pane
• previewing HTML files
To map a URI (the address of an internet or network resource, such as a web URL) to a local directory:
The Path can refer to remote paths that are accessed via FTP, SFTP, or SCP (e.g.
scp://[email protected]:/home/user/) in addition to paths on the local filesystem. If the remote server is
configured under Servers Preferences, Komodo will open the file without prompting for authentication.
Double-click an existing mapping in the list to edit the URI or Local Path. URI mappings are substring
matches. For example, /home/user/public_html/project would match any directories starting with that string
(i.e. subdirectories project_1, project_2, etc.).
The Komodo templates used to create new files (File|New|New File) support the same Interpolation Shortcut
codes as snippets and run commands. Prior to Komodo Version 2.5, only a limited set of variables could be
used (for example, to embed the current date and time in files created from custom templates). The new
Interpolation Shortcuts are more powerful but are backward-incompatible.
Enter a number in the Number of recent templates to remember field to specify how many recent template
names appear on the File|New drop-down menu.
The encoding for new files is determined by the configuration of the Internationalization preference.
Printing Preferences
• Print Line Numbers: Check this box to print the line numbers.
• Print in Color: To print in the colors displayed in the Editor Pane, check this box.
• Wrap long lines at n characters: Set the column at which lines will wrap. Specify "0" characters for
no line wrapping.
• Scale font sizes from screen to print by n: Specify the number of times larger or smaller the printed
font size will be in relation to its size on screen. The default is "1.5". Specify "1" to print the current
font size.
Use the When starting Komodo field to specify the display when Komodo is opened.
• Ask me whether to restore workspace: Komodo prompts to open recent files and projects.
• Restore last workspace: Komodo displays the workspace exactly as it was when you last quit
Komodo (including expanded tabs and open files).
• Do not restore last workspace: Komodo displays the default workspace (the Start Page and no
expanded tabs).
These options specify the relationship between projects and files that are open in the Editor Pane.
• Ask me what to do: Komodo prompts whether the files that were open when the project was last
closed should be re-opened.
• Open recent files: Komodo automatically opens the files that were open when the project was last
closed.
• Open no files: Komodo opens the project without opening any files.
• Ask me what to do: Komodo prompts whether open files associated with the project should be
closed.
• Close all open files in project: Komodo automatically closes open files associated with the project.
• Close no files: Komodo closes no files.
The Update file status automatically option enables a periodic check of the read/write status and the source
code control status of files in the Places sidebar.
Status refresh can also be performed manually with the Refresh context menu item for any tool, file or folder.
Triggering Macros
Macros can be configured to execute when specific Komodo events occur (such as before a file is saved or
after a file is closed). To disable this feature, uncheck Enable triggering of macros on Komodo events.
Servers Preferences
Use the Servers page to configure server account settings for remote file access. To access the Servers page,
select Edit|Preferences|Servers. You can also manually specify a connection (server name, username and
password) when opening or saving remote files.
See Opening Remote Files for information about working with remote files.
If no servers have been previously configured, enter access information as described below and click the Add
button. If there are prior server configurations, click the New Server button to clear the fields. To alter an
existing configuration, select the configuration from the drop-down list, make the desired changes, then click
the Update button. To delete a configuration, select the desired configuration and click the Delete button.
• Remote Accounts: Previous server configurations can be accessed via this field.
• Server Type: Select the type of connection to the server (FTP, SFTP or SCP).
• Name: Enter a name for the account. The value in this field is displayed in the "Remote Accounts"
drop-down list box, and is used as the Server name in the Remote File dialog box.
• Hostname: Enter the name of the remote server. The name may be fully qualified (e.g.
"server.example.org", or just the hostname of a machine within a local domain.
• Port: Enter the port to use to connect to the server. SFTP and SCP generally use port 22. FTP
generally uses port 21.
• User Name: If you require an account to use the remote server, enter the user name in this field. If the
server accepts anonymous access, enter "anonymous" or click the Anonymous Login check box.
• Password: If you require an account to use the remote server, enter the account password in this field.
If access to the server is anonymous, the password is usually an email address (such as
"[email protected]").
• Default Path: To specify the directory that displays when you connect to the server, enter the path in
this field.
• Anonymous Login: If the server allows anonymous login, check this box.
• templates
• Shared Toolbox
• Tcl .tip files (syntax definition files)
• .pcx files (checker extension files that define exact syntax information)
• .pdx files (debugger extension files)
• preferences
To access shared components, Komodo users must have "read" access rights to shared files in both the
Common Data Directory and the Shared Toolbox (if the directory is not the same as the Common Data
Directory). To alter shared components, users must also have "write" rights.
By default, the The Common Data Directory is the same as the user data directory.
The other file types that can be shared are .pcx files, which can be used to extend the command information
supported by the TDK Checker and Komodo Tcl linter, and .pdx files, which are debugger extension files that
define debugging functions, such as spawnpoints. Like .tip files, .pcx and .pdx files are stored in the tcl
subdirectory of the Common Data Directory.
Sharing Preferences
Shared preferences are used to set a default preference configuration that is shared between multiple Komodo
users. An organization or user group can specify defaults like the language type for new files, default tab
widths, and other Komodo settings.
1. user preferences
2. shared preferences (common)
3. default preferences (factory)
In a shared configuration, user preferences always override the shared preferences. Shared preferences always
override the default preferences.
To configure shared preferences, set the desired preferences in one instance of Komodo. (This sets user
preferences for that Komodo installation.) Then, edit the prefs.xml file that stores the preferences.
Make a backup copy of prefs.xml before editing it. In prefs.xml, make the following changes:
Because user preferences override both default and shared preferences, ensure that user preferences are not
configured for items defined in the shared preferences. For example, if the shared preference contains a tab
size definition, and a user's personal preference contains a tab size definition, the user's preference is used, not
the shared preference.
• Show SCC Output Tab on Commands: Select the desired action from the drop-down list to specify
whether the SCC tab is displayed when SCC commands produce output.
• Method used to display 'diff' output: Specify whether the output from the SCC diff command
should be displayed in a separate window, or within a new tab in the Komodo Editor Pane.
CVS Integration
Configure these options to use CVS source code control integration.
• CVS Integration: Select this check box if you are using a CVS source code repository.
• CVS executable used: Choose the path to the desired CVS executable file from the drop-down list, or
click Browse to navigate to the file location.
• Check for status changes from outside of Komodo: If this check box is selected, Komodo checks to
see if the status of files that are open in the editor has changed from the status they had at the last
check. Specify the interval at which Komodo should check the file status in the field below.
• Do recursive status checks: When checking the CVS status of files in a project, select this check box
to recurse the directories. If this check box is not selected, only the status of files in the current
directory are checked.
• Diff options: When you use the option Diff (Compare Files), the comparison is performed according
to the style specified here. Any CVS diff options may be specified. For a complete list of options,
refer to the CVS Manual.
• Do not warn about CVS external protocols (CVS_RSH) at startup: If you are using an external
protocol (such as RSH) to connect to the CVS repository, select this check box if you do not want a
warning displayed when you start Komodo.
Perforce Integration
Configure these options to use Perforce source code control integration.
• Perforce Integration: Select this check box if using a Perforce source code repository.
• Perforce executable used: Use the drop-down list or the Browse button to specify the path to the
Perforce executable file.
• Check for status changes from outside of Komodo: If this check box is selected, Komodo checks to
see if the status of files that are open in the editor has changed from the status it had at the last check.
Specify the interval at which Komodo should check the file status in the field below.
Subversion Integration
Configure these options to use Subversion source code control integration.
• SVN Integration: Select this check box if you are using a Subversion source code repository.
• SVN executable used: Use the drop-down list or the Browse button to specify the path to the
Subversion executable file. Requires the svn command line client, available from
http://subversion.tigris.org/. Komodo cannot use the TortoiseSVN client as its SVN executable.
• Check for status changes from outside of Komodo: If this box is selected, Komodo checks to see if
the status of files that are open in the editor has changed from the status they had at the last check.
Specify the interval at which Komodo should check the file status in the field below.
• Do recursive status checks: When checking the Subversion status of files in a project, check this box
to recurse the directories. If this box is not checked, only the status of files in the current directory are
checked.
• Diff options: When you use the option Diff (Compare Files), the comparison is performed according
to the style specified here. Any Subversion diff options may be specified. For more about diff options,
refer to the Subversion Documentation.
• Do not warn about Subversion external protocols (SVN_SSH) at startup: If you are using an
external protocol (such as SSH) to connect to the Subversion repository, check this box if you do not
want a warning displayed when you start Komodo.
file associations, Komodo becomes the default editor for specific file types. When one of these files is
invoked (for example, by double-clicking the filename in Windows Explorer), Komodo is automatically
launched (if not already running), and the file is loaded in the Editor Pane.
When a file extension is added to the "Edit with Komodo" association, the context menu displayed when the
filename is right-clicked in Window Explorer contains an "Edit with Komodo" option.
Individual file extensions may be added and deleted via the lists.
If another application overrides the associations configured by Komodo, click Re-apply settings to system to
reset the Komodo associations.
Feature Showcase
This tutorial provides an introduction to Komodo's general features in the areas of:
• Editing
• Code Analysis
• Debugging
• Search
• Tools
• Project and Workspace
• Creating a Rails scaffold using the Ruby on Rails Komodo project template
• Using project macros to create a MySQL database and a core application
• Writing a Rails application iteratively
• Debugging the application
PHP Tutorial
This tutorial provides an introduction to Komodo's PHP features, including:
Perl Tutorial
This tutorial provides an introduction to Komodo's Perl features, including:
Python Tutorial
This tutorial provides an introduction to Komodo's Python features, including:
Ruby Tutorial
This tutorial provides an introduction to Komodo's Ruby features, including:
XSLT Tutorial
This tutorial provides an introduction to Komodo's XSLT features, including:
Editing
• Preview Cascading Style Sheets
• Simple Snippets
• Create a Prompting Snippet
• Code Completion Snippet
Debugging
• Break on a Variable Value
• Debug an XSLT Program
Search
• Fast String Finder
• Incremental Search
• Open/Find Toolbar
Tools
• Installing Extensions
• Using SCC
• Google Run Command
• Interactive Shell
• Test a Regular Expression
• ...that ActivePerl build 623 or greater is installed on your system. ActivePerl is a free distribution of
the core Perl language. See Komodo's Installation Guide for configuration instructions.
• ...that you have a connection to the Internet.
• ...that you are interested in Perl. You don't need to have previous knowledge of Perl; the tutorial will
walk you through a simple program and suggest some resources for further information.
1. Install a Perl module for parsing text files containing comma-separated values.
2. Open the Perl Tutorial Project and associated files.
3. Analyze parse.pl the Perl program included in the Tutorial Project.
4. Generate output by running the program.
5. Debug the program using the Komodo debugger.
3. Click the Run button to run the command. PPM connects to the default repository, downloads the
necessary files and installs them.
About PPM
• PPM can be run directly from the command line with the ppm command. Enter ppm help for more
information on command-line options.
• By default, PPM accesses the Perl Package repository at http://ppm.activestate.com. The ActiveState
repository contains binary versions of most packages available from CPAN, the Comprehensive Perl
Archive Network.
• More information about PPM is available on ASPN. PPM documentation is also included with your
ActivePerl distribution.
• On Linux systems where ActivePerl has been installed by the super-user (i.e. root), most users will
not have permissions to install packages with PPM. Run ppm as root at the command line to install
packages.
Perl Pointer It is also possible to install Perl modules without PPM using the CPAN shell. See the CPAN
FAQ for more information.
Opening Files
Open the Perl Tutorial Project
On the Start Page under Tutorials and Documentation, click Perl Tutorial, or open the perl_tutorial.kpf
file from the samples/perl_tutorials subdirectory of Komodo's user data directory
• Komodo analyzes this line for hints about what language the file contains
• warning messages are enabled with the "-w" switch
Komodo Tip notice that syntax elements are displayed in different colors. You can adjust the display options
for language elements in the Preferences dialog box.
Lines 2 to 4 - External Modules
• input and output files are opened; if the output file does not exist, it is created
• scalar variables, indicated by the "$" symbol, store the files
• "strict" mode (enabled by loading "strict.pm" in line 2) requires that variables be declared using the
format "my $variable"
Perl Pointer scalar variables store "single" items; their symbol ("$") is shaped like an "s", for "scalar".
Lines 9 to 13 - Print the Header to the Output File
• the result of the method call "new" is assigned to the scalar variable $csv
• the method "new" is contained in the module Text::CSV_XS
• ({binary => 1}) tells the method to treat the data as binary
Perl Pointer good Perl code is liberally annotated with comments (indicated by the "#" symbol).
Lines 18 to 19 - Method "getline"
• the method "getline" is contained in the module Text::CSV_XS, referenced in the $csv scalar variable
• "getline" reads the first line of mailexport.txt (referenced in the $in variable), parses the line into
fields, and returns a reference to the resulting array to the $fields variable
Komodo Tip Click on the minus symbol to the left of line 21. The entire section of nested code will be
collapsed. This is Code Folding.
Komodo Tip click the mouse pointer on line 21. Notice that the opening brace changes to a bold red font.
The closing brace on line 51 is displayed the same way.
Lines 22 to 25 - Extracting a Line of Input Data
• the "getline" function extracts one line of data from the input file and places it in the $record scalar
variable
• if "getline" returns an empty array, the input file has been fully processed and the program exits the
loop and proceeds to line 52
Perl Pointer variable arrays store lists of items indexed by number; their symbol ("@") is shaped like an "a",
for "array".
Converting Characters with a Regular Expression
Lines 27 to 31 - "foreach"
Komodo Tip Komodo's Rx Toolkit is a powerful tool for creating and debugging regular expressions. See
Regular Expressions Primer for more information.
Combining Field Reference and Field Data
Lines 33 to 35 - hash slice
• line 35 combines the @$record array with the field reference generated in line 19
Perl Pointer variable hashes are indicated by the symbol "%", and store lists of items indexed by string.
Writing Data to the Output File
Lines 37 to 50 - Writing Data to the Output File
• one line at a time, lines from the input file are processed and written to the output file
• portions of the data line (stored in the $record scalar variable) are extracted based on the
corresponding text in the field reference (the first line in the input file, stored in the $fields variable)
• at line 51, processing will loop back to the opening brace on line 21
• the logic to exit the loop is on line 25
1. Clear the contents of mailexport.xml Click on the "mailexport.xml" tab in the Editor Pane. Delete
the contents of the file - you will regenerate it in the next step. Save the file.
2. Run the Debugger Click on the "parse.pl" tab in the editor. From the menu, select
Debug|Go/Continue. In the Debugging Options dialog box,
click OK to accept the defaults.
3. View the contents of mailexport.xml Click on the "mailexport.xml" tab in the editor. Komodo
informs you that the file has changed. Click OK to reload the file.
1. Set a breakpoint: On the "parse.pl" tab, click in the grey margin immediately to the left of the code
on line 9 of the program. This will set a breakpoint, indicated by a red circle.
2. Run the Debugger: Select Debug|Go/Continue. In the Debugging Options dialog box, click OK to
accept the defaults. The debugger will process the program until it encounters the first breakpoint.
Komodo Tip Debugger commands can be accessed from the Debug menu, by shortcut keys, or from the
Debug Toolbar. For a summary of debugger commands, see Debugger Command List.
3. Watch the debug process: A yellow arrow on the breakpoint indicates the position at which the
debugger has halted. Click on the "mailexport.xml" tab. Komodo informs you that the file has
changed. Click OK to reload the file.
4. View variables: In the Bottom Pane, see the Debug tab. The variables "$in" and "$out" appear in the
Locals tab.
5. Line 9 - Step In: Select Debug|Step In. "Step In" is a debugger command that causes the debugger to
execute the current line and then stop at the next processing line (notice that the lines between 9 and
13 are raw output indicated by "here" document markers).
6. Line 16 - Step In: On line 16, the processing transfers to the module Text::CSV_XS. Komodo opens
the file CSV_XS.pm and stops the debugger at the active line in the module.
7. Line 61 - Step Out: Select Debug|Step Out. The Step Out command will make the debugger execute
the function in Text::CSV_XS and pause at the next line of processing, which is back in parse.pl on
line 19.
8. Line 19 - Step Over: Select Debug|Step Over. The debugger will process the function in line 19
without opening the module containing the "getline" function.
• Step In executes the current line of code and pauses at the following line.
• Step Over executes the current line of code. If the line of code calls a function or method, the
function or method is executed in the background and the debugger pauses at the line that follows the
original line.
• Step Out when the debugger is within a function or method, Step Out will execute the code without
stepping through the code line by line. The debugger will stop on the line of code following the
function or method call in the calling program.
9. Line 22 - Set Another Breakpoint: After the debugger stops at line 21, click in the grey margin
immediately to the left of the code on line 22 to set another breakpoint.
Perl Pointer The perl debugger will not break on certain parts of control structures, such as lines containing
only braces ( { }).
With Perl 5.6 and earlier, the debugger will also not break at the start of while, until, for, or foreach
statements.
10. Line 22 - Step Out: It appears that nothing happened. However, the debugger actually completed one
iteration of the "while loop" (from lines 21 to 51). To see how this works, set another breakpoint at
line 37, and Step Out again. The debugger will stop at line 37. On the Debug Session tab, look at the
data assigned to the $record variable. Then Step Out, and notice that $record is no longer displayed,
and the debugger is back on line 21. Step Out again, and look at the $record variable - it now contains
data from the next record in the input file.
11. Line 37 - Stop the Debugger: Select Debug|Stop to stop the Komodo debugger.
12.
Perl Pointer Did you notice that output wasn't written to mailexport.xml after every iteration of the while
loop?
This is because Perl maintains an internal buffer for writing to files. You can set the buffer to "autoflush"
using the special Perl variable "$|".
More Perl Resources
Documentation
There is a wealth of documentation available for Perl. The first source for language documentation is the Perl
distribution installed on your system. To access the documentation contained in the Perl distribution, use the
following commands:
• Open the Run Command dialog box (Tools|Run Command), and then type perldoc perldoc.
A description of the "perldoc" command will be displayed on your screen. Perldoc is used to navigate
Documentation 266
PHP Tutorial Komodo IDE only
Overview
Before You Start
This tutorial assumes:
• PHP 4.3.11 or greater is installed on your system. See the Debugging PHP documentation for
installation and configuration instructions.
• You are interested in PHP. You don't need previous knowledge of PHP; the tutorial will walk you
through a simple program and suggest some resources for further information.
• guestbook.php: This PHP program writes data from an HTML form to a data file, then extracts the
contents of the data file and formats it as HTML.
Analyzing guestbook.php
Introduction
In this step, you will analyze the PHP program on a line-by-line basis. Ensure that line numbers are enabled in
Komodo (View|View Line Numbers) and that the file guestbook.php is displayed in the Komodo editor.
HTML Header
Lines 1 to 8 - HTML Header
Komodo Tip: Notice that syntax elements are displayed in different colors. Adjust the display options for
language elements in the Preferences
dialog box.
PHP Declaration and Datafile
Line 9 - PHP Declaration
Lines 10 to 18 - Comments
• the // characters indicate a single-line comment in PHP programs; the # symbol can also be used.
Multi-line comments are nested in /* and */ characters, as shown on lines 27 to 30
Line 22 - Datafile
Komodo Tip: On line 23, type $da. Komodo displays a list of the variables declared above the cursor
position that begin with the letters da. This is AutoComplete.
GuestBook Class
Lines 25 to 28 - Class Declaration
• the var statement declares variables as class members, thus making them portable across functions
contained in the class
Komodo Tip: Click the mouse pointer at the end of line 25. Notice that the brace changes to a bold red font.
The closing brace on line 144 is displayed the same way. In this case, the braces mark the beginning and end
of a class. See Editing Files in the Komodo User Guide for more about matching braces.
GuestBook Function
Lines 34 to 37 - GuestBook Function
Komodo Tip: On line 38, type function GuestBook(. When you type the left parenthesis, Komodo
displays a pop-up hint that describes parameters for the function GuestBook. This is a CallTip.
Lines 40 to 44 - Check for Valid Form Entry
_getData Function
Lines 53 to 58 - _getData Function
• the "file" statement parses the contents of the file stored in the gb_dat variable into the $lines
array
• ♦ the @ symbol suppresses warnings; in this case, if the data file is empty, the program
generates a non-fatal error
• the if ($lines) statement checks to see if the $lines variable has data
• the "join" statement converts the $lines array to a string and places it in the variable
$this->data
PHP Pointer: Use the "@" operator with care; you could disable error messages for critical errors that
terminate the execution of the script.
outputData Function
Lines 64 to 66 - outputData Function
• the contents of the $this->data variable are written to the standard output using the echo
statement
_createEntryHTML Function
Lines 72 to 77 - Retrieve Form Data
• the PHP variable $_POST is used to provide data to the script via HTTP POST
• lines 74 to 77 extract the form data and place the items in variables
• On line 80, the validity of the name and message variables is tested:
• ♦ in !$name and !$message, "!" is a "not" operator; it is true if either variable is not true
♦ The || symbol is an "or" operator
PHP Pointer: PHP has two "or" operators: the word "or", and the symbol ||. The || operator has
precedence over the word "or", providing flexibility in logic tests.
Line 86 - Current Date and Time
• the variable $today contains the result of the PHP function date:
• ♦ the date function returns a string
♦ the "switches" are interpreted as follows:
♦ ◊ F: text month
◊ j: numeric day within month
◊ y: four digit year
◊ g: hour (12 hour format)
◊ a: AM / PM
• text and HTML tags are parsed with the $today variable and the form data
• the return statement supplies the result (true or false) of a function or the value of a variable to the
routine from which it was called
_writeDataFile Function
Lines 100 to 106 - Open the Data File
• the fopen function opens the file stored in the $this->gb_dat variable
• ♦ the w switch opens the file if it exists
♦ If the file does not exist, fopen will attempt to create it
♦ the file is opened for writing only, and the file pointer is positioned at the top of the file
• the if !$f statement checks to see if the $f variable contains a value
• the fwrite function writes the contents of $this->data to the file contained in the $f variable
Komodo Tip: Click on the minus symbol to the left of line 100. The entire_writeDataFile function
collapses. This is Code Folding.
addGuestBookEntry Function
Lines 120 to 125 - Call Functions for Writing Data
outputForm Function
Lines 127 to 142 - The Function for HTML Form
Closing Tags
Lines 148 to 151 - Closing Tags
• the $gb variable creates a new instance of the GuestBook class using the file specified in the
$datafile variable
• when the functions in the GuestBook class are complete, the PHP program is closed using the
syntax ?>
• closing HTML tags are written as output
1. Set breakpoints: On the guestbook.php tab in the editor, click on the gray margin immediately to the
left of the code in line 9 of the program. This sets a breakpoint, indicated by a red circle. Set a second
breakpoint on line 148.
2. Run the debugger: Select Go|Continue. In the Debugging Options dialog box, click OK to accept
the defaults (assuming that you created the CGI variables in the previous step, Running the Program).
Komodo Tip: Notice that the Debugger Options have been saved from the last time a PHP program was run
or debugged.
Komodo Tip: Debugger commands can be accessed from the Debug menu, by shortcut keys, or from the
Debug Toolbar. For a summary of debugger commands, see Debugger Command List.
3. Watch the debug process: A yellow arrow on the breakpoint indicates the position at which the
debugger has halted.
4. Line 9: Step In: Select Debug|Step In. "Step In" is a debugger command that causes the debugger to
execute the current line and then stop at the next processing line (line 19). The lines between line 9
and line 19 are comments, not processing statements, and are therefore ignored by the debugger.
5. View Variables: Expand the Bottom Pane (if necessary) by clicking and dragging the bottom margin
of the Komodo workspace. Variables defined in the program are displayed on the Locals tab.
6. Line 19: Select Go|Continue. The debugger moves to line 148. The GuestBook class is called from
line 148.
7. Line 148: Step In: The debugger is now processing the GuestBook function.
8. View Variables: The Locals tab displays all variables.
9. Line 35: Step In: Expand the $this variable on the Locals tab in the Bottom Pane. Notice that it
now has a sub-variable gb_dat, which stores the value of the data file.
10. Line 36: Step In: Continue to step in until the debugger stops at the _getData function. Continue
to select Step In to process each statement in the function. After line 57 has been processed and the
debugger is stopped at line 58, the $lines variable can be expanded on the Locals tab.
11. Line 58: Step Out: On line 58, select Step Out to process the rest of the _getData function. The
debugger will proceed to line 40, which follows the line where _getData was called.
• Step In: Executes the current line of code and pauses at the following line.
• Step Over: Executes the current line of code. If the line of code calls a function or method, the
function or method is executed in the background and the debugger pauses at the line that follows the
original line.
• Step Out: Executes the code without stepping through the code line by line (when the debugger is
within a function or method). The debugger stops on the line of code following the function or
method call in the calling program.
14. Line 40: Step In: Continue to select Step In until the debugger is on line 121, in the
addGuestBookEntry function. On line 121, the addGuestBookEntry function calls the
_createEntryHTML function.
15. Line 121: Step In: In the _createEntryHTML function, the program assigns variables to the CGI
input data configured in the Debugging Options.
16. Line 74: Step Out: The _createEntryHTML function completes, and processing returns to line
122.
17. Line 122: Step In: Use Step In to process each line of the addGuestBookEntry function, until
processing moves to the _writeDataFile function on line 102.
18. Line 102: Step In: Process line 102.
19. Open Watch Window: On line 102, the program opened the datafile (by default,
\tmp\guestbook.dat). To watch the activity in the datafile, select Tools|Watch File, then specify the
datafile.
20. Line 103: Step In: Continue to select Step In until line 108 has been processed. After line 108 is
processed, the contents of the $this->data variable are written to the datafile, as displayed in the
• Python 2.3 or greater is installed on your system. ActivePython is a free distribution of the Python
language. See the Debugging Python documentation for configuration instructions.
• You are interested in learning about Komodo functionality, including the debugger and the interactive
shell.
• You are interested in Python and have some programming experience either in Python or another
language.
See Interactive Shell and Debugging Programs for more information on this Komodo functionality.
• preprocess.py: The main program. This Python program parses input source files and produces
output filtered on a set of rules and statements embedded in the original input source.
• preprocess current file: A run command for executing preprocess.py on the file currently open in
Komodo.
• contenttype.py: A Python module used by the main program (preprocess.py) to identify the language
of a given file.
• content.types: A support file used by the Python module contenttype.py.
Analyzing preprocess.py
In this step, you will analyze the Python program preprocess.py in sections. This program is an advanced
Python script that is best addressed by focusing on certain areas within the code. Be sure that line numbers are
enabled in Komodo (View|View Line Numbers) and that preprocess.py is displayed in the Komodo Editor.
About Preprocessors: A preprocessor is a program that examines a file for specific statements called
"directive statements". These directive statements are interpreted, and the resulting program output is
conditional based on those statements. In languages like C/C++, preprocessing is a common step applied to
source files before compilation. The Python preprocess.py program mimics a C/C++ preprocessor using
similar directive statements.
About Directive Statements: Preprocessor directive statements are dependent on the preprocessor program
they are used within. In the preprocess.py program, a directive is preceded with a pound sign (#), and is
located alone on a line of code. Placing a directive on a unique line ensures the statement is included in a file
without breaking file syntax rules. Valid preprocess.py directives include:
#define <var>[=<value>]
#undef <var>
#if <expr>
#elif <expr>
#else
#endif
#error <error string>
Komodo Tip: Notice that syntax elements are displayed in different colors. You can adjust the display
options for language elements in the Preferences dialog box.
Lines 3 to 57 - Defining a Module Docstring
Komodo Tip: See Explore Python with the Interactive Shell to examine these docstrings, and other Python
elements, using the Komodo interactive shell.
Komodo Tip: Click on the minus symbol to the left of line 3. The entire section of nested help code is
collapsed. This is called Code Folding.
The custom contenttype module is used by the preprocess.py program and is not included in a standard
Python installation.
Komodo Tip: To interact directly with the contenttype.py module, see Explore Python with the
Interactive Shell for more information.
Defining an Exception Class
Lines 72 to 88 - Declaring an Exception
Komodo Tip: Click the mouse pointer on the closing parenthesis ")" on line 72. Notice that its color changes
to a bold red. The opening brace is displayed the same way. This is called "Brace Matching". Related features
in Komodo are Jump to Matching Brace and Select to Matching Brace, available via the Code menu.
Initializing Global Objects
Line 93 - Initializing log
• log is a global object used to log debug messages and error messages
Note that preprocessor directives recognized by the preprocess.py module are hidden in programming
language-specific comments.
Komodo Tip: Use the Code sidebar, available in the Left Pane, to browse the general program structure of
all currently open files. For each file, the code browser shows a tree of classes, functions, methods and
imported modules. Python instance attributes are also displayed.
Defining a Private Method
Lines 116 to 123 - Expression Evaluation
Preprocessing a File
The preprocess method examines the directives in the sample source file and outputs the modified
processed text.
Examines how programming comments are delimited (started and ended) based on the type of file (for
example, HTML, C++, Python).
This section defines advanced regular expressions for finding preprocessor directives in the input file.
Komodo Tip: Use the Komodo Rx Toolkit to build, edit, or test regular expressions. New to regular
expressions? The Regular Expressions Primer is a tutorial for those wanting to learn more about regex
syntax.
Lines 178 to 303 - Scanning the File to Generate Output
This block of code implements a basic state machine. The input file is scanned line by line looking for
preprocessor directives with the patterns defined above (stmtRes). This code determines whether each line
should be skipped or written to the output file.
The main method takes the text entered at the command line and uses the getopt module to parse the data
into arguments. These arguments are then passed into the "preprocess" method.
Analyzing contenttype.py
In this step, you will analyze the Python program contenttype.py in sections. This Python script is best
addressed by focusing on certain areas within the code. Be sure that line numbers are enabled in Komodo
(View|View Line Numbers) and that contenttype.py is displayed in the Komodo Editor Pane.
Open contenttype.py
In the Places sidebar, double-click the contenttype.py file. This file opens in the Editor Pane; a tab at the top of
the pane displays the filename.
• imports external modules used in this file (re, os, sys, logging)
• logging is not a standard module; it is new in Python 2.3
This section outlines the usage of the private _getContentTypesFile method located in the
contenttype module.
This section outlines the usage of the private _getContentTypesRegistry method located in the
contenttype module.
• locates the content.types file and scans it to calculate three mappings to return, as follows:
file suffix -> content type (i.e. ".cpp", a C++ implementation file)
regex -> content type (i.e. ".*\.html?", an HTML file)
filename -> content type (i.e. "Makefile", a Makefile)
This section outlines the usage of the public getContentType method located in the contenttype
module.
• takes one parameter (the name of the file to determine the content)
• returns a string specifying the content type (for example,
getContentType("my_web_page.htm") returns "HTML" )
• getContentType is the only publicly accessible method in the module
• ♦ Line 92: _getContentTypesRegistry is called to load the content.types file and
to load the mappings
♦ Lines 96 to 99: filenameMap is first checked to determine if the whole filename can be
used to find a match
♦ Lines 101 to 109: if the filename has a suffix (contains a '.'), the suffix map is then used to
find a match
♦ Lines 111 to 117: each regex in the regex map is then used to determine if it matches the
filename
♦ Line 118: returns the content type for the file (returns an empty string if no match was found
by the above three mappings)
1. Open the Source File: In the Projects sidebar, double-click the helloworld.html file. The file opens
in the Editor Pane.
2. Run Command: In the Toolbox sidebar under the python_tutorial toolbox, double-click the
preprocess current file command. A Preprocess Current File dialog box appears.
3. Preprocess Current File: In the Preprocessor Options text area, enter:
-D SAY_BYE
Click OK to run the program.
4. View Output: The helloworld.html file output is displayed on the Command Output tab as follows:
['path_to_file\\python_tutorials\\helloworld.html']
<html>
<head> <title>Hello World</title> </head>
<body>
<p>Hello, World!</p>
</body>
</html>
Python Tutorial Tip: For more information about the -D SAY_BYE command, see Using the Debugger.
Komodo Tip: For more infomation on using run commands in Komodo, see the Run Command Tutorial.
Using the Debugger
Generate output by running the program through the debugger without setting any breakpoints.
1. Run the debugger: Select the preprocess.py tab in the editor. From the menu, select
Debug|Go/Continue. In the Debugging Options dialog box, click OK to accept the defaults.
2. View the Debug Output Tab: Notice the messages in the bottom left corner of the Komodo screen;
these inform you of the status of the debugger. When the program has finished, program output is
displayed in the Bottom Pane, on the right side. If necessary, click the Debug Output tab to display
it.
This error message is the expected output by the preprocess.py program when no source file or arguments are
specified before it is run. The following instructions explain how to specify a file at the command line.
3. Specify a File to Process: In the Projects sidebar, double-click the file helloworld.html. Note the
preprocessor directives inside the comments (#) in this file. Select the preprocess.py tab in the editor.
From the menu select Debug|Go/Continue. In the Script Arguments text box on the Debugging
Options dialog box, enter helloworld.html. Click OK.
<html>
This error message is the expected output by the preprocess.py program when no command-line arguments
are specified with the source file helloworld.html. The following instructions explain how to specify a
command-line argument with the source file to be processed.
4. Specify an Argument with the Source File: Select Debug|Go/Continue. In the Script Arguments
text box in the Debugging Options dialog box, enter the following source file and argument: -D
SAY_BYE helloworld.html. Click OK.
<html>
<head> <title>Hello World</title> </head>
<body>
<p>Hello, World!</p>
</body>
</html>
In the helloworld.html file, if SAY_BYE is not defined, preprocessing generates an error. If SAY_BYE is
defined, the preprocessor includes the line <p>Hello, World!</p> in the body of the output of the
HTML. This demonstrates how a Python preprocessor can be used to conditionally include blocks of a source
file being processed.
5. View the Debug Output Tab: Notice the HTML output and compare the result to the actual file
helloworld.html.
6. View Rendered HTML: On the right side of the Bottom Pane, click the HTML tab. The rendered
HTML for the helloworld.html file is displayed in the Bottom Pane. Click the Output tab to return to
the HTML code.
7. Create New File: To create a new HTML file that will later contain the HTML code in the Bottom
Pane, select File|New|File from Template. In the New File dialog box, select the HTML Template.
Click Open.
8. Save the Output: Delete the contents of the new HTML file tab in the Editor Pane, and then select
the contents of the Output tab on the Bottom Pane. Copy the contents to the new HTML file tab in
the Editor Pane. Select File|Save As to save the file with a unique name.
9. Specify Another Source File: Go through steps 3 to 5 using the file helloworld.py in place of
helloworld.html. Notice how the output displayed is now in Python, (for example, print "Hello,
World!"). This demonstrates how the preprocess.py program can be used to process files written in
different language types.
1. Set a breakpoint: On the preprocess.py tab, click on the gray margin immediately to the left of the
code on line 347 of the program. This sets a breakpoint, indicated by a red circle.
2. Run the debugger: Select Debug|Go/Continue. In the Script Arguments text box on the Debugging
Options dialog box, enter the following source file and argument (if not there from a recent run): -D
Komodo Tip: Debugger commands can be accessed from the Debug menu, by shortcut keys, or from the
Debug Toolbar. For a summary of debugger commands, see the Debugger Command List.
3. Watch the debug process: Notice that the line where the breakpoint is set (line 347) turns pink. Also,
a yellow arrow appears on the breakpoint. This arrow indicates the position at which the debugger has
halted.
4. View variables: On the Debug tab, click the Locals tab. If necessary, resize the pane by clicking and
dragging the upper margin. On the Locals tab, notice the declared variables are assigned values.
Examine the infile variable. This variable contains the name of the file specified above
(helloworld.html).
• Step In: Executes the current line of code and pauses at the following line.
• Step Over: Executes the current line of code. If the line of code calls a function or method, the
function or method is executed in the background and the debugger pauses at the line that follows the
original line.
• Step Out: When the debugger is within a function or method, Step Out executes the code without
stepping through the code line-by-line. The debugger stops on the line of code following the function
or method call in the calling program.
5. Step In: Select Debug|Step In until the debugger stops at line 129, the preprocess method. "Step
In" is a debugger command that causes the debugger to enter a function called from the current line.
6. Set another breakpoint: Click on the gray margin immediately to the left of the code in line 145 to
set another breakpoint. Line 145 is where getContentType is called.
7. Run the debugger: Select Debug|Go/Continue.
8. Step Over: When line 145 is processed, the variable contentType is assigned the source file's
(helloworld.html) type (HTML). "Step Over" is a debugger command that executes the current line of
code. If the line of code calls a function or method, the function or method is executed in the
background and the debugger pauses at the line that follows the original line.
9. View variables: On the Debug tab, click the Locals tab. Examine the contentType variable. This
variable contains the type of the source file; the type is "HTML" for helloworld.html.
10. Set another breakpoint: Click on the gray margin immediately to the left of the code in line 197 to
set another breakpoint. Line 197 is inside of the loop where the source file helloworld.html is being
processed.
11. Run the debugger: Select Debug|Go/Continue.
12. Add Watches for Variables: On the Debug tab, click the Watch tab. Click the New button in the
lower-right corner of the Debug tab. An Add Variable dialog box appears. In the Add Variable
dialog box, enter lineNum in the text box. Click OK. Notice that the lineNum variable and its
value are displayed in the Watch tab. The lineNum variable is the line number of the line currently
being processed in the source file helloworld.html. Follow the above steps again to enter a watch for
the variable line. The line variable contains the actual text of the line currently being processed.
13. Run the debugger: Select Debug|Go/Continue. Notice how the variables in the Watch tab change
every time the debugger stops at the breakpoint set at line 197. Also, notice the output in the right side
of the Debug tab. This output changes as new lines are displayed.
14. Disable and Delete a breakpoint: Click on the red breakpoint at line 197. The red beakpoint is now
white with a red outline. This breakpoint is now disabled. Click on the disabled white breakpoint.
This removes the breakpoint, but does not stop the debugger.
If starting this section of the tutorial with currently open Python shells, please follow the steps below to ensure
the Python shell's current directory is the Python Tutorial directory.
1. Close any Current Python Shells: Click the "X" button, located in the upper-right corner of the
Shell tab, for each open Python shell.
2. Make sure python_tutorial is open (bold): If you haven't opened it before, click on the Python
Tutorial link on the Start Page. If it's in your list of recent projects in the Projects pane,
double-click it.
Start using the interactive shell with the Python Tutorial project files:
1. Start the Interactive Shell: On the Tools menu, select Interactive Shell|Start New Python Shell. A
Python Shell tab is displayed in the Bottom Pane.
2. Import a Module: At the ">>>" Python prompt in the interactive shell, enter: import
contenttype
Notice that another ">>>" Python prompt appears after the import statment. This indicates that the
contenttype module imported successfully.
3. Get Help for a Module: At the prompt, enter: help (contenttype)
The help instructions embedded in the contenttype.py file are printed to the interactive shell screen.
This is useful for easily accessing Python documentation without installing external help files.
4. Get Help for a Method in a Module: At the prompt, press the up arrow to redisplay previously
entered commands. When help (contenttype) is redisplayed, enter .getContentType at
the end of the command. The entire command is as follows:
help (contenttype.getContentType)
Press Enter. The help instructions for the getContentType method are printed to the shell screen.
The ability to instantly access help on specific Python functions is a powerful use for the interactive
shell.
5. Run a Method: At the prompt, enter:
contenttype.getContentType("helloworld.html")
Notice the output identifies the file type as HTML.
6. Run Another Method: At the prompt, enter:
contenttype.getContentType("helloworld.py")
Notice the output identifies the file type as Python.
7. Run a Final Method: At the prompt, enter: contenttype.getContentType("test.txt")
Notice the output identifies the file type as Text. The contenttype module uses several tests to
determine the data type used within a file. The test that determined that test.txt is a text file simply
analyzed the file extension.
Preprocessor Reference
The preprocess.py program in this tutorial is a simplified version of another Python preprocess.py script
available via http://starship.python.net/crew/tmick/#preprocess. The version available on starship.python.net
is an advanced portable multi-language file preprocessor.
• Ruby 1.8.0 or greater is installed on your system. See the Debugging Ruby documentation for
configuration instructions.
• You are interested in learning about Komodo functionality, including the debugger.
• You are interested in Ruby and have some programming experience either in Ruby or another
language.
Introduction
In this step, you will analyze the program in sections. Ensure that line numbers are enabled in Komodo
(View|View Line Numbers) and that the file menagerie.rb is displayed in the Komodo editor.
Komodo Tip: Notice that syntax elements are displayed in different colors. You can adjust the display
options for language elements in the Preferences dialog box.
Line 8 to 13 - Define and Initialize the Entry class
The Entry class contains variables which hold data for individual entries in our simple database, and the
behavior of that data. Information about each animal in our menagerie will be contained in an Entry class
object.
These variables need to be private (instance variables) rather than global because there will be an instance of
the Entry class for each animal in the menagerie.
• attr_reader is a Ruby shortcut for exposing @sci_name, @desc, and @time_mod as read-only
attributes of the Entry class.
• the sci_name= method ensures that @time_mod is updated with the current time whenever
@sci_name is updated.
• the desc= method does the same thing for @desc.
Komodo Tip: Click on the minus symbol to the left of line 18. The section of code for the sci_name method
is collapsed. Doing this at line 8 collapses the entire Entry class. This is called Code Folding.
Line 28 to 35 - Data Behavior Methods
• the contains? method lets the cmd_search method determine if a particular entry contains the string
the user entered (see line 82).
• the to_sci method returns the scientific name and description of an entry (see lines 77 and 83).
• the $help global variable contains a string with information on command usage, providing an easy
way for methods to display help information when needed.
The Menagerie class contains the @menagerie hash: the container which holds the multiple instances of the
Entry class. It also contains all the methods available to the user of the application (via the command
interface starting at line 154.
The name of the animal is stored as a key in the @menagerie hash. It references the Entry object which
contains the rest of the information, namely the scientific name (sci_name) and description (descr). All
the information we store on each animal is kept in two separate areas -- the @menagerie key and the Entry
it points to.
• the split method (from Ruby's String class) allows us to enter an entire record in one line, specifying
the separator character we intend to use
• line 60 checks for an existing entry of the same name
• if none is found, a new entry (i.e. Entry.new) is added
• if there is an existing key of the same name, the entry is only updated if there is a change to
sci_name or descr (or both)
Exercise: After completing the tutorial, come back to this section and try writing a more "user friendly"
version of this cmd_add method which asks for the name, scientific name and description separately (i.e. one
at a time).
Line 74 to 88 - Searching for Entries
• line 100 specifies that the argument for cmd_list is called "not_used" - a placeholder argument name
which tells us that the method will not actually use the argument
• line 101 calls the dump method of the YAML class (see line 6) to show the entire Menagerie object
in YAML format
• line 105 to 112: checks if the first character of the fname argument is "!"; this sets the overwrite
variable which determines whether cmd_save can overwrite an existing file
• line 115 to 117: if overwrite is false and the specified file exists, warn the user with a helpful
message.
• line 118 to 122: if the fname argument exists, set the @fname instance variable, if not, prompt the
user with a useful error message.
• line 123 to 126 uses ruby's File class to open the file for writing
• a file descriptor (fd) is created on line 124 which is written to in the next line (a YAML dump of our
menagerie)
• line 127 to 131 provides error handling for problems during the save
The program needs a way to handle input from the user. This section deals with parsing input and splitting it
into commands which call methods in the Menagerie class, and arguments for those methods.
The output of the last command (including "Error: undefined method...") indicates that something is not
working correctly. Debugging can help trace this problem. Type quit in the Output window before starting
the debugger.
Breakpoints are used to identify exactly where a program may be having problems. A bug has been
intentionally left in the cmd_delete method which can illustrate this.
1. Set a breakpoint: On the menagerie.rb tab, click on the gray margin immediately to the left of the
code on line 93 of the program. This sets a breakpoint, indicated by a red circle.
2. Run the debugger: Select Debug|Go/Continue (or enter 'F5', or use the Debug Toolbar). The
Debugging Options dialog box will then pop up; press the Return key or OK button to dismiss it.
You can pass program options to the program with the Script Arguments text box, but this particular
program doesn't take any.
3. Enter commands: In the Command Output tab, re-enter the commands from the Running the
Program section ('load animals.yaml', 'list', and 'delete Komodo dragon').
Komodo Tip: Debugger commands can be accessed from the Debug menu, by shortcut keys, or from the
Debug Toolbar. For a summary of debugger commands, see the Debugger Command List.
4. Watch the debug process: After the last command, notice that a yellow arrow appears where
breakpoint is set (line 93). This arrow indicates the position at which the debugger has halted. This
tells us that our command did match a key in @menagerie.
5. Check the relevant variables: Click on the Self tab to see the current object's instance and class
variables. Notice the @menagerie hash. Expand the view of the hash by clicking the plus symbol
next to it. It should only contain the "Leopard gecko" entry after the "Komodo dragon" entry has been
deleted.
6. Set a Watch variable: Select the Watch tab of the debugger window, highlight
'@menagerie.has_key?(name))' on line 92 and drag it into the Watch tab. You can place most
valid Ruby expressions in this area, including assignments, whether they're in the program or not. For
example, placing the expression 'x = 2 + 2' in the Watch tab will show that a local variable called
'x' is set to 4.
• Step In: Executes the current line of code and pauses at the following line.
• Step Over: Executes the current line of code. If the line of code calls a function or method, the
function or method is executed in the background and the debugger pauses at the line that follows the
original line.
• Step Out: When the debugger is within a function or method, Step Out executes the code without
stepping through the code line-by-line. The debugger stops on the line of code following the function
or method call in the calling program.
6. Step In: Select Debug|Step In until the debugger stops at line 166 (print status_message). "Step In"
is a debugger command that causes the debugger to enter a function called from the current line.
7. View local variable: On the Debug tab, click the Locals tab. Examine the status_message
variable. This variable contains the message that will be returned to the user.
8. Run the debugger: Select Debug|Go/Continue (or enter 'F5', or use the Debug Toolbar). The
command returns "#<Entry:0x83096f8>Error: undefined method `[]' for
#<Entry:0x83096f8>" which is not a very user-friendly message. The cmd_delete method is
missing an explicit return value to provide if the deletion was successful.
9. Fix the problem: On the Debug menu, click Stop (or use the Stop button on the Debug Toolbar).
Uncomment line 94 by removing the "#".
10. Disable and Delete a breakpoint: Click on the red breakpoint at line 93. The red breakpoint is now
white with a red outline. This breakpoint is now disabled. Click on the disabled white breakpoint.
This removes the breakpoint.
11. Run the debugger: Select Debug|Go/Continue and re-run the commands used previously ('load
animals.yaml', 'list', and 'delete Komodo dragon'). The 'delete' command now returns the message
"Deleted".
• ruby-lang.org: The main page for the ruby language, including release notes and downloads.
• ruby-doc.org: Extensive online documentation including tutorials and links, with well organized core
and standard library API documentation.
• Programming Ruby: Tutorial and reference.
• why's (poignant) guide to ruby: An entertaining introduction to Ruby.
• Learn to Program: Excellent Ruby tutorials for beginners by Chris Pine.
• Ruby on Rails - Documentation: Documentation and tutorials for the Ruby on Rails web
development framework.
• A recent local installation of Ruby (1.8.6 or later). See the Debugging Ruby documentation for
debugger configuration instructions.
• A local installation of Ruby on Rails (version 2.x or later).
• The Komodo Ruby on Rails extension.
• Access to a MySQL or SQLite database. If using MySQL, you'll need to install a Ruby library:
Several online "how to" guides are available for installing and configuring Ruby on Rails. See Rails
Resources for links to setup tutorials and installation bundles
Tutorial Scenario
This tutorial walks you through the creation of a very simple Rails application. The Movie Lending Library
application is a web application that allows you to add, remove, borrow and return movies from a shared
library.
Komodo has a very powerful Ruby on Rails project extension with macros and commands for further
automating the creation of Rails applications. The entire application can be created within Komodo using
these tools and Komodo itself, without having to work at the command-line.
1. Create a new Rails scaffold using the Ruby on Rails Komodo project extension.
2. Create a MySQL database.
3. Create the core of the application using just the project macros.
4. Write some code to iteratively develop the Movie Library application.
5. Test and debug the application.
When creating a new Rails project, you can tell Komodo where the Rails executable lives, and which database
you prefer to use, at Preferences | Languages | Ruby | Rails. Komodo will make sure that the version of
Rails matches the current version of Ruby.
1. In Komodo, select Project | Create Ruby on Rails Project. Create a new directory/folder in a
convenient location (e.g. C:\rails\movielib on Windows, or /home/username/rails/movielib on OS X
or Linux). You can create a new Rails project in an existing directory, but it's advisable to not have
more than one Rails project in a directory.
2. Give the file a useful name. Since this tutorial creates a movie lending library, let's call it
movielib.komodoproject.
If Rails has been installed correctly, you should see output in the bottom pane saying "The movielib project is
built". The movielib project should open in the Places sidebar on the left, and should show the directories
created by the rails command (app, components, config, db, etc.).
When you installed the Ruby on Rails extension, it added a "Ruby on Rails" toolbox in the Toolbox sidebar.
You'll find the tools that carry out the most common functions for creating and managing Rails applications
there. If you prefer not to keep the Toolbox sidebar open, you can access these tools by name via the Tools |
Invoke Tool menu item.
Rails tools have a lot of third-party dependencies, and sometimes a new release of one of them can break the
tools in the Rails project template. If a macro or command isn't working as expected, check the the online
FAQs for possible solutions.
If MySQL is installed locally and can accept connections by 'root' without a password (it often does by
default), click the Create Databases macro in the Rails Tools project folder to create the database.
If you have set a MySQL root password, created another MySQL account that you would like to use, or are
running the server on a different host, you will need to configure the database.yml file:
1. Open the config project folder and double-click database.yml to open it in an editor tab.
2. As necessary, modify the username and password values to match the configuration of your
MySQL server. If you're not sure what values to use, leave the default values ('username: root'
and 'password: '). In this tutorial, we will only be working with the development database and
test databases, but you should modify the production section as well to avoid seeing errors
when running the Create Databases macro below.
3. If you are running MySQL on a remote server, add the setting hostname: host to the
development: configuration block, or modify the value if that setting is already present (set to
localhost by default.
If you would like to use a database server other than MySQL, consult the Rails documentation on configuring
this file, making sure you have the necessary database drivers installed, and creating the database manually.
The database macros in the project will only work with MySQL.
If the database.yml file (and the database server) are configured correctly, a database called movielib (as
specified in the database.yml file - derived from the project name) will be created and an alert will appear
indicating that the database creation is done.
Creating a Scaffold
Generating a scaffold is a quick way to get a skeletal, working Rails application that can be modified
iteratively. Since most database driven web applications are very similar in their basic design, Rails builds a
generic application based on the information in your models which you can then modify to meet your specific
requirements.
In the Generators folder, double-click the scaffold macro. In the dialog box enter movie as the model name,
and title:string as the only attribute in the movie model. Click OK.
A list of the files that were created and/or modified should then appear in the Command Output tab.
Several files are created and opened in editor tabs. You can unclutter your workspace by closing most of
them. For now close all the files but movie.rb, movie_tests.rb, movie_controller.rb, and
movie_controller_tests.rb. We'll return to most of the other generated files later.
Migration
Now that we've defined the model in Rails, we need to apply them to our database. In Rails this is done with
the 'rake db:migrate' command. Again, there's a macro to do this for us.
Double-click the db:migrate macro in Rails Tools|Migrate. The Command Output tab should show that the
table 'movies' has been created.
Let's add a couple of sanity checks to the model: we want to verify that all movie entries have a title, and that
there are no duplicates. Bring up movie.rb and add this code at lines 2 and 3, immediately after class
Movie < ActiveRecord::Base:
validates_presence_of :title
validates_uniqueness_of :title
You should see code-completion after you type val each time.
In the second line, after you type :t you can press the tab key to have it finish :title. If this does nothing
verify that the "Use tab character to complete words like Ctrl+Space" setting is on under
Edit|Preferences|Editor|Smart Editing.
Bring up movie_test.rb, delete the test_truth method that the scaffolder generated for you (this will look
slightly different with Rails 3), and add these two tests:
def test_present
m = Movie.new
assert !m.valid?
m.title = "Rocky"
assert m.valid?
end
def test_unique
m1 = Movie.create(:title => "Alien")
assert m1.valid?
m2 = Movie.create(:title => "Alien")
# First film should still be valid
assert m1.valid?
assert !m2.valid?
m2.title += "s"
assert m2.valid?
end
Komodo IDE introduced unit-test integration with version 4.3. To run the unit tests click on the Test Results
tab in the bottom window. In the test plan dropdown menu on the right side. Select "test:units", and press the
Run button immediately to the right.
This command might fail if the Ruby and Rake executables in the system path are different from the ones
you've indicated in the Preferences settings. In this case, you'll need to change the path environment Komodo
runs in.
You should see the tests run for a few seconds, and then a list of results will appear. If you get a message
along the lines of the following: "Run `rake db:migrate` to update your database then try again." you probably
skipped that step above. Run the Rails Tools/Migrate/db:migrate macro, and retry the tests.
The result tab should show that 2 tests passed, 0 failed, and there were 0 errors. There's also an "Information"
line, where Komodo displays lines of output from the underlying test pass that might be of interest, but don't
fit in any particular test.
Other commands (e.g. rake test:functionals below) can be run in a Run Command.
Click on the Test Results tab, select the test:functionals test from the dropdown list, and press the Run
button.
This time you should see that two of the tests failed: test_should_create_movie and
test_should_update_movie. If you click on the red "failures" button above the results, it will cycle
through the failed tests.
The Details window shows the results for each test. Make sure the test_should_create_movie test is
highlighted in the first window.
assert_difference('Movie.count') do
post :create, :movie => { }
end
The problem is that the controller_test's call to 'post' hits the controller's create command, which does go
through the validation check. The failure to pass the check prevents a new movie from being created, and we
still have two entries in the database after the block runs. Let's make a change that should satisfy the model's
rules:
def test_should_create_movie
assert_difference('Movie.count') do
post :create, :movie => { :title => "movie 3" }
end
If we rerun the test, we're now down to one failure. Click on the red failure button to move to the failed test,
then double-click on the line starting with
test/functional/movies_controller_test.rb:35:in
`test_should_update_movie' in the Details window to see the failed code.
def test_should_update_movie
put :update, :id => movies(:one).id, :movie => { }
assert_redirected_to movie_path(assigns(:movie))
end
What are those duplicate values? While the debugger is still running, enter the interactive shell with the
Debug|Inspect menu command, and type the line:
Movie.find(:all).map(&:title)
Ruby should reply with ["MyString", "MyString"]. Those values come from the file
test/fixtures/movies.yml. The problem is that when Rails reads the fixtures file to populate the database, it
doesn't run the values through ActiveRecord's validation checks. Once you start using controller methods, like
the update method here, the values are run through validation checks.
Let's fix that. Stop the debugger and change one of those "MyString" movie titles to something more
interesting, like "Who Is Harry Kellerman and Why Is He Saying Those Terrible Things About Me?", or "My
Other String", if you're not up for all that typing.
In the Run folder, double-click the run server macro. This will start one of the Mongrel, lighttpd, or
Webrick servers, depending on your Ruby installation, and run it in a separate console window.
2: 'script/server webrick',
with:
2: 'script/server webrick',
3: 'script/rails server webrick'
While the application the Rails scaffolder generates is certainly serviceable, there are some tweaks that will
immediately make it friendlier:
If we're going to enter a number of movies, let's speed things up by stealing the New Movie link from
index.html.erb, and placing it in show.html.erb:
from index.html.erb, and paste it at the end of show.html.erb. Put a "|" character at the end of the previous line
to maintain consistency. Save show.html.erb. No need to restart the server -- switch to the app, enter a new
title at the New Movie screen, press the "Create" button, and you should have a "New movie" link.
Similarly, it would be nice if the cursor was in the Title field when we load the New movie page, similar to
how the Search field has the focus on Google's home page. Since we're going to be using the Prototype
library, I added the javascript_include_tag directive to the head section of
app/views/layouts/movies.html.erb (Rails 3 does this already):
<script type="text/javascript">
Event.observe(window, "load", function() {
$('movie_title').focus();
});
</script>
If you type this code in, you should see code-completion after 'Event.' and a call-tip after '(' if you've
enabled the prototype.js code intelligence API catalog in Preferences.
Again, there's no need to restart the server. As soon as you load the new controller and view code, your
changes will come into effect.
Installing Plugins
Too many software packages gain bloat as they reach higher revisions. Rails is different -- the Rails team
actually dropped much of its code going from 1.2 to 2.0. Most of the dropped functionality is still available as
plugins, but now people who want it need to explicitly install it. The idea is that people who don't need a
particular widget shouldn't subsidize the few who want it.
We're going to install two plugins, to handle in-place editing and pagination.
Fortunately Komodo ships with macros that install these plugins, and add necessary patches. Open the Rails
Tools|Plugins folder in your Rails project, and run the in-place editing and pagination
macros. If you try to install a plugin that's already installed, you'll get a warning.
It's easy to create new plugin macros. Every installable plugin is treated as a resource, usually in a public
subversion repository, and identifiable with a URI. On the command-line you would invoke ruby
script/install plugin <URI> for Rails v2. In Komodo you would just need to copy one of the
macros, edit it, and replace the old URI with the new one.
Plugins need to be installed in new Rails projects that use them (i.e. the plugin is added to the specific Rails
application, not to Rails itself). You have to restart the server after doing this, so this would be a good time to
stop the current Rails server. Find the window it's running in, and press Ctrl-C (Ctrl-Break on
Windows). We'll restart it again later.
Adding Pagination
First we'll add pagination by making these changes to the movie model and controller.
@movies = Movie.find(:all)
to
• For Rails 2:
• For Rails 3:
cattr_reader :per_page
@@per_page = 10
Finally, add pagination to the view. The last three lines of app/views/movies/index.html.erb should contain
this code:
Testing Pagination
Now we could start up the server, enter a few dozen different titles, and verify that the pagination is working.
Or we can write another test, in movies_controller_test.rb:
def test_pagination
Movie.delete_all
35.times {|i| Movie.create(:title => "title #{i}")}
get :index
assert_tag(:tag => 'div',
:attributes => { :class => 'pagination'})
assert_tag(:tag => 'span',
:content => '« Previous',
:attributes => { :class => 'disabled'})
assert_tag(:tag => 'span',
:content => '1',
:attributes => { :class => 'current'})
assert_tag(:tag => 'div',
:attributes => { :class => 'pagination'},
:child => { :tag => 'a',
:attributes => { :href => "/movies?page=4" },
:content => "4" })
end
Those assert_tag tests might look like they were pulled out of thin air, but the debugger was very useful
in writing them. Originally the test read like this:
def test_pagination
Movie.delete_all
35.times {|i| Movie.create(:title => "title #{i}")}
get :index
assert_response :success
end
We used the debugger to stop at the final line, captured the contents of @request.body by double-clicking
on it in the Self tab of the Debug tab, and pasted it into an empty HTML buffer in Komodo, and found the
paginator was generating this code:
<div class="pagination">
<span class="disabled">« Previous</span>
<span class="current">1</span>
<a href="/movies?page=2">2</a>
<a href="/movies?page=3">3</a>
<a href="/movies?page=4">4</a>
<a href="/movies?page=2">Next »</a>
</div>
We then entered an interactive context with the Debug|Inspect menu item, found some documentation on
the assert_tag, and interactively tried out the expressions, starting with simple expressions and making
them more complex. A final set that covered the situations was then copied into the test.
Having to bring up an editing screen to change the spelling of a movie is cumbersome. This is easy to fix.
<td class="dvdlib_item">
<% @movie = movie %>
<%= in_place_editor_field :movie, :title %>
</td>
It should replace the line that displays the movie's title in a readonly field (<%= h(movie.title) %>)
with a user-editable field. You can also remove the link to the edit page (in the show.html.erb file as well), and
remove views/movies/edit.html.erb by right-clicking its icon in the project view, selecting Delete, and
choosing "Move to Trash".
Finally you need to tell your controller you're doing in-place editing:
Also in the controller, change the edit method so it doesn't go looking for the now-deleted edit.html.erb file.
A quick way to find this method is with the Sections panel in the statusbar -- it's the text field immediately to
the right of a green circle.:
# GET /movies/1/edit
def edit
@movie = Movie.find(params[:id])
respond_to do |format|
format.html { render :action => "show" }
format.xml { render :xml => @movie }
end
end
Once again, run the unit and functional tests to verify these changes didn't break anything. They should be
fine, and this would be a good time to verify their actions in the browser, especially because in-place editing is
def self.down
remove_column :movies, :borrower
remove_column :movies, :borrowed_on
remove_column :movies, :due_on
end
end
Let's add another validation routine. This one's more complex: we want to verify that if any of the
borrower, borrowed_on, and due_on fields are specified, they all are, and we'll do a sanity check on
the value of due_on. This is to guard the case where someone hits the controller without going through one
of our own views.
def validate
if borrowed_on.blank? && borrower.blank? && due_on.blank?
# ok
elsif !borrowed_on.blank? && !borrower.blank? && !due_on.blank?
if due_on <borrowed_on
errors.add(:due_on, "is before date-borrowed")
end
elsif borrowed_on.blank?
errors.add(:borrowed_on ,"is not specified")
elsif borrower.blank?
errors.add(:borrower ,"is not specified")
else
errors.add(:due_on ,"is not specified")
end
end
def test_borrower
m = Movie.create(:title => "House")
m.borrowed_on = Date.today
assert !m.valid?
m.borrower = "Dave"
assert !m.valid?
m.due_on = Date.yesterday # Date.today - 1 if using Rails 3.0
assert !m.valid?
m.due_on = m.borrowed_on + 3
assert m.valid?
Handling Checkouts
We're almost done. Let's outline the remaining pieces, since we're now moving away from the code Rails
generated for us:
Here's the RHTML for the checkout screen. Create the file app/views/movies/checkout.html.erb with this
code. One way to create this file is to right-click the app/views/movies folder and select "Add New File..."
<h1>Checkout a movie</h1>
<p>Title: <%= h @movie.title %></p>
<% form_tag :action => 'checkout', :id => @movie do %>
<p>Your name: <%= text_field(:movie, :borrower) %>
<%= submit_tag 'Check out' %>
<% end %>
<%= link_to 'Back to the library', movies_path %>
You might have noticed that we accept any name to be typed in the form. We can get away with this because
we're building a lending library that our friends will use. In a public application you would need to build a
separate table to track members, and another one to handle login status, and then you'd have to deal with
issues like password hashing and email address verification. All good information, and interesting, but beyond
the scope of this tutorial. See the references section for more info.
Here are the two new methods we need to add to the movies_controller.rb:
# Non-Rest methods
def checkout
@movie = Movie.find(params[:id])
if request.post?
# It's an update
@movie.borrower = params[:movie][borrower]
def return
@movie = Movie.find(params[:id])
@movie.borrower = @movie.borrowed_on = @movie.due_on = nil
@movie.save!
redirect_to(movies_url)
end
I assume HTML output to simplify the code. If you want you can add the respond_to and format
statements. Note how we overload the checkout method -- if it's part of a get request, we render the form.
Otherwise we assume we're processing the submitted form.
<h2>Movies</h2>
<table>
<tr>
<th class="dvdlib_header">Title</th>
<th class="dvdlib_header">Status</th>
</tr>
<% for movie in @movies %>
<tr>
<td class="dvdlib_item">
<% @movie = movie %>
<%= in_place_editor_field :movie, :title %>
</td>
<% if movie.borrower %>
<td class="dvdlib_item">Signed out by: <%= h movie.borrower %></td>
<td class="dvdlib_item">Due <%= h movie.due_on %></td>
<td class="dvdlib_item"><%= link_to 'Return', :action => 'return', :id => movie %></td>
<% else %>
<td class="dvdlib_item"><%= link_to 'Check out', :action => 'checkout', :id => movie %></td
<td class="dvdlib_item"><%= link_to 'Remove', { :action => 'destroy', :id => movie },
:confirm => 'Are you sure?', :method => :delete %></td>
<% end %>
</tr>
<% end %>
</table>
<% if @movies.size > 0 -%>
<br />
<%= will_paginate(@movies) %>
<% end %>
<br />
<%= link_to 'Add new movie', new_movie_path %>
def test_checkout_get
get :checkout, :id => movies(:one).id
assert_response :success
end
def test_checkout_put
post :checkout, :id => movies(:one).id, :movie => {:borrower => "Fred"}
assert_redirected_to movies_path
end
We were expecting no errors, but this time we get an undefined local variable or method
error for borrower at around line 97-99 of movie_controller.rb. Sure enough, we forgot to put a ":"
before the param name "borrower". Change it to :borrower, rerun the tests, and they should pass.
People familiar with the first version of this tutorial will recall using the debugger to correct a problem like
this. Writing tests is more efficient. You can debug Rails apps if you need to, though. Press the Rails
Tools|Run|debug rails app tool, set breakpoints at the points in the controllers and views you're
interested in, and then hit them with your application.
Finally, start the server one more time, and verify that your application now works as you expect. You're
ready to take this one live.
Rails Resources
Tutorials and Reference Sites
• Ruby on Rails: The home page of the Ruby on Rails project. Links to downloads, documentation and
other resources.
• Rolling with Ruby on Rails (Revisited): A Windows-based tutorial by Bill Walton and Curt Hibbs.
• Instant Rails: An all-in-one bundle for windows containing Ruby, Rails, Apache, and MySQL.
• 74 Quality Ruby on Rails Resources and Tutorials: An excellent compendium of Rails resources.
• Simplify Views with Rails 2.0: A screencast covering the resource-based approach to building a web
application with Rails 2.0.
• You are interested in XSLT. Previous knowledge of XSLT is not required for this tutorial. The XSLT
Tutorial walks you through a simple program and later suggests various resources for further
information.
Line Numbers). Be sure the mailexport2html.xsl file is displayed in the Komodo Editor Pane.
XSLT Header
Lines 1 to 3 - XML and XSLT Declarations
• an XSLT program is an XML document - thus, the XML version and character set are declared on the
first line
• the namespace declaration on the second line tells the "parser" (the XSLT interpreter) that XSLT
elements are prefixed with xsl: to prevent confusion with user-defined element names and
non-XSLT elements
• xsl:output controls the appearance of the generated output; for example, the presence of this line
generates a META declaration in the head of the HTML output
Komodo Tip: Notice that different types of language elements are displayed in different colors. Adjust the
display options for language elements in the Preferences dialog box.
XSLT Pointer: Processing routines in XSLT programs are enclosed in opening and closing tags similar to
those in XML.
HTML Header
Line 6 - XSLT "template"
XSLT Pointer: XSLT commands have (up to) four components: namespace ("xsl"), element ("template"),
attribute(s) ("match="), and attribute value(s) ("/").
XSLT Pointer: XSLT uses XPath expressions to select data from XML documents. On line 6, match="/"
selects a "node" in the XML document's hierarchy, rather than a specific item of data.
Lines 7 to 11 - HTML Tags
• processes each node of the XML document (that is, each sub-section contained beneath the current
position in the XML document)
• for each node, the XSLT "engine" (the internal processor) checks the XSLT program for a matching
template
• the first XML tag with a corresponding template is <EMAIL>
• after processing all the nodes in the XML document, processing returns to line 13, where the closing
tags for the HTML page are written to the output
• line 15 closes the XSLT processing routine, completing the program
• when line 18 is processed, content in <HEADER> tags in the XML document are processed
• lines 19 and 21 write standard HTML formatting around the content generated in line 20
• on line 20, the value-of statement selects content contained in the <SUBJECT> tag and writes it to
the output document
Komodo Tip: Click the minus symbol to the left of line 19. The entire section of nested code is collapsed.
This is called Code Folding.
Lines 22 to 29 - call-template
• after the From: text, the call-template routine causes the XSLT program to proceed to the
template formatEmail on line 51; after completing the formatEmail routine, processing returns
to line 23
• with-param indicates that the parameter address should be applied to the contents of the
<ORIGADDRESS> XML tag
• the same selection and formatting routine is applied to the contents of the <DESTADDRESS> XML
tag on lines 26 to 28
XSLT Pointer: Notice the <BR/> HTML tag on line 25. XML and XSLT treat all tags as container tags that
have both opening and closing elements. However, some HTML tags (like <BR> and <IMG>) stand alone,
and do not require a closing tag. They are represented with a closing slash. XSLT tags also use a closing slash
if they are not a tag pair (as shown on line 23).
Process Email
Lines 33 to 34 - Process First Message
XSLT Pointer: Comments in XSLT programs are enclosed in the tags <!-- and -->, the same as in
HTML.
Lines 36 to 39 - Process Email Body
• after processing the email header, the XSLT program proceeds to line 36
• the contents of the BODY tag are placed in the HTML tags
Komodo Tip: XSLT programs and XML input documents must be "well-formed" in order to perform
transformations. Komodo's Background Syntax Checking makes it easy to identify and fix coding errors.
1. Assign XML input file: On the Debug menu, click Go/Continue. In the Debugging Options dialog
box, specify mailexport.xml as the XML input file. Use the Browse button to navigate to the directory
containing the XSLT tutorial project files.
2. Run the debugger: Click OK to run the debugger.
3. Stop the debugger: From the Debug menu, select Stop to end the debugging process.
4. View Debug Output: Notice the messages displayed on the status bar in the bottom left corner of the
screen; these indicate the debugger status. The results of the transformation are displayed on the
Debug tab.
5. View the Output as HTML: On the right side of the Bottom Pane, click the HTML tab. The
rendered HTML is displayed in the Bottom Pane. Click the Output tab to return to the HTML code.
6. Create New File: To create a new HTML file that will later contain the HTML code in the Bottom
Pane, select File|New|New File. In the New File dialog box, select the HTML Category. Click Open.
7. Save the Output: Delete the contents of the new HTML file tab in the Editor Pane, and then select
the contents of the Output tab on the Bottom Pane. Copy the contents to the new HTML file tab in
the Editor Pane. Select File|Save As to save the file with a unique name.
1. Step In/Assign the XML input file: If necessary, click on the mailexport2html.xsl tab in the editor.
From the menu, select Debug|Step In. In the Debugging Options dialog box, specify mailexport.xml
as the XML input file. This should already be set if the input file was assigned in the previous step.
Assigning the XML input file to the XSLT program file selects the XML file as the default input file
when running the transformation.
2. Start Debugging: In the Debugging Options dialog box, click OK to start debugging.
Komodo Tip: Debugger commands can be accessed from the Debug menu, by shortcut keys, or from the
Debug Toolbar. For a summary of debugger commands, see the Debugger Command List.
3. Watch the debug process: A yellow arrow on line 7 indicates the position in the XSLT file where the
debugger has halted.
4. View Debug tab: In the Bottom Pane, click the Debug tab. On the right side of the Debug tab, click
the Call Stack tab. On the Call Stack tab, notice that the current call stack is the template in line 6 of
the XSLT program.
5. Set a breakpoint: On the mailexport2html.xsl tab in the Editor Pane, click the gray margin
immediately to the left of the code on line 12. This sets a breakpoint, indicated by a red circle.
Komodo Tip: Breakpoints can be set at any time. An enabled breakpoint is a solid red circle. A disabled
breakpoint is a white circle with a red outline. Click once in the gray margin to enable a breakpoint. Click an
enabled breakpoint once to disable it.
6. Line 7: Continue: Select Debug|Go/Continue. The debugger runs until it encounters the breakpoint
on line 12. If no breakpoint had been set, the debugger would have run to the end of the program.
7. Line 12: Step In: Click Debug|Step In. Notice the debugger jumps to line 33 of the XSLT program,
and shows a pointer in the XML file on line 3. When the debugger processed line 12
(xsl:apply-templates), it looked for a template that matched the top node in the XML
document (<EMAILCOMMENTS>). When no matching template was found, it proceeded to the next
node in the XML document (<EMAIL>) and found a matching template on line 33.
8. View the Debug tab: Notice that the Call Stack tab displays the current template match. Previous
template matches can be selected from the list; double-clicking them jumps to the corresponding lines
in both files.
9. Line 33: Step In: Use the Step In command until the current-line pointer in the XSLT file is on line
20.
10. Line 20: Step In: Watch the Bottom Pane as you Step In line 21. The xsl:value-of statement
selects the contents of the <SUBJECT> field on line 7 of the XML file and places it within the HTML
tags on lines 19 and 21.
11. Line 21: Step In: Line 22 calls the template formatEmail on line 45. Continue to step in until line
49 is processed. The formatEmail template is processed with the address parameter on line 46.
This routine processes the contents of the <ORIGADDRESS> node in the XML document. In order to
generate the hyperlink in the output HTML document, lines 48 and 49 concatenate the string
mailto: with the contents of the <ORIGADDRESS> node.
12. Line 49 to end: Go/Continue: On Debug menu, click Go/Continue to run the rest of the XSLT
program. The program's output is displayed in the Bottom Pane: raw output in the Output tab and
rendered output in the HTML tab.
• XSLT
• XPath
• XML
4. Click Run. The results are displayed on the Command Output tab.
Use the Command Output tab to interact with commands; if the command accepts input, enter it directly into
the command on the Command Output tab. The Command Output tab has the following features:
• Output written to stderr (standard error output) is displayed in red at the top of the Command
Output tab.
• To terminate a running command, click the button in the upper right-hand corner of the tab.
• Many keyboard shortcuts available in the Komodo editor can also be executed on the Command
Output tab. For example, 'Ctrl'+'Shift'+'8' ('Cmd'+'Shift'+'8' on Mac OS X) displays white space and
'Ctrl'+'Shift'+'7' ('Cmd'+'Shift'+'7' on Mac OS X) displays line endings (if the default key binding
scheme is in effect).
The Toggle Raw/Parsed Output View button is discussed in the Parsing Command Output section of this
tutorial.
1. In the Placessidebar, double-click the file play.txt. The file opens in the Editor Pane; a tab at the top of
the pane displays its name.
2. Select Tools|Run Command.
3. In the Run field, enter the command dir (on Windows) or ls -al (on Linux).
4. Select the Insert output check box, and then click Run. The contents of Komodo's current directory
are inserted into play.txt.
1. Open play.txt from the Run Command tutorial project (if it is not already open).
2. Select all six lines containing the word frog.
3. Select Tools|Run Command.
Use the grep command line utility to filter lines of text. Use grep to filter out all but the red frogs from the
list.
This tutorial assumes the grep utility is installed on your system and is in your system's PATH. Grep is a
Linux utility that searches for text and characters in files. Windows operating system users may not have a
grep installation. There are a number of free versions available on the Web. Search using the keywords
grep for Windows.
1. Open play.txt from the Run Command tutorial project (if it is not already open).
2. Select the "5 red frogs" and "6 green frogs" lines.
3. Select Tools|Run Command.
4. In the Run field, enter the command grep red.
5. Click Run to remove all but the red frogs.
To open this dialog box, right click on any saved command and select Properties.
Click the arrow button to the right of the Run field to view a list of Run Command shortcuts.
1. In the Projects sidebar, double-click the file play.txt to open it for editing.
2. Select Tools|Run Command.
3. In the Run field, enter the command:
echo "%F"
4. Click Run.
To open a current HTML file in a Web browser, combine %F with the %(browser) shortcut.
Now that you have searched for a word or selection in Google, try the following shortcut to search for PHP
methods.
1. Open index.html.
2. Select the text mysql_info methods in the file.
3. Select Tools|Run Command.
4. In the Run field, enter the command "%(browser)
http://www.php.net/manual-lookup.php?pattern=%S".
5. Select the Add to Toolbox check box to save this command.
6. Click Run to search mysql_info methods in PHP's online manual.
These two commands are built into Komodo. If the default key binding scheme is in effect, 'Ctrl'+'F1'
('Cmd'+'Ctrl'+'/' on Mac OS X) starts a Google search for the current selection. 'Shift'+'F1' ('Cmd'+'/' on OS X)
in a Perl, Python or PHP file starts a help search appropriate for that language. Customize searches in the
Preferences dialog box (Edit|Preferences|Language Help).
The %(ask) and %(askpass) shortcuts always prompts the user for data. Other shortcuts can use the
orask modifier to prompt the user if no valid value could be determined.
Windows users should enclose all Komodo shortcuts (with the exception of %(browser)) in double
quotation marks. This is necessary to ensure that any spaces in filenames or file paths are interpreted
correctly.
%(ask[:NAME:[DEFAULT]])
%(askpass[:NAME:[DEFAULT]])
where NAME is an optional name to use when prompting in the dialog box and DEFAULT is an optional
default value to place in the dialog box.
For example:
4. Enter your favorite number and click OK to finish running the command.
Refine this shortcut by adding a more meaningful name than "Value 0" and a more appropriate default value.
2. In the Run field, enter the command: echo Your favorite number is "%(ask:Fav
Number:42)"
3. Click the Run button to run the command. The Interpolation Query dialog box will now look like
this:
4. If your favorite number does not happen to be 42, enter a different number and click OK to finish
running the command.
%(SHORTCUT:orask[:NAME])
where NAME is an optional name to use when prompting in the dialog box.
In the previous step we created a shortcut to search for the selected word on Google with the command:
%(browser) http://www.google.com/search?q="%W"
However, if nothing has been selected and there is no word under the cursor, the command fails. In this case,
it would be better if the command prompted you for a search term.
Komodo Tip: Use the Komodo Rx Toolkit to build, edit, or test regular expressions. New to regular
expressions? The Regular Expressions Primer is a tutorial for those wanting to learn more about regex
syntax.
Named groups in Python regular expressions (e.g. (?P<name>pattern) ) can be used to sort match data.
The names 'file', 'line', 'column' and 'content' can be used as column titles in Parsed Ouptut mode, with the
matching text displayed in the columns under the names.
For example, the output of the "Find in Files" example below contains the following:
<file>:<line>:<content>
An regular expression to match the important elements of this line could be:
(.+?):(\d+):(.*)
However, to view this information as a useful list, we need to define the column headings by naming the
groups:
(?P<file>.+?):(?P<line>\d+):(?P<content>.*)
When parsing the run command output, Komodo determines that hello.pl is the file, 5 is the line and
print "Hello, frogs!\n"; is the content, and displays the output sorted into the appropriate
columns:
Parts of the output that match outside the named groups in the regular expression (e.g. the ":" delimiters seen
above) are visible when viewed as raw output, but are hidden when viewed as a list. You can use this
technique to filter out extraneous information when viewing output as a list.
For example, if you were not interested in viewing the line number of the match, you could change the regular
expression to the following:
(?P<file>.+?):\d+:(?P<content>.*)
Komodo can use the information from the 'file' and 'line' groups to open a file in an editor tab at a particular
Note that findstr is a Windows command line utility that searches for strings in files.
5. Select the Add to Toolbox check box to save this command.
6. In the Start in field, enter:
%(ask:Start Directory:%D)
(When the command is run, Komodo should prompt for the "Start Directory" using the directory of
the current file, or %D as the default value).
7. Select the Parse output with check box and enter:
^(?P<file>.+?):(?P<line>\d+):(?P<content>.*)$
as the regular expression with which to parse.
8. Select the Show parsed output as a list check box.
9. Click Run. The Interpolation Query dialog box is displayed.
10. Click OK to run findstr. A list of all occurrences of "frogs" in the files of the Run Command tutorial
project is displayed on the Command Output tab.
Windows
Note: Older versions of Komodo on Windows installed in a directory which included the version number (e.g.
"ActiveState Komodo IDE 4.2"), which allowed for side-by-side installations of different versions of
Komodo. If you wish to do this, manually specify an install directory with a version number.
Linux
/opt/Komodo-[IDE|Edit]-<version>/
OS X
Windows Vista
C:\Users\<user>\AppData\Roaming\ActiveState\Komodo[IDE|Edit]\<version>
Linux
/home/<user>/.komodo[ide|edit]/<version>
Mac OS X
/Users/<user>/Library/Application Support/Komodo[IDE|Edit]/<version>
The location of this directory can be overridden using the KOMODO_USERDATADIR environment variable.
• Do you have Norton Anti-Virus (NAV) installed, or more specifically, the File System Realtime
Protection feature enabled?
The problematic relationship between Komodo and Norton Anti-Virus' File System Realtime
Protection feature is a known issue, which we are working to remedy. In the meantime, you can
disable NAV Corp 7.5 FSRP before running Komodo, and then re-enable it after Komodo starts.
If none of these seem to apply to you, please follow the instructions in this FAQ entry to log a bug in
Komodo's bug database.
To view the Left Pane, click the Show/Hide Left Pane button on the toolbar, use the options on the View
menu, or use the associated key binding.
To view the Bottom Pane, click the Show/Hide Bottom Pane button on the toolbar, use the options on the
View menu, or use the associated key binding.
To maximize your Editor Pane, hide the other panes in the Komodo workspace:
1. Click the close arrow button that appears in the top right corner of each of these panes.
3. In the same Debugger Launch Options dialog, enter your command-line arguments. These are sent to
the script and not to the interpreter. Separate the arguments with spaces.
4. Click OK.
Step 1: Ensure the logs are for the time Komodo crashed
Komodo's log files are only for the last time Komodo was run. If you have restarted Komodo since the time it
crashed on you, you must reproduce the crash so that the log files are relevant.
Note: If Komodo is hung (i.e. won't shutdown), you may need to manually stop the komodo-bin process:
Windows
Press 'Ctrl'+'Shift'+'Esc' to open "Windows Task Manager". Select the "Processes" tab.
Right-click on the "komodo.exe" entry and select "End Process".
Mac OS X
Right-click (or 'Option'+click) on the Komodo head icon in the Dock and select the "Force Quit"
option.
Linux
At the terminal run ps ux | grep komodo-bin to determine the Komodo process id (or "pid").
Then run kill -9 PID where "PID" is the process id from the previous command.
Komodo stores its log files in the host data subdirectory of the user data directory.
3. Create a bug describing what happened just before the crash in the Komodo or OpenKomodo bug
database. (If you do not already have an ASPN or ActiveState bug database account, you can open
one by selecting "New Account".)
4. Once the bug has been created, add the error log files by selecting Create in the Attachments and
Dependencies section of the bug report.
Another sizable component of Komodo is language support. Komodo is so tightly integrated with Perl,
Python, Ruby and PHP that it is necessary to include components of those languages, at specific version
levels, for debugger and editor support.
1. xdebug: in the command or shell window, enter php -m. "xdebug" should be listed under Zend
Modules (and not under PHP Modules). If this is not the case, your configuration is incorrect. See
"Common PHP Configuration Problems" below.
2. Syntax Checking: in Komodo, select Edit|Preferences. Click on Smart Editing, and ensure that
"Enable background syntax checking" is checked. Open a PHP file and enter something that is
syntactically incorrect, such as:
<?
asdf
echo test;
?>
Komodo should display a red squiggly line under echo test;. If it does not, it indicates that
Komodo is not able to communicate with the PHP interpreter.
3. Debug: if steps one and two were successful, ensure that the debugger is functioning by opening a
PHP program and debugging it. Ensure that the correct Preferences are configured for PHP.
If any of the steps above were unsuccessful, proceed to the next section.
• Multiple PHP executables on one machine: in Komodo's Preferences, explicitly specify the PHP
interpreter configured in your php.ini file. The location of the php.ini file can also be explicitly set.
• Verify the PHP version: PHP 4.0.5 or greater is required for PHP syntax checking. PHP 4.3.11 or
greater is required to debug PHP programs.
• Verify Xdebug library specification: The location of xdebug.dll (Windows) or xdebug.so (Linux)
must be defined the php.ini file, for example:
♦ Windows: zend_extension_ts=C:\php-4.3.7\extensions\php_xdebug.dll
♦ Linux: zend_extension=/php-4.3.7/extensions/php_xdebug.dll
• Ensure that the Xdebug extension is configured correctly in the php.ini file as per the Remote PHP
Debugging instructions.
• Windows 2000 upgrade: if you upgraded to Windows 2000 from an earlier version of Windows,
check the value of the "COMSPEC" variable in the "System variables" (as described above). It should
point to C:\WINNT\system32\cmd.exe, and not command.com. If you must change the
variable, reboot your system.
• There are known issues regarding the installation of PHP on Windows Millennium systems; please
refer to the PHP site for installation information.
Warning
xdebug: Unable to initialize module
Module compiled with debug=0, thread-safety=1 module API=20001222
PHP compiled with debug=0, thread-safety=1 module API=20001222
These options need to match
... download an updated version of xdebug.dll (Windows) or xdebug.so (Linux) from the
Xdebug.org site.
It is easier to debug sessions using remote debugging. Run the script under a web server and start the
debugging session from a web browser. Komodo intercepts the session and debugs it. All session data is
available and modifiable through the Variable tabs.
When debugging Python programs that use Psyco, the breakpoints will be ignored. This is due to the
optimizations/changes made by the psyco compiler.
You can work around this problem with the following code which disables Psyco while debugging:
import logging
if not logging.Logger.manager.loggerDict.has_key('dbgp'):
import psyco
psyco.full()
If you have configured your Apache installation to use Virtual Hosting (see
httpd.apache.org/docs/1.3/vhosts/), you can add directives to your VirtualHost sections to specify how
Komodo's PHP debugger extension operates for those hosts. Use the "php_admin_value" to set specific
debugger settings for that virtual host. Here is an example:
NameVirtualHost *
<VirtualHost *>
php_admin_value xdebug.enabled 0
DocumentRoot "/Apache/htdocs/"
ErrorLog logs/www.error.log
Servername www.yourdomain.com
</VirtualHost>
<VirtualHost *>
php_admin_value xdebug.enabled 1
DocumentRoot "/Apache/htdocs/"
ErrorLog logs/debug.error.log
Servername debug.yourdomain.com
</VirtualHost>
This will enable debugging under debug.yourdomain.com, but not under www.yourdomain.com. You can
additionally configure the Virtual Host to use a specific machine for remote debugging:
<VirtualHost *>
php_admin_value xdebug.enabled 1
php_admin_value xdebug.remote_host komodo.yourdomain.com
DocumentRoot "/Apache/htdocs/"
ErrorLog logs/debug.error.log
Servername debug.yourdomain.com
</VirtualHost>
For more information on configuring Virtual Hosting under Apache, see the Apache documentation at
httpd.apache.org/docs/.
Why don't breakpoints work when I use the Psycoextension in Python? 332
Komodo User Guide
To run your compilation of PHP under Komodo with CGI emulation, you have to add a CGI environment
variable called REDIRECT_STATUS with any value.
I moved my Komodo installation on Linux, and am now getting Perl debugging errors. 333
Komodo User Guide
Alternatively, the %(ask:...) interpolation shortcut could be populated with defaults or replaced with
static values:
CVS requires a real terminal for adding change descriptions. Be sure to set Run in: New Console in the
command's properties.
Komodo ships with a 32-bit version of ruby-debug-base, which will not work with 64-bit versions of Ruby.
To fix this:
Komodo will automatically find and use the new version of the debugging library.
How can I run additional CVS commands from within Komodo? 334
Key Binding Schemes
The following pages list the key bindings for Komodo's default keybinding schemes:
To view the current list of key bindings for your Komodo installation, including any custom key bindings,
select Help|List Key Bindings. The default key binding scheme is set according to your platform. To select a
different key binding scheme, select Edit|Preferences|Editor|Keybindings.
To duplicate your current keybindings on a new system, copy the desired .kkf to the corresponding schemes
directory on the target system, then start (or restart) Komodo on that system. The copied scheme will be
available for selection in the key binding preferences.
Windows/Linux Scheme
Code Browser
Editor
Back Shift+Backspace
Backspace Backspace
Beginning of Line (first char/first column) Home
Cancel AutoComplete Escape
Ctrl+C
Copy
Ctrl+Insert
Ctrl+X
Cut Shift+Delete
Ctrl+Shift+X
Delete Delete
Delete Word Left Ctrl+Backspace
Delete Word Right Ctrl+Delete
End of Line End
Go to End of Document Ctrl+End
Go to End of word Ctrl+E
Go to Line... Ctrl+G
Go to Next Bookmark F2
Go to Next Line Down
Go to Previous Bookmark Shift+F2
Go to Previous Line Up
Go to Top of Document Ctrl+Home
Insert Newline Return
Insert Newline (align with current line) Ctrl+Shift+Return
Insert Newline (continue comments) Shift+Return
Insert Newline (no favors) Ctrl+Return
Insert Next Key as Literal Character Ctrl+M
Join current and next lines Ctrl+K, Ctrl+J
Move Back Part of Word Alt+Right
Move Forward Part of Word Alt+Left
Move Left One Character Left
Move One Character Right Right
Move One Word Left Ctrl+Left
Move One Word Right Ctrl+Right
Page Down Page_Down
Editor 337
Komodo User Guide
Page Up Page_Up
Ctrl+V
Paste
Shift+Insert
Paste and Select Ctrl+Shift+V
Redo Ctrl+Y
Reflow paragraph(s) Ctrl+Q
Remove All Bookmarks Ctrl+Shift+F2
Repeat next keystroke N times Ctrl+K, Ctrl+U
Scroll One Line Down Ctrl+Down
Scroll One Line Up Ctrl+Up
Select All Ctrl+A
Select Next Character Shift+Right
Select Next Part of Word Alt+Shift+Right
Select Next Word Ctrl+Shift+Right
Select Page Down Shift+Page_Down
Select Page Up Shift+Page_Up
Select Previous Character Shift+Left
Select Previous Part of Word Alt+Shift+Left
Select Previous Word Ctrl+Shift+Left
Select to Beginning of Line (first char/first column) Shift+Home
Select to Beginning of word Ctrl+Shift+W
Select to End of Document Ctrl+Shift+End
Select to End of Line Shift+End
Select to Next Line Shift+Down
Select to Previous Line Shift+Up
Select to Top of Document Ctrl+Shift+Home
Toggle Bookmark Ctrl+F2
Toggle Overtype/Insert Mode Insert
Transpose Current and Previous Characters Ctrl+T
Trigger preceding autocomplete list or calltip Ctrl+J
Undo Ctrl+Z
Zoom Font Size Down Ctrl+Shift+-
Ctrl+Shift+=
Zoom Font Size Up
Ctrl+Shift++
Editor 338
Komodo User Guide
Find
Find Next F3
Find Next Result Ctrl+Shift+F3
Find Next Selected Ctrl+F3
Find Previous Shift+F3
Find in Files... Ctrl+Shift+F
Find... Ctrl+F
Incremental Search Ctrl+I
Incremental Search Backwards Ctrl+Shift+I
Replace... Ctrl+H
General
Ctrl+W
Close Window
Ctrl+F4
Edit Properties Alt+Return
Least Recently Viewed File Ctrl+Shift+F6
Most Recently Viewed File Ctrl+F6
New File (default type) Ctrl+Shift+N
New File... Ctrl+N
Next File Ctrl+Page_Down
Open File... Ctrl+O
Open Project... Ctrl+Shift+J
Previous File Ctrl+Page_Up
Refresh Status Ctrl+K, R
Save Ctrl+S
Save All Ctrl+Shift+S
Help
Find 339
Komodo User Guide
Source Code
Snippets 342
OS X Key Bindings (Default)
This page lists the default key bindings on Mac OS X. There are also pages that list the default key bindings
on Windows/Linux. On any platform, you can also choose to use Emacs key bindings. As any of these key
bindings schemes can be customized, these pages stand as references to the defaults. To view the current list
of key bindings for your Komodo installation (including any custom key bindings), select Help|List Key
Bindings. The different key binding schemes are either set according to the platform on which you installed
Komodo, or they are selected in Edit|Preferences|Editor|Keybindings.
Note: The "Meta" key referred to in the following list may be better known to Mac OS X users as the
"Command" key.
OS X Scheme
Code Browser
Back Shift+Backspace
Backspace Backspace
Beginning of Line (first char/first column) Meta+Left
Home
Cancel autocomplete Escape
Copy Meta+C
Cut Meta+X
Ctrl+Backspace
Cut rest of line
Ctrl+Delete
Delete Delete
Delete Word Left Meta+Backspace
Delete Word Right Meta+Delete
Meta+Right
End of Line
End
Meta+Down
Go to End of Document
Meta+End
Go to End of word Meta+E
Go to Line... Meta+L
Go to Next Bookmark F2
Go to Next Line Down
Go to Previous Bookmark Shift+F2
Go to Previous Line Up
Meta+Up
Go to Top of Document
Meta+Home
Insert Newline Return
Insert Newline (align with current line) Meta+Shift+Return
Insert Newline (continue comments) Shift+Return
Insert Newline (no favors) Meta+Return
Insert Next Key as Literal Character Meta+M
Join current and next lines Ctrl+K, Ctrl+J
Move Back Part of Word Meta+Alt+Right
Move Forward Part of Word Meta+Alt+Left
Move Left One Character Left
Move One Character Right Right
Move One Word Left Alt+Left
Move One Word Right Alt+Right
Page Down Page_Down
Page Up Page_Up
Paste Meta+V
Editor 344
Komodo User Guide
Editor 345
Komodo User Guide
Find 346
Komodo User Guide
Help
Help 347
Komodo User Guide
Snippets 349
Emacs Key Bindings (Default)
This page lists the default Emacs key bindings. There are also pages that list the default key bindings on the
Windows/Linux and Mac OS X platforms. As any of these key bindings schemes can be customized, these
pages stand as references to the defaults. To view the current list of key bindings for your Komodo installation
(including any custom key bindings), select Help|List Key Bindings. The different key binding schemes are
either set according to the platform on which you installed Komodo, or they are selected in
Edit|Preferences|Editor|Keybindings.
Emacs Scheme
Code Browser
Locate current scope... Ctrl+C, Ctrl+L
Debugger
Back Shift+Backspace
Backspace Backspace
Editor 351
Komodo User Guide
Editor 352
Komodo User Guide
Ctrl+Z
Scroll One Line Up
Ctrl+Up
Scroll current line to center of screen Ctrl+L
Scroll current line to top of screen Ctrl+X, !
Select Next Character Shift+Right
Select Next Part of Word Alt+Shift+Right
Select Next Word Ctrl+Shift+Right
Select Page Down Shift+Page_Down
Select Page Up Shift+Page_Up
Select Previous Character Shift+Left
Select Previous Part of Word Alt+Shift+Left
Select Previous Word Ctrl+Shift+Left
Select to Beginning of Line (always first column) Ctrl+Shift+A
Select to Beginning of Line (first char/first column) Shift+Home
Select to Beginning of word Ctrl+Shift+W
Shift+End
Select to End of Line
Ctrl+Shift+E
Select to Next Line Shift+Down
Select to Previous Line Shift+Up
Select to Top of Document Ctrl+Shift+Home
Set Mark Ctrl+Space
Alt+Ctrl+O
Split Line
Escape, Ctrl+O
Toggle Bookmark Ctrl+F2
Toggle Overtype/Insert Mode Insert
Transpose Current and Previous Characters Ctrl+T
Transpose Current and Previous Lines Ctrl+L
Ctrl+/
Undo
Ctrl+X, U
Zoom Font Size Down Ctrl+Shift+-
Ctrl+Shift+=
Zoom Font Size Up
Ctrl+Shift++
Find
Find Next F3
Find Next Result Ctrl+Shift+F3
Find 353
Komodo User Guide
Ctrl+X, )
End Recording
Ctrl+X, )
Ctrl+X, M
Execute Last Macro
Ctrl+X, e
Ctrl+X, (
Start/Resume Recording
Ctrl+X, (
General 354
Komodo User Guide
Source Code
Ctrl+C, #
Comment Region Ctrl+C, c
Ctrl+3
Complete Word (backwards) Ctrl+Shift+Space
Find All Functions Ctrl+F8
Find Next Function F8
Find Previous Function Shift+F8
Go to Definition Escape, .
Jump to Matching Brace Ctrl+]
Select to Matching Brace Ctrl+M
Ctrl+C, u
Un-comment Region Ctrl+Shift+3
Ctrl+2
Source Control
Ctrl+Shift+7
Show/Hide End of Lines
Ctrl+7
Show/Hide Output Pane Ctrl+Shift+O
Show/Hide Projects Sidebar Ctrl+Shift+P
Show/Hide Toolbar Button Text Ctrl+Shift+B
Show/Hide Toolbox Sidebar Ctrl+Shift+T
Ctrl+Shift+8
Show/Hide Whitespace
Ctrl+8
Split view of tab Ctrl+X, 5, 2
View Source Ctrl+C, Ctrl+S
Ctrl+Shift+5
View/Hide Indentation Guides
Ctrl+5
Ctrl+Shift+4
View/Hide Line Numbers
Ctrl+4
Ctrl+Shift+9
Word-wrap long lines
Ctrl+9
Vi Emulation
Komodo emulates the following Vi modes:
When you open a file in Komodo with the Vi scheme enabled, you start off in command mode.
Keystrokes in this mode control movement, deletion, cutting, pasting and other standard editing
commands that are generally mapped to Ctrl and Alt key combinations in other schemes.
• Input: entering text.
Hitting an "input" command key in Normal mode (i.e. 'i' to insert, 'a' to append, or 'o' to open a new
line and insert) puts the editor into Input mode. Keystrokes in this mode enter text. Use the 'Esc' key
to exit into Normal mode.
• Visual: visual selection of text with navigation keystrokes.
Similar to Vim's visual modes. Entering 'v' enables selection by character, 'V' enables linewise
selection, and 'Ctrl'+'v' enables blockwise selection. Navigation keystrokes within these modes
expand and contract the selection area. Use the 'Esc' key to exit into Normal mode.
• Command-line: running vi/ex commands.
In Normal mode, entering ':' opens a text box in the status bar at the bottom of the Komodo window
for entering Vi commands. The following Vi and Vim commands have been implemented in the
default Vi scheme:
♦ edit
♦ exit
♦ help
♦ next
♦ previous
♦ quit
♦ set
♦ splitview
♦ undo
♦ write
♦ wq
♦ xit
♦ number <line number>
♦ <range>s/<search string>/<substitution>/[g|i|I]
Custom Vi Commands
To add your own Vi commands, create a Toolbox folder named Vi Commands, then add Macros or Run
Commands to the folder. The macro or command is executed when you type its name in the Vi command-line
text box.
Command-line arguments can be passed to Macros using the koIViCommandDetail XPCOM service.
The IDL for this service is:
Vi Scheme
The default Vi scheme is based on the Default scheme (which varies slightly between platforms) and includes
all Default keybindings which do not conflict with those used in Vi emulation. To view the list of key
bindings for your current scheme, select Help|List Key Bindings. The following are key bindings which are
unique to the Vi scheme.
|
Vi: Move to Beginning of the Current Line
0
Vi: Move to Beginning of the Previous Line -
Code Browser
Back Shift+Backspace
Backspace Backspace
Beginning of Line (first visible char/first column) Home
Cancel AutoComplete Escape
Ctrl+W
Close Current Buffer
Ctrl+F4
Ctrl+C
Copy
Ctrl+Insert
Ctrl+X
Cut Shift+Delete
Ctrl+Shift+X
Delete Delete
Delete Word Left Ctrl+Backspace
Delete Word Right Ctrl+Delete
End of Line End
Go to End of Document Ctrl+End
Go to End of word Ctrl+E
Go to Line... Ctrl+G
Go to Next Bookmark F2
Go to Next Line Down
Go to Previous Bookmark Shift+F2
Go to Previous Line Up
Go to Top of Document Ctrl+Home
Insert Abbreviation Snippet by Name Ctrl+T
Insert Newline Return
Insert Newline (align with current line) Ctrl+Shift+Return
Insert Newline (continue comments) Shift+Return
Insert Newline (no favors) Ctrl+Return
Insert Next Key as Literal Character Ctrl+M
Join current and next lines Ctrl+K, Ctrl+J
Move Back Part of Word Alt+Right
Move Forward Part of Word Alt+Left
Move Left One Character Left
Move One Character Right Right
Move One Word Left Ctrl+Left
Move One Word Right Ctrl+Right
Page Down Page_Down
Page Up Page_Up
Ctrl+V
Paste
Shift+Insert
Paste and Select Ctrl+Shift+V
Redo Ctrl+Y
Reflow paragraph(s) Ctrl+Q
Remove All Bookmarks Ctrl+Shift+F2
Editor 361
Komodo User Guide
Editor 362
XML Catalogs
Komodo can add XML autocompletion support for any XML dialect with a DTD or RelaxNG Schema (XML
syntax). This is done by mapping external identifier entries to local copies of the DTD or RelaxNG Schema
for that document type using XML Catalogs.
A simple catalog for this XML dialect would look like this:
<?xml version='1.0'?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
prefer="public">
</catalog>
If your documents use the DOCTYPE declaration, you can add support for that in the catalog by using the
public and system identifier. For example, XUL uses DOCTYPE declarations like this one:
Komodo's catalog for XUL uses publicId and systemId in addition to uri for the mapping.
<?xml version='1.0'?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
</catalog>
• http://www.oasis-open.org/committees/entity/spec.html
Examples of XML catalog files can be found in the Komodo installation under:
• <komodo-install-directory>\lib\support\catalogs (Windows)
• /Applications/Komodo.app/Contents/SharedSupport/catalogs/ (OS X)
• <komodo-install-directory>/lib/support/catalogs (Linux)
• Keywords
• Style Names
• Terms
• Concepts
Komodo's system for defining multi-language syntax lexing and user-defined syntax highlighting is called
UDL (User Defined Languages). UDL files are written in a language called Luddite, then compiled into
Scintilla lexers and packaged for use in Komodo.
Introduction
Komodo includes a general-purpose lexer engine that loads a description resource, and walks it while lexing
the buffer. It currently allows for up to five sub-languages, each of which is expected to be a member of a
pre-defined family ("markup", "style", "client-side scripting language", "server-side scripting language", and
"template language"). The format of these resource files is low-level and intended to be fast to parse, so we
have provided a programming language that is intended to allow users to build lexers for their own
programming languages.
Currently these lexers allow for six-bit colorizing, meaning that both errors and warnings can be highlighted
in the buffer. The lexer description language allows for:
Luddite consists of a set of declarations, most of which can appear in any order, except for the initial "family"
declaration. This is because some declarations are family-specific, and bind to the prevailing family
declaration.
A Sample
The php-mainlex.udl file defines the PHP lexer. It is a useful example as it uses one of each of the language
families: markup (HTML), css (CSS), client-side (JavaScript), and server-side (PHP). It includes transitions
from HTML to JavaScript, CSS, and PHP, followed by transitions back to HTML from each of these
languages, and finally the main language modules.
language PHP
include "html2js.udl"
include "html2css.udl"
include "html2php.udl"
include "css2html.udl"
include "js2html.udl"
include "php2html.udl"
include "html.udl"
include "csslex.udl"
include "jslex.udl"
include "phplex.udl"
Working from the bottom of the list towards the top, we have four core files that contain code to describe how
to lex each language on its own. Above those are files that explain how to transition from one language to
another (e.g. "php2html.udl"). As rules are attempted in the order they're first presented, we normally need to
test transition rules before we attempt internal rules, which is why the core modules appear at the bottom.
Luddite in a Nutshell
Luddite programs consist of declarative statements separated either by newlines or semi-colons. Comments
start with "#" and continue to the end of line. Because it's a declarative language, the order of different
statements doesn't matter, but the order of rules in the same group does.
The Luddite compiler allows lists to be entered with minimal punctuation (i.e without quotes around strings,
or commas between entries). However, the following words should always be quoted when declared as strings
as they are reserved words in Luddite:
A Sample 366
Komodo User Guide
Families
Most lexer components need to declare which language family they belong to: markup, css, csl (client-side
language), ssl (server-side language - usually JavaScript ), or tpl (template language). This last language is
usually used by the server-side processor that has to determine which code is markup to be output "as is", and
which is server-side code to be executed (e.g. PHP's Smarty and Perl's Template Toolkit).
The default family is "markup". You can write a lexer for any language that lives in one family, and it won't
look like markup. This is an arbitrary starting point that makes sense for most template languages.
All directives in a file belong to the most recent family directive. When a new file is included, it starts off in
the family at the point of inclusion. If a new family is specified, when the include-file is processed, Luddite
pops to using the family that was current when the include began.
There are currently three domains that are family-specific: keywords, named patterns, and look-back tests,
which are used to disambiguate.
Example:
family csl
Styles
For each family, we currently need to specify the style from scintilla.iface that the family will use.
Example:
start_style CSL_DEFAULT
end_style CSL_REGEX
Keywords
Most sub-languages have a set of keywords that we want to color differently from identifiers. You specify
them using keywords, supplying a list of names and strings, which may be comma-separated, as in this code
for JavaScript:
Families 367
Komodo User Guide
get, "include", set
abstract debugger enum goto implements # ...
]
The string "include" is quoted because it is a Luddite keyword. Commas are optional, and comments can be
added at the end of a line inside a list.
You must generally specify a different list of keywords for each family, however it is possible to define some
languages without keywords (e.g. HTML).
Tell Luddite when to color a range of text as a keyword with the keyword_style directive. For example:
To prevent the color for an identifer from being converted into a keyword, use the no_keyword command.
Pattern Variables
To specify how Luddite should process text, provide a string for it to match verbatim, or provide a pattern.
The pattern syntax is nearly identical to Perl's regex language.
Patterns for a particular language tend to be repetitive. To make it easier to use them, Luddite supports
family-based pattern variables, which are interpolated into pattern expressions. These are the four pattern
variables used in the JavaScript lexer:
family css
Pattern variables can nest within one another. You need to keep track of which variables define a character
set, and which ones are intended to be used inside a character set.
Keywords 368
Komodo User Guide
initial IN_M_DEFAULT
The first statement means that we should start lexing at the state we call "IN_M_DEFAULT". Subsequent
initial statements are ignored, without warning messages.
state IN_M_DEFAULT:
'<?' : paint(upto, M_DEFAULT), => IN_M_PI_1
'<[CDATA[' : paint(upto, M_DEFAULT), => IN_M_CDATA
'<!--' : paint(upto, M_DEFAULT), => IN_M_COMMENT
When we're in the state we call "IN_M_DEFAULT" (Luddite turns this into an arbitrary number to be used by
Scintilla), if we match any of the above strings, we first will have Scintilla color (or "paint") everything up to
the current starting position the SCE_UDL_M_DEFAULT color (remember, the prefix is implicit), and then
change to the state named to the right of the "=>". The comma before "=>" is optional, but advisable in more
complex rules.
The match strings may use double-quotes instead of single-quoted. Simple C-like backslash-escaping is used,
such as ' and ", but not hex or octal escapes.
The "include" directive for the paint command paints from the last paint-point, to the position we end at.
Recall that paint(upto,[color]) stops at the position we were at when we attempted to match the
string.
I would like the last line to be colored like a processing instruction, even though I haven't completed it.
Luddite lets you do things to confound your users, such as choosing a different color for an incomplete
directive at the end of file. However, most of the time, you won't want to do this. If all of the first colors in a
state block map to the same color, Luddite will automatically supply that color for an end-of-file condition at
that state. In other words, the '/z/'-condition is rarely necessary.
1. Perl-like (?=...) lookahead test in a regular expression, which will match but won't advance the
cursor into that text.
2. The redo command. In the following example, we modify our rules for recognizing processing
instructions in HTML. If the "<?" is followed immediately by "php", and then by a non-name
character, we want to transition to the server-side family, which presumably implements a PHP lexer.
In the HTML lexer, we rewrite the state blocks for PIs as follows:
state IN_M_PI_1:
/./ : redo, => IN_M_PI_2
state IN_M_PI_2:
'?>' : paint(include, M_PI) => IN_M_DEFAULT
Wait a minute, you say. That does just the same thing, and less efficiently than when there was just the one
state. In fact, all state IN_M_PI_1 does is a so-called epsilon transition to state IN_M_PI_2 ("epsilon"
transitions don't consume input).
Go back to that sample at the beginning of this document. Notice that the "html2php.udl" file is included
before "html.udl". This file is short, and is reproduced here without comments:
family markup
state IN_M_PI_1:
/php\b/ : paint(upto, M_OPERATOR), paint(include, M_TAGNAME), \
=> IN_SSL_DEFAULT
Because "html2php.udl" is processed before "html.udl", its pattern will be attempted earlier. If the lexer finds
"php" followed by a word boundary, it will then paint the leading "<?" as a markup operator, paint the "php"
as a markup tagname, and then switch to the default state in the server-side language family.
If you write a Luddite program that ends up where two states do epsilon transitions to one another, the lexer
engine will detect this. More precisely, if it notices that it has carried out 1000 consecutive epsilon transitions,
it will move on to the next character. This shows up in Komodo as the rest of the buffer highlighted in a single
Pattern Syntax
The Luddite syntax for patterns is very similar to Perl's. Only forward slashes may be used as regex
delimiters, all the usual escaping rules apply. For example, JavaScript uses this pattern to handle single-line
comments:
state IN_CSL_DEFAULT:
# ...
# Swallow to end-of-line
/\/\/.*/ : paint(upto, CSL_DEFAULT), paint(include, CSL_COMMENT)
If no target state is specified, the lexer will stay in the current state.
Pushing States
In many languages you need to push one state, transition to another, and at some point return to the previous
state. There are many examples where this comes up in template-based languages.
In most Smarty files, you transition from HTML to Smarty on "{", and transition back on "}". But if you find
an open-brace while processing Smarty code, you should allow for a matching "}".
In RHTML, the delimiters "<%=" and "%>" are used to transition from HTML into a Ruby expression, and
back. These delimiters can occur in many different parts of HTML files, including attribute strings and
content. The lexer needs to be told which state to return to when it finishes processing the Ruby expression.
In Ruby proper, you can interpolate arbitrary amounts of Ruby code inside double-quoted strings between
"#{" and "}". By pushing a state when you find "#{" in a Ruby string, you can allow for multiple nested pairs
of braces in the expression, and return to the string when the matching "}" is reached.
The Luddite code for expressing this is simple. Let's look at how it's expressed for double-quoted strings in
Ruby:
state IN_SSL_DEFAULT:
#...
'"' : paint(upto, SSL_DEFAULT), => IN_SSL_DSTRING
#... Note the redo here for things that could be operators
/[$OP]/ : paint(upto, SSL_DEFAULT), redo, => IN_SSL_OP1
#...
state IN_SSL_DSTRING:
'#{' : paint(include, SSL_STRING), spush_check(IN_SSL_DSTRING), \
=> IN_SSL_DEFAULT
...
When we find "#{" while processing a double-quoted string, we push the state we want to return to
(IN_SSL_DSTRING), and transition to the default Ruby state (IN_SSL_DEFAULT), where we lex an
expression.
If we find an open-brace while looking for operators, we again push the default state on the stack.
To handle a close-brace, we carry out a "spop_check" test. If there's something on the stack, we pop it and
transition to the state it specified. Otherwise, we transition to the specified state. If users never made mistakes,
you would never need to specify a target state in a directive containing an "spop" command. But because
people are capable of typing things like:
cmd {
yield
}
Handling Newlines
Some template languages use line-oriented embedded languages. For example, in Mason you can insert a line
of Perl code by putting a '%' character at the start of the line.
The simplest way to express this in Luddite is to put an at_eol command in the transition into that state.
When the lexer reaches the end of that line, it will automatically transition into the specified state. For
example, the Luddite code to express this for the above Mason example is here:
state IN_M_DEFAULT:
/^%/ : paint(upto, M_DEFAULT), paint(include, TPL_OPERATOR), \
at_eol(IN_M_DEFAULT), => IN_SSL_DEFAULT
1. Targeting an "opposite" delimiter, so that one of the four characters "[", "{", "(" or "<" is matched by
its closing character "]", "}", ")", or ">" respectively. These pairs are hard-wired into UDL.
2. Targeting any character as the closing delimiter. Alphabetic characters can be targeted. The only
character that cannot be targeted is the "\".
3. Matching a delimiter.
4. Continuing use of a delimiter. For example, to support a construct like Perl's "s,\\,/,g" idiom, set
the target delimiter to ",", match it, and keep it as the target for one more match.
This code shows how the delimiter-oriented keywords are used to work together. We'll walk through support
for Perl's matching statement first:
state IN_SSL_DEFAULT:
# ...
/m([\{\[\(\<])/ : paint(upto, SSL_DEFAULT), \
set_opposite_delimiter(1), => IN_SSL_REGEX1_TARGET
/m([^\w\d])/ : paint(upto, SSL_DEFAULT), \
set_delimiter(1), => IN_SSL_REGEX1_TARGET
# ...
state IN_SSL_REGEX1_TARGET:
delimiter: paint(include, SSL_REGEX), => IN_SSL_REGEX_POST
/\\./ #stay
The first transition matches one of the open-bracket characters in a grouped pattern, and sets the target
delimiter to the opposite of the contents of the first pattern group. The opposite_delimiter() routine
requires its input to be one character long, and returns its input if it isn't one of the opening characters. So the
two patterns could be expressed with the one transition:
Handling a construct like Perl's substitution syntax is slightly more complicated because it can use various
delimiters (e.g. s/foo/bar/, s'foo'bar', s#foo#bar#, etc.). Furthermore, if the character after the 's' is an opening
bracket character, the full pattern can use either two pairs of bracketing delimiters, or non-bracketing
delimiters, as in
s[find] {replace}
s<first>/second/
White space is always ignored after the first pair. To encode this in Luddite we need several states:
state IN_SSL_REGEX2_TARGET1_OPPOSITE_2:
/\\./ : #stay
/[$WS]/ : #stay -- assume we're in {...} [ ... ]x
/([\{\[\(\<])/ : paint(upto, SSL_DEFAULT), \
set_opposite_delimiter(1), => IN_SSL_REGEX1_TARGET
/([^\w\d])/ : paint(upto, SSL_DEFAULT), set_delimiter(1), \
=> IN_SSL_REGEX1_TARGET
/\z/ : paint(upto, SSL_DEFAULT)
Matching the second half is similar to matching the delimiter after the 'm'.
The final part is handling constructs like the standard 's/.../.../' language. To do that we tell UDL to
keep the current delimiter for another round of matching:
Often when a construct is bracketed with matching delimiters, the target language is smart enough to ignore
inner matched pairs. For example, if in Ruby you were to write
puts %Q(first(middle)second)
Ruby would write out the string "first(middle)second". To encode this in Luddite use UDL's built-in stack:
state IN_SSL_QSTRING_NESTED2:
/\\./ : #stay
/[\[\{\(\<]/ : spush_check(IN_SSL_QSTRING_NESTED2), \
=> IN_SSL_QSTRING_NESTED2
/[\]\}\)\>]/ : spop_check, => IN_SSL_QSTRING_NESTED
/\z/ : paint(include, SSL_STRING)
Finally, you've probably noticed that we put an end-of-buffer transition in many of these states. Notice that the
final IN_SSL_QSTRING_NESTED2 state actually does no painting in its other matches. Normally Luddite
will look at the colors a state uses to determine how to color the rest of the text if it reaches the end of the
buffer. If more than one color is used, or none is used, the Luddite program should specify a color. Otherwise
it's possible that Komodo will repeatedly invoke the colorizer until something is chosen.
"Here documents" are a convenient way of defining multi-line strings. Typically they start by defining the
"terminating identifier", preceded by an operator like << or <<<. The string starts on the following line, and
ends when we find a line containing only the terminating identifier.
The following Luddite code outlines how to add here-document processing to a language, using PHP as an
example, where we assume a here document always begins with the three less-than characters followed by a
name, then the end of line:
IN_SSL_PRE_HEREDOC_1
state IN_SSL_PRE_HEREDOC_1:
/([$NMSTART][$NMCHAR]*)/ : set_delimiter(1), paint(include, SSL_IDENTIFIER)
/\r?$/ : paint(include, SSL_DEFAULT), => IN_SSL_IN_HEREDOC_1
state IN_SSL_IN_HEREDOC_1:
delimiter : keep_delimiter, paint(upto, SSL_STRING), => IN_SSL_IN_FOUND_HEREDOC_1
/./ : => IN_SSL_IN_HEREDOC_2 # Not this line
state IN_SSL_IN_FOUND_HEREDOC_1:
/[\r\n]+/ : clear_delimiter, paint(upto, SSL_IDENTIFIER), => IN_SSL_DEFAULT # Got it!
/./ : => IN_SSL_IN_HEREDOC_2 # The delimiter continues, so keep looking
]]>
In this example the keywords delimiter, keep_delimiter, and clear_delimiter all work
together. After matching the delimiter, we retain it with the keep_delimiter action, and then test to make
sure the delimiter is followed immediately by the end of the line. If it is, we clear it. Otherwise we return to
states IN_SSL_IN_HEREDOC_2 and IN_SSL_IN_HEREDOC_1, looking for a line that contains the
terminating identifier, and nothing else. By default matching a delimiter clears it, so we need to keep it and
then explicitly clear it. The following example shows why this is needed:
Disambiguation
In both Ruby and JavaScript, sometimes a '/' is just a '/', and sometimes it's the start of a regular expression.
Luddite's token_check directive directs this. For example, in JavaScript, to determine if a '/' is the start of a
regex, and not a division operator, you could write a test like this:
state IN_CSL_DEFAULT:
#...
'/' token_check : paint(upto, CSL_DEFAULT), => IN_CSL_REGEX
Note that the "token_check" directive is part of the test, not the action to perform. This states that if we do
match, color everything before the '/' with the default color, and change to the regex state.
What happens during a token_check test depends on the contents of the token_check block specified for
the current family. In a token_check block, you look at the tokens to the left of the current position. Each
token consists of a two-value tuple, containing its colored style, and its text. On each token, we can decide
whether to accept the token (meaning the test passes), reject the token (meaning it fails), or skip the token,
meaning we get the previous token in the buffer, working towards the beginning.
token_check:
CSL_OPERATOR: reject [")", "++", "--", "]", "}", ";"]
Disambiguation 375
Komodo User Guide
#### CSL_NUMBER: reject all
#### CSL_REGEX: reject all
#### CSL_STRING: reject all
You can provide either a list of strings and/or names, or the "all" keyword. Here are the rules on defaults:
Specifying Folding
To get Scintilla to calculate fold levels on each line, specify which tokens increase the folding level, and
which decrease it:
Authors writing UDL-based lexers for XML vocabularies can tap into this mechanism by using any
combination of the namespace, public_id, and system_id declarations to specify which language
Komodo should associate with a particular file, regardless of the actual extension of the filename it is saved
by.
For example, XBL (XML Binding Language) contains a combination of XML and JavaScript, and is widely
used for Firefox extensions and Mozilla applications. These files often are saved with names containing
".xml" extensions, but they usually contain the following prologue:
<bindings id="koListboxBindingsNew"
xmlns="http://www.mozilla.org/xbl" ...>
Any combination of the following three declarations in a Luddite file for XBL will be sufficient to direct
Komodo to load the Luddite-based XBL mode instead of the default XML mode:
namespace "http://www.mozilla.org/xbl"
system_id "http://www.mozilla.org/xbl"
• Windows: INSTALLDIR\lib\sdk\
• Mac OS X: INSTALLDIR/Contents/SharedSupport/sdk/
• Linux: INSTALLDIR/lib/sdk/
Simply place the SDK bin directory on your PATH and you should be able to run luddite:
# On Windows
C:\> set PATH=INSTALLDIR\lib\sdk\bin;%PATH%
C:\> set PATHEXT=%PATHEXT%;.py
C:\> luddite help
# On Mac OS X
$ export PATH=INSTALLDIR/Contents/SharedSupport/sdk/bin:$PATH
$ luddite help
# On Linux
$ export PATH=INSTALLDIR/lib/sdk/bin:$PATH
$ luddite help
Samples
Sample UDL files can be found in the udl subdirectory of the Komodo SDK directory.
Luddite Reference
Luddite is the language Komodo uses for user-defined syntax highlighting and multi-language lexing. An
introduction to the Luddite language can be found in the User-Defined Language Support documentation.
Keywords
The following is a list of Luddite keywords - not to be confused with the keywords described by the UDL file
itself for the target language definition. The Luddite keyword is always given followed by its argument list,
where applicable; optional arguments are given in square brackets ([ ... ]).
token_check test succeeds. Otherwise Luddite will look at the results of any skip and reject
statements in the current family to decide which action to take.
all
Used in accept, reject, and skip statements in token_check definitions. This means that the
token_check test will follow whatever directive is associated with this occurrence of all.
at_eol(state-name)
Used to specify the Luddite state to transition to when the end of the current line is reached. This is
useful for processing languages like the Perl-based template language, Mason, in which one can
embed Perl code on a single line by putting a '%' character at the start of the line, as in this example:
Good
% if ($time > 12) {
afternoon
% } else {
morning
% }
This is easily handled with this Luddite code:
state IN_M_DEFAULT:
/^%/ : paint(upto, M_DEFAULT), paint(include, TPL_OPERATOR), \
at_eol(IN_M_DEFAULT), => IN_SSL_DEFAULT
If there's a percent character at the start of a line in markup mode, cause it to be lexed as a template
operator, and switch to Perl lexing (IN_SSL_DEFAULT), and switch back to markup-based lexing
when it reaches the end of the line.
clear_delimiter
Used in conjunction with keep_delimiter, this action explicitly clears the current delimiter (useful in
recognizing terminating identifiers in here documents).
delimiter
Used in place of a pattern or match-string in transitions, this will succeed if there's a current delimiter
defined, and it can be matched at the current point in the buffer. When it's matched, the current
delimiter will be unset, unless the keep_delimiter action is given in the transition.
csl
client-side language (e.g. usually JavaScript)
markup
markup language (e.g. HTML, XHTML, other XML dialects)
ssl
server-side language (e.g. Perl, Python, Ruby)
style
stylesheet language (usually CSS)
tpl
a "template-oriented" language, usually geared to either adding template-side processing to
the server-side language, or making it easier to inject the server-side language into other parts
of the full multi-language document, as in CSS or JS. Examples include Smarty for PHP
processing.
Keywords 378
Komodo User Guide
Used to describe which tokens start and end a code-folding block. For example:
keep_delimiter
Used when the delimiter directive was used in place of a pattern or string, this tells the UDL lexer
to retain that directive for subsequent matching. This is useful for matching a construct like Perl's
s,/,\\, construct, where we would be using ',' as the regex delimiter, instead of the normal '/'.
keywords name-or-string-list
List the words that should be colored as keywords (as opposed to identifiers) in the defined language.
Keywords for the target language that are the same as reserved words in Luddite must be quoted.
include [path/]file
Include a UDL file. The include path starts with the current directory; if you include a file in a
different directory, that file's directory is appended to the include path.
include "html2ruby.udl"
include
When used as an argument to the paint keyword, include a style.
initial state-name
The state processing for the current family should start at.
initial IN_SSL_DEFAULT
language name
The name of the language being defined. The language directive must be given. It may be given more
than once, but only with the same value is given each time. This value shows up in the Komodo UI in
places like Language Preferences and the "New File" command.
language RHTML
Keywords 379
Komodo User Guide
no_keyword
The no_keyword command is used to prevent identifier => keyword promotion when an identifier is
recognized. This is useful for programming languages that allow any token, even keywords, to be
used in certain contexts, such as after the "." in Python, Ruby, and VBScript, or after "::" or "->" in
Perl.
state IN_SSL_DEFAULT:
/\.(?=[a-z])/ : paint(upto, SSL_DEFAULT), \
paint(include, SSL_OPERATOR), => IN_SSL_NON_KEYWORD_IDENTIFIER_1
state IN_SSL_NON_KEYWORD_IDENTIFIER_1:
/[^a-zA-Z0-9_]/ : paint(upto, SSL_IDENTIFIER), redo, no_keyword, \
=> IN_SSL_DEFAULT
paint(include|upto, style-name)
These directives are used in state transitions, and are key to the way UDL generates lexers. They
appear in a context like this:
state IN_SSL_COMMENT_1 :
/$/ : paint(include, SSL_COMMENT) => IN_SSL_DEFAULT
This means that when we're in a state with name "IN_SSL_COMMENT_1" (remember that state
names are completely arbitrary in your Luddite programs), and we find the end of the line, we should
paint everything from the last "paint point" to the end of the line with the style
"SCE_UDL_SSL_COMMENT". This will also move the paint-point to the point after the last
character this command styles.
A transition can have a paint(include...) command, a paint(upto...) command, both of them, or neither.
redo
The redo command indicates that the lexer should not advance past the current characters being
matched, but should stay there in the new state.
state IN_SSL_NUMBER_3:
...
/[^\d]/ : paint(upto, SSL_NUMBER), redo, => IN_SSL_DEFAULT
This specifies that when we're processing numbers (assuming the arbitrary name
"IN_SSL_NUMBER_3" reflects the idea that we're trying to recognize numeric terms in the input),
and find a non-digit, we should paint everything up to but not including the start of the matched text
with the SCE_UDL_SSL_NUMBER style, change to the default state for this family, and retry lexing
Keywords 380
Komodo User Guide
the same character.
Since having both a redo action and a paint(include...) action in the same transition would
be contradictory, the Luddite compiler gives an error message when it detects this condition and stops
processing.
set_delimiter (number)
This transition action takes a single argument, which must be a reference to a grouped sub-pattern in
the transition's pattern. It sets the current delimiter to that contents of the subpattern.
/m([^\w\d])/ : paint(upto, SSL_DEFAULT), set_delimiter(1), \
=> IN_SSL_REGEX1_TARGET
set_opposite_delimiter (number)
This transition action takes a single argument, which must be a reference to a grouped sub-pattern in
the transition's pattern. It sets the current delimiter to that contents of the subpattern.
/m([\{\[\(\<])/ : paint(upto, SSL_DEFAULT), \
set_opposite_delimiter(1), => IN_SSL_REGEX1_TARGET
sublanguage name
The common name of the language this family targets.
sublanguage ruby
sub_language
Synonym for sublanguage
system_id "http://www.w3.org/2001/XMLSchema"
systemid "http://www.w3.org/1999/XMLSchema"
# "systemid" is a synonym for "system_id"
token_check: token-recognition-list
A set of directives that define the token checking set for this family.
Keywords 381
Komodo User Guide
Used in state transitions immediately after a pattern or string (match target) is given. This is used for
token disambiguation. For example in Ruby, Perl, and JavaScript, a '/' can either be a division
operator or the start of a regular expression. By looking at how the previous token was styled, we can
determine how to interpret this character.
If the token_check test fails, the pattern is deemed to fail, and UDL tries subsequent transitions in the
state block.
start_style style-name
The lowest style in the list of styles Luddite will use for this family (in terms of the values given in
Scintilla.iface). This is used for token_check processing while lexing, so it's not required otherwise.
end_style
The highest style in the list of styles Luddite will use for this family (in terms of the values given in
Scintilla.iface). This is used for token_check processing while lexing, so it's not required otherwise.
upto
See paint
spop_check
See spush_check
spush_check(state-name)
Used to specify the Luddite state to transition to at a later point.
state IN_SSL_DSTRING:
'#{' : paint(include, SSL_STRING), spush_check(IN_SSL_DSTRING), \
=> IN_SSL_DEFAULT
...
state IN_SSL_OP1:
'{' : paint(include, SSL_OPERATOR), spush_check(IN_SSL_DEFAULT) \
=> IN_SSL_DEFAULT
...
state IN_SSL_DEFAULT:
'}' : paint(upto, SSL_DEFAULT), paint(include, SSL_OPERATOR), \
spop_check, => IN_SSL_DEFAULT
This code is used to account for the way the Ruby lexer is intended to color expressions inside #{...}
brackets in strings as if they weren't in strings. When the "}" is reached, the lexer needs to know
whether it should go back to lexing a string, or to the default state. We use the spush_check and
spop_check directives to specify this.
Style Names
The style names are all listed in Scintilla.iface, in the section for UDL. The ones for client-side,
server-side, style, and template languages are generic, and shouldn't need much explanation here. This section
will focus on the markup section in specifics.
First, we are limited to about 56 styles, as UDL partitions the style byte associated with each character by 6
bits for styles, 1 bit for error squigging, and 1 bit for warnings. Additionally, scintilla reserves styles 32
through 39 for its own use, leaving us with 56.
This reduces the number of available styles for each family down to the basics. This includes the default style
(which should only be used for white-space in most cases), comments, numbers, strings, keywords, identifiers,
Some of the styles in the markup block reflect terms used in ISO 8859, the SGML standard. These are:
SCE_UDL_M_STAGO
Start-tag-open character, as in "<"
SCE_UDL_M_TAGNAME
The name immediately after a tag-open character.
SCE_UDL_M_TAGSPACE
White-space in start-tags, end-tags, and empty tags.
SCE_UDL_M_ATTRNAME
Attribute names in start-tags.
SCE_UDL_M_OPERATOR
Operator characters, which is essentially just the '=' in attribute assignments in start-tags.
SCE_UDL_M_STAGC
Start-tag-close character (">")
SCE_UDL_M_EMP_TAGC
Tag-close sequence for an empty start-tag ("/>")
SCE_UDL_M_STRING
String attribute values in start-tags
SCE_UDL_M_ETAGO
End-tag-open character ("</")
SCE_UDL_M_ETAGC
End-tag-close character (">"). Distinguished from an "STAGC" only by context.
SCE_UDL_M_ENTITY
A complete entity reference, from the leading "&" through the closing ";".
SCE_UDL_M_PI
Processing instructions, including the leading XML declaration, from the leading "<?" through the
closing "?>".
SCE_UDL_M_CDATA
CDATA marked sections.
SCE_UDL_M_COMMENT
SGML comments.
Terms
name-or-string
Either a quoted string, delimited by single- or double-quote characters, with -escape sequences, or a
sequence of characters starting with a letter, followed by zero or more alphanumeric characters,
hyphens, or underscores.
name-or-string-list
List of strings or non-keyword-names surrounded by square brackets. Commas are optional.
state-name
A symbolic name for a UDL state. These names are are completely arbitrary, but we recommend the
convention that they start with "IN_", then contain a sequence that reflects the family they belong to
("SSL", "CSL", "CSS", "TPL", or "M" for "Markup"), and finally a descriptive part.
Example:
Terms 383
Komodo User Guide
IN_TPL_BLOCK_COMMENT_1
style-name
A symbolic name that reflects the style names used in .h files derived from the Scintilla.iface file.
These names all start with the prefix "SCE_UDL_", which may always be omitted.
Example:
SSL_STRING
token-recognition-list
A line-oriented list of directives containing a style-name, a colon, and then an accept, reject, or skip
directive.
transition-list
Zero or more transition, separated by newlines
transition
Consists of a string or pattern to be matched, an optional token_check, ":" (optional), an optional list
of actions (comma-separated), and optionally, an "=>" followed by a style-name. Actions include
paint, redo, spush_check, and spop_check.
Concepts
1. Order of token_check statements
2. The statements in a token_check directive are followed in order, and are family-specific. The default
action, if no term is chosen, depend on what kinds of statements are specified:
The target state is optional. A transition that contains both a "paint(include...)" and a "redo" directive
would loop indefinitely, so UDL contains a limit of 1000 before it bypasses the current character and
continue with the next one.
Concepts 384
Komodo Release Notes
Select a Komodo version from the list below to see its release notes.
ActiveState is a registered trademark of ActiveState Software Inc. Komodo, the Perl Dev Kit, the Tcl Dev
Kit, ActivePerl, ActivePython, ActiveTcl and ASPN are trademarks of ActiveState Software Inc.
All other products mentioned are trademarks or registered trademarks of their respective companies.
Some of the icons in Komodo are used under Creative Commons license from Mark James, and some are the
work of Bright Creative. We are grateful to Mark James and Dave Shea for their great creative work.
Some SCC icons are derived from those in the TortoiseSVN project and used under the TortoiseSVN Icon
License.
The Debugger icons are from the Fugue Icon set, which is licensed under the Creative Commons Attribution
3.0 license. Thanks to Yusuke Kamiyamane for creating such a great set of icons.
Komodo License
ACTIVESTATE KOMODO IDE LICENSE AGREEMENT
Please read carefully: THIS IS A LICENSE AND NOT AN AGREEMENT FOR SALE.
By using and installing ActiveState's Software or, where applicable,
choosing the "I ACCEPT..." option at the end of the License you
indicate that you have read, understood, and accepted the terms and
conditions of the License. IF YOU DO NOT AGREE WITH THE TERMS AND
CONDITIONS, YOU SHOULD NOT ATTEMPT TO INSTALL THE SOFTWARE. If the
Software is already downloaded or installed, you should promptly cease
using the Software in any manner and destroy all copies of the Software
in your possession. You, the user, assume all responsibility for the
selection of the Software to achieve your intended results and for the
installation, use and results obtained from the Software. If you have
any questions concerning this, you may contact ActiveState via email at
[email protected].
(i) Commercial Use. If your License Key authorizes Commercial Use, you
may use the software on more than one computer or on a network so long
as you are the sole user of the Software. (A "network" is any
combination of two or more computers that are electronically linked and
capable of sharing the use of a single software program.) You will
obtain a separate license for each additional user of the Software
(whether or not such users are connected on a network). You are not
permitted to sell, lease, distribute, transfer, sublicense, or
otherwise dispose of the Software, in whole or in part, for any form of
actual or potential commercial gain or consideration.
(iv) Other Use. Any use of the software other than the uses specified
above requires a separate license from ActiveState and the payment of
additional license fees as determined by ActiveState. Such additional
redistribution options are available, at ActiveState's sole discretion,
on a case-by-case basis. Contact Sales@ActiveState to discuss any
redistribution options not covered by this license agreement.
ActiveState reserves all rights not expressly granted to you herein.
5. Transfer and Use Restrictions. You may not sell, license, sub-
license, lend, lease, rent, share, assign, transmit, telecommunicate,
export, distribute or otherwise transfer the Software to others, except
as expressly permitted in this License Agreement or in another
agreement with ActiveState. In order to use the Software you will be
required to obtain a License Key and agree to this License Agreement
for the use of the Software. You will not disclose or provide access
to your License Key to any other person or entity. You must comply
with all applicable Canadian and other export control laws in your use
of the Software. Except as may be expressly permitted above, you may
not modify, reverse engineer, decompile, decrypt, extract or otherwise
disassemble the Software.