Ⅰ. 插件描述
Autocompletion plugin for Meteor 1.0 (extending TernJS)Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'slava/tern-meteor'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'slava/tern-meteor'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'slava/tern-meteor'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/slava/tern-meteor
Ⅳ. 文档说明
TernJS plugin: Meteor
UPDATE: All definitions were update to Meteor 1.0.4. 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:

Look up documentation:

Jump to definition:

Jump to references:

Get types information (on the bottom):

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 3
Go and install the separate package for ST3.
Installation for 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. cdto.vimfolder,tern_for_vimplugin folder and runnpm installto
fetchternnpm module.- Download
meteor.jsfile (from this repo) to tern's foldertern_for_vim/node_modules/tern/plugins. - In your Meteor project create a file
.tern-projectwith 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.