Sublime Text, SublimeCodeIntel & node.js

Have been working through the node.js via Learn you node tutorials and thought it a good opportunity to see if I could get a node.js auto complete/hint plugin.

Unfortunately the nodejs plugin is no longer active,. and it did not seem to be namespace aware, that is, it would not narrow the filter based on the namespace. Entering 'a..' gave the same filtered list as 'fn.a...', as one of the motivations of my search was to have an easy way to explore namespaces, it wasn't going to cut it.

Enter SublimeCodeIntel. I was hoping to kill two birds with one stone and find something that turned a XSD into a hint file for  XML. This would help me edit web.config files using the DotNetConfig.xsd, though no luck. Will have to resume that search another time.

SublimeCodeIntel worked fine out of the box, until I started editing the settings. Saving the user preferences without the encompassing curly braces around the all my setting crashes SublimeText, hard. Only Ctrl-Alt-Del could kill her, though the Unexpected trailing characters message did point me to the first line that helped me get that sorted quickly.

The next issue was enabling the node.js autocomplete. The sublime forums almost got me there, though it was a post right at the bottom on an old bug on the plugin's github page that illuminated what I was missing. There are two parts, firstly, codeintel_syntax_map.

"codeintel_syntax_map": {
  "JavaScript": "Node.js"
}

And my missing piece of the puzzle, javascriptExtraPaths

"codeintel_config": {
  "JavaScript": {
    "javascriptExtraPaths":["./Packages/SublimeCodeIntel/libs/codeintel2/lib_srcs/node.js"],
    "codeintel_scan_files_in_project": false,
    "codeintel_max_recursive_dir_depth": 2
  }
}

2 thoughts on “Sublime Text, SublimeCodeIntel & node.js

  1. Istvan

    Hey,

    I’ve been trying to get code completion working under Sublime Text 3 as well, but no luck.
    I tried adding those lines in my User profile, deleted the codeintel folder (so the cache would refresh), but i’m still getting: no completions found.

    Could you help me, maybe? Did you install any other package? Where did you exactly add those lines?

    Thanks

  2. Kahlzarg

    Post author

    Hi Istvan,

    I added the setting into Preferences > Package Settings > SubmlineCodeIntel > Settings – User

    I ensure that i only change User Settings and keep the Default Setting as they were.

    The complete file is here: http://pastebin.com/NunSy6Eq

    I am pretty sure it just used this plugin, and the magic was in the settings files.

    Hope this helps.

Leave a Reply