Git Product home page Git Product logo

tern-meteor's Introduction

TernJS plugin: Meteor

UPDATE: All definitions were update to Meteor 1.0. There are probably some bugs since this project moved to definitions autogeneration, if you notice any API mismatch, report in the issues.

This is a plugin for TernJS bringing support for Meteor JavaScript Framework. Tested on Vim and Sublime Text 2/3, reported to work on Emacs, potentially should work on Brackets, LightTable, Eclipse and any other CodeMirror-based editors.

Checkout my presentation on Meteor Devshop 11: Videos and Slides. The mailing thread for this project is here on meteor-talk.

Gif Demos

Types based auto-completion: tern-vim-completion.gif

Look up documentation: tern-vim-doc.gif

Jump to definition: tern-vim-jump-to-def.gif

Jump to references: tern-vim-refs.gif

Get types information (on the bottom): tern-vim-types.gif

Supported features specific to Meteor

  • each file is wrapped in a scope
  • global variable are global project-wise
  • interface definitions converted from meteor.ts.d

Todo features

  • correctly calculate package scope and their exports
  • some auto-completion based on Templates names would be nice
  • generate docs from docs.meteor.com
  • load all Meteor related JS files on the load of any file
  • parsing of handlebars template?

Installation for Sublime Text 2/3

Demo Video of Sublime Text

  • install Package Control (https://sublime.wbond.net/installation)
  • install sublime-tern plugin (cmd+shift+p -> install package -> TernJS -> restart sublime)
  • cd to Sublime Text packages directory (~/Library/Application Support/Sublime Text 3/Packages on Mac OS X) (Is your TernJS package fetched as binary file? see here)
  • cd TernJS/ternjs/plugin (or create the directories if they doesn't exist first - mkdir -p TernJS/ternjs/plugin)
  • copy over meteor.js file here
  • create a new sublime project, save it, add files
  • edit project configuration (menu->project->edit project)
  • edit the json file in this manner:
    {
      "folders":
      [
               ... don't touch this part, leave it as it was ...
      ],
      // add this! ternjs object
      "ternjs": {
        "libs": ["browser", "underscore", "jquery"],
        "plugins": {
          "meteor": {}
        }
      }
    }

Installation for Vim

Demo Video of Vim

You check out my Vim setup which is already optimized for Meteor development: GitHub repo. Or you can get it to your setup:

  • Install tern-vim plugin with your favorite package manager for Vim.
  • cd to .vim folder, tern_for_vim plugin folder and run npm install to fetch tern npm module.
  • Download meteor.js file (from this repo) to tern's folder tern_for_vim/node_modules/tern/plugins.
  • In your Meteor project create a file .tern-project with the contents similar to:
    {
      "libs": [
        "browser",
        "jquery",
        "underscore"
      ],
      "loadEagerly": [ "*.js", "*/*.js", "*/*/*.js", "*/*/*/*.js" ],
      "dontLoad": [ ".meteor" ],
      "plugins": {
        "meteor": {}
      }
    }

Note: ignore files in .meteor folder. Load all JS if possible.

tern-meteor's People

Contributors

angelozerr avatar sachag avatar slava avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.