ternjs / tern_for_sublime

Sublime Text package adding Tern support
MIT License
803 stars 54 forks source link

could it have the preferences to always load browser or jquery object? #35

Open kentliau opened 10 years ago

marijnh commented 10 years ago

That'd be a useful feature, I agree. Want to implement it?

kentliau commented 10 years ago

could it as simple as just have one more "tern_preload_libs": [ "browser", "jquery" ] in the Preferences files?

kentliau commented 10 years ago

or even better, specify a default .tern-project configuration in the Preferences files

marijnh commented 10 years ago

Actually, this is probably best done on the side of the server -- it could read ~/.tern-default-project when it fails to find a local project config. (Not sure why I did not think of that before.) On windows, I guess that wouldn't work -- no idea what the equivalent would look like there.

kentliau commented 10 years ago

I made a pull request for the tern project that include a new parameter when starting the server. this new paramenter --config will accept an encoded json string, i am now figuring how to add more argument in this sublime plugin, it doesn't seem like working even i hard-coded the --config argument

kentliau commented 10 years ago

@marijnh I have no idea why I hard-code the --config argument to the tern.py files it still doesn't work.

at line 504

tern_command = ["node",  os.path.join(plugin_dir, "node_modules/tern/bin/tern"), "--no-port-file --config '{libs:[\"browser\"]}'"]

PS: I need to sleep now, my great Sunday, will continue later

marijnh commented 10 years ago

The arguments passed on the command line should be added as separate strings in the array. So I think this might work:

tern_command = ["node",  os.path.join(plugin_dir, "node_modules/tern/bin/tern"), "--no-port-file", "--config" "{libs:[\"browser\"]}"]