Komodo

Replacement Tcl linter binaries

Question: 

I get an error 'Invalid License' when editing Tcl code in Komodo 4.1. What's going on?

Answer: 

Komodo 4.1.0 shipped with a Tcl linter binary that incorrectly checks for a license. To fix this, please replace the 'kotcllint' binary in your Komodo installation ( kotcllint.exe on Wiindows ) with one from the attached zip archive.

To install, unzip the attached file and copy the kotcllint or kotcllint.exe file for your OS to the following path overwriting the existing file:

C:\Program Files\ActiveState Komodo IDE 4.1\lib\support\tcl\ ( Windows )

/opt/Komodo-IDE-4.1/lib/support/tcl/ ( Linux )

/Applications/Komodo IDE.app/Contents/SharedSupport/tcl/ ( OS X )

This issue will be fixed shortly in the upcoming Komodo 4.1.1 release.

Crash with Komodo 4 libcpp5 builds and RHEL3

Question: 

Komodo 4.0 segfaults on my Red Hat Enterprise Linux 3 system shortly after start-up when updating the code intelligence data. The website states RHEL3 is supported. Is there a solution for this?

Answer: 

This is a known issue with Komodo 4.0.2, 4.0.3 Beta 1 and 4.1 beta 1. A workaround is to update the version of expat on your system to 'expat-1.95.8'. With future builds of Komodo we are looking into linking expat statically so as to avoid this issue.

Komodo 4 on Ubuntu/x86_64

Question: 

How to install and run Komodo 4 on Ubuntu Linux x86_64

Answer: 

The complete solution for installing and running Komodo4 with the 64-bit Ubuntu build is this:

sudo apt-get install libc6-i386 ia32-libs ia32-libs-gtk

Works fine after that.

NOTE: Installing just libc6-i386 lets the install script perform the installation. But running the program generates this error message:

error while loading shared libraries: libgtk-x11-2.0.so.0

Installing the other two packages (ia32-libs and ia32-libs-gtk) fixes that part.

[from bug 67932]

An easier way to manage language-specific indent levels

Question: 

How do I get Komodo to use language-specific indentation levels? We use 2-space indentation for Ruby and HTML, 1-space for XML, and 4-space for everything else.

Answer: 

Time for another one of those tips to play with this weekend...

There are various internal reasons why Komodo doesn't have language-specific
indentation settings, but that hasn't stopped many people from asking for them.

However, this is a snap to implement with Komodo's trigger macros. Create
a new macro, and do the following:

1. Press the Triggers tab

2. Check "Macro should trigger on a Komodo event"

3. Select the "After file open" radio button.

You can have more than one trigger macro on a given event. The lower
the assigned rank, the later it fires. Your macros can even define
variables and functions into Komodo's global namespace, so an early-firing
macro could set a value that a later-firing one could use.

4. Finally, this code will control the indentations on load:

var language = komodo.document.languageObj.name;
// alert("Doc language = " + language );
var indentWidth = null;
switch(language) {
    case 'XML':
        indentWidth = 1;
        break;
    case 'Ruby':
    case 'RHTML':
    case 'HTML':
        indentWidth = 2;
        break;
}
if (indentWidth) {
    komodo.document.indentWidth = indentWidth;
}

The only problem with this trigger is that if you choose a
different indentation for a particular buffer, it will be
reset to the language default every time you load it.
I'll have to figure that one out.

codeintel CIX schema

Question: 

What is the schema for CIX (codeintel XML)?

Answer: 

CIX stands for Code Intelligence XML. It is the XML format that is used to describe codeintel information for programming language content (variables, classes, functions, etc.) in Komodo's Code Intelligence system. This format is used by the internal scanners of Python, Perl, PHP, JavaScript, Ruby, etc. code. It is used to define the standard library data and API catalog data for these languages.

Attached are the CIX schema (in RelaxNG) and a small catalog.xml (XML catalog file) that can be added in Komodo's "Languages > XML Catalogs" table to get XML autocomplete for .cix files.

All .cix files should start out like this:

<?xml version="1.0" encoding="UTF-8"?>
<codeintel xmlns="urn:activestate:cix:2.0" version="2.0">
   ...
</codeintel>

Komodo file locations

Question: 

Where can I find the Komodo files?

Answer: 

Where is Komodo installed?

The default location varies by platform, and the name of the directory corresponds to the version of Komodo you are running ("IDE" or "Edit" plus the version number - e.g. "Komodo IDE 8"):

  • Windows
    C:\Program Files\ActiveState Komodo [IDE|Edit] <version>\
  • Linux
    /opt/Komodo-[IDE|Edit]-<version>/
  • OS X
    /Applications/Komodo-[IDE|Edit]-<version>.app

