Code Completion for Meteor

Proper autocomplete is the one thing I’m missing in Sublime Text
I’ve tried Tern.js Meteor for Sublime Text 3 a couple of times over the year, and every time I’ve had issues with it crashing and given up on it. I thought it might be abandoned, but it seems people are still using it, so it must be working for them.

Every time I start typing something and it tries to autocomplete it, I get this:

Failed to start server:

fs.js:439
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: EMFILE, too many open files '/home/simon/.config/sublime-text-3/Packages/Meteor Autocomplete (TernJS)/node_modules/tern/defs/ecma5.json'
    at Object.fs.openSync (fs.js:439:18)
    at Object.fs.readFileSync (fs.js:290:15)
    at readJSON (/home/simon/.config/sublime-text-3/Packages/Meteor Autocomplete (TernJS)/node_modules/tern/bin/tern:72:17)
    at findDefs (/home/simon/.config/sublime-text-3/Packages/Meteor Autocomplete (TernJS)/node_modules/tern/bin/tern:126:26)
    at startServer (/home/simon/.config/sublime-text-3/Packages/Meteor Autocomplete (TernJS)/node_modules/tern/bin/tern:241:14)
    at Object.<anonymous> (/home/simon/.config/sublime-text-3/Packages/Meteor Autocomplete (TernJS)/node_modules/tern/bin/tern:232:20)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

It’s apprantly a Node error, where it reaches the system limit on how many files it can read at once. Some have suggested typing ulimit -n 2048 in the command line to change the global limit, but that did nothing for me.

I’ve also tried SublimeCodeIntel, but haven’t managed to get it to work consistently either, it mostly seems to fail scanning the js files of my packages.

Are any of you managed to get code completion working? How did you do it?

1 Like

I tried regular non-meteor TernJS now. It’s not great at picking up dependencies, but at least it works without crashing. It doesn’t understand import, but require() works. And it has definitions for underscore built in.

Maybe getting autocompletion to really work properly will take more time than it would save :expressionless:

(Btw, it’s not about saving keystrokes, it’s about having to check less documentation, because you get quick reminders right in the editor)

Maybe not particularly helpful to your original question, but I switched from Sublime to VS Code and have never looked back. I installed Meteor, Meteor snippets and MeteorHelper from the extension library. There’s also a Sublime keymappings extension if your muscle memory is deeply embedded.

As a bonus, the Git and ESLint built-in integrations are awesome.

2 Likes

But that is just predefined completions right? Can it scan and understand your code too? That’s what IntelliSense is supposed to do, right? But I read somewhere that it didn’t work with Javascript?

GitSavvy for Sublime Text is really good, with line by line commit/discard and everything, so in terms of git integration I’m good I think.

In what way is the ESLint integration awesome? Does it do more than mark errors?

1 Like

Okay, time to try VS Code then! :smile:
Could you give me your plugin list?

1 Like

My extension list is pretty small, but you’re welcome to see it:

1 Like

Very impressed with VS Code so far. The Git integration is very slick! Only issue now is that multi-cursors is bound to Alt instead of Ctrl, and there seems to be no way to change it :frowning:
I guess I could relearn, but for some reason on my Linux Mint installation, Alt doesn’t work in applications…

Yeah - I got very used to the middle mouse button in Sublime for marking rectangular blocks. I need another hand to do the same in VS Code!

This is being tracked here:

Eh, I think I will stick with Sublime Text.
I didn’t get the autocomplete to work either, even with the Meteor plugin and jsconfig.json

Odd:

Which reminds me: Were you able to use the breakpoint feature for debugging? Because sticking debugger; everywhere always triggers a rebuild/ reload which makes it a bit cumbersome.

When I tried to use VSCode’s features for that I always got the grey circle which means that the source code couldn’t be mapped.

Hey everyone, just wanted to bump this thread and see if people are still happy with VSCode in Dec, 2021.

I’ve heard great things about Webstorm and am curious if anyone prefers that over VSCode.

Anyone still using Sublime?

I have been a Webstorm user for 3+ years. Couldn’t really adapt to anything else. It is just too good.

2 Likes

I will second that. I also tried Sublime and VSCode but they are little more than good code editors.

I loved VS Code, but switched to WebStorm a while ago and never looked back. The inspection features are just awesome.

Some years ago, I gave it a pass, because it was too slow. But on modern hardware, it feels just right. It has some UX quirks, though.

(The only thing I am missing is proper support for all Meteor package imports. Some packages are recognized, while others aren’t. Which means that I get warnings about missing packages that are actually there.)

1 Like

Call me a crazy boomer but I just duplicate a file and use it as a template. Never liked code completion apart from variable and method names