14

If I am editing a .js file in Sublime Text 2 that makes use of a library defined in a separate .js file, is there a way to support tab completion of objects/functions defined in the external library file?

Something analogous to the following from Visual Studio:

/// <reference path="/js/some-library.min.js" />

which enables IntelliSense over the library/plugin code.

Riko
  • 562
  • 5
  • 11
  • 1
    Please see http://stackoverflow.com/questions/11360659/javascript-sublimecodeintel-and-hinting-code-intelligence-auto-completion - – Mikko Ohtamaa Jul 24 '12 at 07:45

3 Answers3

4

I haven't tried it myself yet, but there's SublimeCodeIntel: https://github.com/Kronuz/SublimeCodeIntel#readme

The OP in this thread: http://www.sublimetext.com/forum/viewtopic.php?f=3&t=5319 seems to be complaining that it's pulling suggestions from outside the current file, which may mean it's doing what you want.

Curtis
  • 3,931
  • 1
  • 19
  • 26
  • Please see my comment: SublimeCodeIntel lacks sufficient documentation how to map your Javascript codebase for auto-completion and how to hint your code. – Mikko Ohtamaa Jul 24 '12 at 07:45
1

I was looking for the exact same thing, and I can confirm that SublimeCodeIntel works well. However, Sublime Text seems slightly less responsive when using SublimeCodeIntel, which is a drawback.

Another cool thing coming from a Visual Studio environment is the support for "Go to definition" in this plugin.

robertherber
  • 844
  • 1
  • 10
  • 20
1

Another option is TernJS:

http://emmet.io/blog/sublime-tern/

I haven't yet used it, but it looks promising. Editor slowdown seems to be an issue with any code completion plugin; sounds like authors are still working out kinks in scraping and caching related files for code completion. The TernJS page addresses this issue and offers some config options for managing how it handles related files.

ericsoco
  • 24,913
  • 29
  • 97
  • 127