Improved and renewed Meteor Autocompetion for Sublime Text 3

Hey everyone,

I have developed the plugin for TernJS, the autocomplete engine pluggable to Vim, Emacs, Sublime, Brackets, Atom and Eclipse. This plugin supports Meteor symbols and Meteor’s way of scoping files.

A year ago, a lot of people found a good use of it but the installation was indeed terribly hard. Today I am releasing a packaged solution that you can install from Package Control in one command.

Check it out: https://github.com/Slava/tern-meteor-sublime

Quick installation: “Install Package” -> “Meteor Autocomplete (TernJS)” -> Enter -> Done

The package bundles all the npm dependencies and the node binaries, so you don’t even need to care about managing your global node version. Please give it a spin and let me know what you think.

18 Likes

Great work! Gonna try it out now :slight_smile:

And I already pushed multiple bug fixes and speed improvements :slight_smile:

can we hope for a atom rls too ?

It was much easier to do with Sublime rather than Atom, because Sublime had a very nice plugin already developed by the author of TernJS. I took his work and built on top of it, resulting into a lot of improvements for Meteor specifically.

Given that Atom would require me to learn new APIs and reimplement a lot of logic that already exists in the sublime package, it is probably a much bigger time and effort investment with low returns.

In contrast: building the same stuff for Vim is much easier: I can share my python code from sublime and I understand the vim plugin model much better.

there is a tern package for atom too

but yeah atoms apis are changing a lot too and we have allready meteor-helper and meteor-api which are good packages too

@lampe it is very easy to get this working in atom. You’ll need to install autocomplete plus and atom-tern, download @slava’s meteor.js (the tern plugin) into the atom package’s plugin folder, create a tern config file in your root (just like you would for vim) and there you go, you’ll have excellent autocomplete support, thanks to Slava.

And then go install webstorm to enjoy a proper ide :wink:

1 Like

thx for the info @serkandurusoy :smiley:

the moment when webstorm/phpstrom is not writen in java i will change to it :wink:

Can’t argue with that :smile:

BTW, atom-tern has a small glitch. It does not preserve third party tern plugins across updates. So every time you get an update to atom-tern, you need to copy over meteor.js to the plugin folder.

1 Like

Cool, can you please come up with good instructions for other people? @chris recently contacted me saying the Atom way didn’t work easily for him.

1 Like

I just pushed a new feature that adds a bunch of commands to the command palette including:

  • jump to definition
  • lookup types
  • lookup docs

Please leave your feedback here. The package should be updated on Package Control, once their cron job gets around to my package.

1 Like

@chris here’s how I got it working

Install and update atom and then install https://github.com/tststs/atom-ternjs and https://github.com/atom-community/autocomplete-plus

Then download meteor.js from https://github.com/Slava/tern-meteor and copy it over to ~/.atom/packages/atom-ternjs/node_modules/tern/plugin/ which holds all tern plugins.

Create a file called .tern-project right within the root of your meteor project and paste in the following

{
  "libs": [
    "browser",
    "jquery",
    "underscore"
  ],
  "loadEagerly": [ "*.js", "*/*.js", "*/*/*.js", "*/*/*/*.js" ],
  "dontLoad": [ ".meteor" ],
  "plugins": {
    "complete_strings": {},
    "meteor": {},
    "doc_comment": {
      "fullDocs": true
    },
  }
}

The atom-ternjs readme and http://ternjs.net/doc/manual.html#plugins are good sources of information.

Also, take note that there is an open and possibly unresolvable bug that causes tern-meteor plugin (the meteor.js file) to get deleted whenever atom-ternjs gets an update so I sugggest you keep that file handy in order to be able to copy it over to the plugin folder after an update.

As a final note, you should restart atom for tern to pick up your changes. So if you’ve just created the .tern-project file or you’ve updated it, or if you’ve copied over meteor.js, just do quick restart.

If you don’t want to lose the state of your editor across restarts, https://atom.io/packages/save-session and https://atom.io/packages/remember-session are two nice alternatives that can help you with that.

And then go install webstorm and don’t listen to @lampe :wink:

4 Likes

thx for the wrap up how to get tern running with atom

and never listen to @lampe :smiley: :wink:

Thanks for the detailed answer @serkandurusoy, glad you’ve got it working. I swear that I followed similar steps before but of course it didn’t work my end then.

Good work on the update @slava, excited to try it out!

Must do what we can to avoid that Java bloat @lampe. I recently switched to Atom and pretty happy so far :slight_smile:

@chris I have a backstory with Java and if someone would give me 10x the amount of money iam gettint now to code java i would not do it :smiley: Coding Java is really painful :wink:

Haha, I do share your sentiment. I have been coding java since early 2000 (15 years!) and it’s had its phases of getting better and worse and then better again to only get even worse :slight_smile: I think the new jdk8 looks promising. But again, having dived straight into javascript development with meteor after those 15 years was uneasy at first, but now I feel like I’m blessed and ridden off the sins of java :smile:

New feature: jump to the template file by looking at its JS name.

@slava Thanks for the package. Makes life easier.

@slava fantastic job. Any plans for releasing a package for Brackets? Without having having to use one of the Tern packets and then adding the Meteor Tern file.

Thanks!

New features:

  • Client/Server code separation (now the system runs two analyzing servers, one for client and one for server files)
  • Recognition of Atmosphere Packages (works if you have the versions file or ran Meteor in your app at least once).

A cool gif (click to play):

4 Likes