SublimeCodeIntel and Code intelligence in Sublime Text 3

There’s an article about using CTags plugin to implement “Goto source definition” functionality in Sublime Text 3 — a mechanism, which let you click particular symbol (i.e. class or method name) in any source file of your project and be immediately redirected to file (and line) that contains its definition. You’ll find it here: “CTags and Goto source definition functionality in Sublime Text 3“.

This functionality is often called “Code intelligence” and there is another plugin — SublimeCodeIntel — that implements it in Sublime Text 3. If you want this kind of functionality in Sublime Text 3, but don’t want to use CTags plugin, this article will tell you more about alternative to it.


…is as simple as in case of any other package for Sublime Text 3 obtained from Package Control repository. Simply:

  • hit Ctrl+Shift+P,
  • type Ins to highlight Package Control: Install Package,
  • hit Enter,
  • type SublimeCodeIntel and
  • hit Enter again.

General differences

Six most important differences in SublimeCodeIntel plugin over CTags plugin.

First, it has a very long initial run (right after installation). Over two hours wasn’t enough for this plugin to build up its database on system, where there are only three medium-to-large size PHP projects. While (as you already know) ctags.exe needed only few seconds to build tags files for each of such projects.

Second, it enhances build-in code completion functionality:

  • Provides you with code-completion that can complete symbols, methods etc. from indexed files.
  • Useful, if you use any framework, external library or any other non-standard, non-bare PHP code, code-completion
  • SublimeCodeIntel can list these methods, symbols etc. as well. It is not limited to core PHP symbols.
  • However, if you have any plugin, that enhances this as well, already installed (for example PHP Completions Kit plugin), it can interfere or even run into conflict with SublimeCodeIntel. See more in Useful plugins for Sublime Text 3 article.

Third, it allows jumping to definition of variable as well. It sometimes does it incorrectly (especially, when dealing with class fields), but has that functionality at all (it isn’t implemented in CTags).

Fourth, it handles incorrectly situation, when the same symbol is defined in two or more places. CTags in this case displays list to select source, to which user want to jump to. SublimeCodeIntel in this case jumps to first / random / unknown file with symbol definition.

Fifth, it can work with PHP symbols as well. Displays definition in status bar. This can be changed to either output panel or displayed as popup. However, there’s a bug, that causes (at least in mine installation) to display PHP symbols’ definition always in status bar.

Plus, entire Sublime Text 3 hangs badly, if you attempt to change it, by editing Preferneces > Package Settings > SublimeCodeIntel > Settings -- User. But, this is always better than nothing, as CTags doesn’t handle PHP symbols at all.

Finaly, it keeps entire database in one place, in user directory (%userprofile%.codeintel in case of Windows). This isn’t a bug, but rather a feature. If you’re doing just a separate projects, this shouldn’t be a problem.

But, if you have most your projects based on the same framework (Yii, Zend, anything), having one database for all of them will soon cause you to have doubled entries in search results for the same symbol, if you you’ll be doing code intelligence for framework-based symbol.

On the other hand, having database separated to user dir instead of keeping it among project files (as CTags does), saves you from need of adding these tags files to .gitignore or to version control system.

Plus: database is updated automatically (in case of CTags you must rebuild tags files from time to time manually).

Database, created and used by SublimeCodeIntel, is initially build very, very long, but is also much, much smaller than tags files created by CTags plugin. It also has a different architecture (large number of files versus just a few files). For example, parsing a test project resulted in:

  • 8 files only and 497 MB in case of CTags and
  • over 6 000 files, but only 20 MB in size, in case of SublimeCodeIntel.

Generating six thousand files surely can take a few hours, but in a result your symbolic database is 25 times smaller. You have to decide what do you have more — disk space or time and patience? :)

Changing keyboard shortcut

The default keyboard shortcut for jump-back functionality is very weird — Ctrl+Win+Alt+Left (Win replaced with Super on Linux and Command on Mac OS X). It is extremely unhandy. You jump-in to definition with Alt+Left Mouse and then have to leave your mouse and touch keyboard with both hands and four fingers, to jump-back.

I changed this, by opening Preferneces > Package Settings > SublimeCodeIntel > Mouse Bindings — User and added there:

{ "button": "button2", "modifiers": ["alt"], "command": "back_to_python_definition"}

From this moment on, I could enjoy jump-back with Alt+Right Mouse. Just as in case of CTags.

Strange jumps

SublimeCodeIntel can sometimes open you a strange / random / unrelated file. Especially in case, when it doesn’t recognize particular symbol. This is wrong and unhandy, because in most of such situations you have to waste time on closing unrelated file. CTags warns user in this case that it is unable to locate given symbol.

A small problem is that “jumps” (especially jump-back) always places cursor in the first column in line, where either symbol was found (jump-in) or where user was editing previously (jump-back). SublimeCodeIntel never goes back to the column, where you’re actually editing, which might be a little bit unhandy, especially if someone likes writing long lines.

You can avoid / workaround this problem by pressing Ctrl+W to close tab with symbol definition.

Final words

I have finally decided to uninstall SublimeCodeIntel and go back to CTags. Key reasons, as for me:

  • plugin seems to be abandoned (updated over year ago)
  • hangs Sublime Text 3 on changing user configuration or uninstalling,
  • incorrect reaction (random or incorrect jump), when symbols is not find,
  • common database for all projects, with not user control over, what is actually indexed in database,
  • no support for multiple definitions of the same symbol — going to first / random occurrence instead of displaying list of possibilities.

However, I must admit, that it was a very hard decision, because functionalities of:

  • navigating to source definitions of variables as well (not implemented in CTags) and
  • displaying quick, short descriptions for PHP symbols

did catch my heart.

You can go to the You won’t get the whole cake! section of CTags and Goto source definition in Sublime Text 3 article, to learn details on what is missing in CTags that SublimeCodeIntel can give you.

Note, that CTags is maintained by SublimeText team, which may suggest that it is better solution.

Leave a Reply