Where does Komodo keep settings data?

Komodo stores preferences, macros, templates, keybinding schemes and other settings in a user-specific directory called the user data directory. The name and location of this directory varies depending on the operating system and Komodo version:

  • Windows Vista, Windows 7, Windows 8 or newer
    C:\Users\<user>\AppData\Local\ActiveState\Komodo[IDE|Edit]\<version>
  • Windows XP or older
    C:\Documents and Settings\<username>\Local Settings\Application Data\ActiveState\Komodo[IDE|Edit]\<version>
  • Linux
    /home/<user>/.komodo[ide|edit]/<version>
  • Mac OS X
    /Users/<user>/Library/Application Support/Komodo[IDE|Edit]/<version>

You can find more details about the contents of the profile directory here:
http://community.activestate.com/faq/komodo-profile-structure

The location of this directory can be overridden using the KOMODO_USERDATADIR environment variable, see:
http://community.activestate.com/faq/multiple-instances-komodo

Where does Komodo log output and errors?

Note: In Komodo 6, you can use the "Help->Trouble Shooting->View log file" menu command to quickly examine Komodo's main log file ("pystderr.log").

There are two files named "pystderr.log" and "pystdout.log" within your Komodo user data directory. These files are extremely useful for troubleshooting problems with Komodo and are often requested when logging bug reports.

  • Windows Vista, Windows 7, Windows 8 or newer
    C:\Users\<user>\AppData\Local\ActiveState\Komodo[IDE|Edit]\<version>\pystd[err|out].log
  • Windows XP or older
    C:\Documents and Settings\<username>\Local Settings\Application Data\ActiveState\Komodo[IDE|Edit]\<version>\pystd[err|out].log
  • Linux
    /home/<user>/.komodo[ide|edit]/<version>/pystd[err|out].log
  • Mac OS X
    /Users/<user>/Library/Application Support/Komodo[IDE|Edit]/<version>/pystd[err|out].log

How do I reset Komodo's preferences to the default settings?

Warning: This will reset a lot of preference information, including opened files, recent files, projects and toolbox, additional installed extensions, customized Komodo preferences, etc... So make sure you backup the folder instead of simply deleting it, this way you can easily restore your settings.

Your preferences should be reset.

Note 1: If you have older Komodo preferences from before Komodo 4.0, these will be applied on-top of the default preferences as part of a Komodo upgrade process, so for a total default/fresh set of preferences you will need to rename the older komodo directory as well.

Note 2: You can also use a completely different Komodo user data directory, see below.

How can I change Komodo's profile storage location

You can use a completely custom Komodo user data (profile) directory by setting the KOMODO_USERDATADIR variable in your environment settings before starting Komodo.

Example:
export KOMODO_USERDATADIR=/tmp/komodoide

Komodo Port Usage

Question: 

My [insert security company here] software Firewall is reporting that Komodo is engaging in 'suspicious activity' or is a Trojan. What is going on here?

Answer: 

We've always used socket connections, and have occasionally had problems with Security software returning a false positive. Komodo uses ports for the following reasons:

- the debugger ( typically port 9000, but user-configurable )
- the start page has an iFrame that displays a page on our site.
- ssh / sftp / ftp editing
- the html perview, if you open a url

It is almost always the debugger that is the problem because the other features all use 'standard' ports for relatively well-known protocols. Komodo does not have any kind of spyware in it, so my best suggestion is to configure your software to allow Komodo to make these connections.

CGI Debugging: 'No Input File specified'

Question: 

When I try to debug PHP using CGI Emulation, I get this error:

No input file specified.

Answer: 

This is because your PHP CGI interpreter has been compiled with cgi.force_redirect set to on for security reasons. We can fix this in Komodo by changing this setting in the copy of php.ini that Komodo uses:

- open the php.ini copy that Komodo is using:

~/.komodo/host-<hostname>/php/<php-version>/php.ini

- change the setting:

; cgi.force_redirect = 1

to

cgi.force_redirect = 0

Save the php.ini, then try debugging using CGI Emulation again.

Customizing the Komodo UI

Question: 

How can I change the UI widgets and the look and feel of Komodo? Like:

  • Tabs
  • Menus
  • Toolbar buttons
  • Internal browser
  • Editor
  • etc...
Answer: 

Komodo XUL UI

You can customize most of the (xul) UI by creating your own customized "userChrome.css" file, stored in your Komodo profile. See this forum post for where your Komodo profile is located:
http://community.activestate.com/faq/komodo-file-locations#appdata_dir

You need to make a sub-directory "chrome" in the Komodo profile's "XRE" folder. Then create the file "userChrome.css", which will contain your customized (overide) settings. The full file pathname should be similar to this on a Windows XP machine:

C:\Documents and Settings\<your_username>\Local Settings\Application Data\
ActiveState\KomodoIDE\6.1\XRE\chrome\userChrome.css

Here is a sample userChrome.css file that overrides the tab colours to be a darker shade of grey (active one even darker), provide rounded corners on the tabs and make the text of the selected tab bold:

/* Customized setting for override the selected editor Tab colors */

/* Tabbox background */
tabbox, tabs {
    background-color: #ddd !important;
}

/* Tab background and visuals */
tabs > tab {
    background-color: #D3D3D3 !important;
    border-width: 1px !important;
    border-color: black !important;
    /* Rounded tabs */
    -moz-border-radius: 3px 3px 0px 0px !important;
}

/* Hovering over tab, change background and font color */
tabs > tab? {
    background-color: #ccc !important;
    color: #fff !important;
}

/* Active tab including hovering, change background and font weight */
tabs > tab[selected="true"], tabs > tab[selected="true"]? {
    background-color: #ccc !important;
    font-weight: bolder !important;
}

/* Sample to update all the trees inside komodo for white on black theme. */
tree,
treechildren,
treechildren::-moz-tree-row /* for Komodo 7 */
{
    background-color: #000 !important;
    color: #fff !important;
}

/* Change the document toolbar to use a white on black theme. */
.view-toolbar {
    background-color: #000 !important;
    color: #fff !important;
    /* or to hide it completely using:
    visibility: collapse;
    */
}

/* Set font size and family for dialogs and other miscellaneous text */
window, dialog {
  font-size: 100% !important;
  font-family: helvetica !important;
}

/* Make menus big, pretty and readable */
menubar, menubutton, menulist, menu, menuitem {
  font-family: helvetica !important;
  font-size: 4mm !important;
}

For more examples, take a look at the mozilla/firefox userChrome.css documentation, as it's the same as Komodo, except for the id used in some xul elements.

Mozilla Config

You can edit the mozilla configuration settings using the "about:config" url, same as in Firefox and Thunderbird. You can easily get to this editor by

  • Open a file in the Komodo editor
  • Perform a Preview with Browser command (ctrl+K, ctrl+V)
  • In the dialog window, select preview with another file or URL and change the textbox url to be "about:config"

Internal Browser

You can use the same method as Mozilla/Firefox uses for overriding browser content as well, by creating your own customized "userContent.css" file, located in XRE directory in your Komodo profile (see above).

hr {
    background-color: #ffffff !important;
    color: #ffffff !important;
}

span, p, ol, td, th, h1, h2, h3, h4, h5, h6 {
    background-color: #000000 !important;
    color: #ffffff !important;
}

This example overrides most of the contents to use a black background and a white foreground.

Komodo Editor UI

Komodo's editor is based on the Scintilla editing component. Komodo provides preferences for most of the parts that are customizable, although there are a few less obvious ones that are missing. If you need to do your own custom settings (i.e. different settings for different file types), then you can create a macro in your Komodo toolbox that is set to run "triggers" on the file load event.

Example:

// Example JS macro
// Set the trigger to run on file load through the macro editor
// Example to change calltip colours to use black bg, white fg.
if (komodo.editor) {
    komodo.editor.callTipSetBack(0x000000);
    komodo.editor.callTipSetFore(0xFFFFFF);
}

Once created, you can also run this macro code on demand by simply double-clicking.

How do I find out about other editor/scintilla calls:

  • create a new JavaScript file inside Komodo and type (Komodo 4.2 onwards):
    Components.interfaces.ISciMoz.
  • open the scimoz IDL "ISciMoz.idl" file in the sdk directory (Komodo 4.1 onwards)
  • see Komodo's internal help
  • check out the scintilla website

Project info from Python macro?

Question: 

How do I get information on which files that are highlighted within the Project pane, via a Python macro?

Answer: 

Right now you have to do this in JavaScript, since the only way to access some of the UI is through JS. Eventually that will change, work has been done in the Firefox 3.0 branch to make Python work in the UI layer. In JavaScript do this:

var selectedItems = gProjectManager.viewMgr.getSelectedItems();

"selectedItems" is now an array of koIPart instances (XPCOM objects). If you want file information, you can to the following:

var f = selectedItems[0].getFile(); // f is a koIFileEx instance
dump(f.URI);
dump(f.path);

There are a number of other members on the file instance as well.