开发者

Would JSDOM work to setup a projects exuberant ctags?

Looking forward towards excellent javascript ctags support kept me thinking if a project like http://zombie.labnotes.org/ could be used to setup ctags to keep a vim user happy开发者_开发百科.


Hum, none of the projects you are citing are parsers or have anything to do with ctags.

  • PhantomJS let's you run your script as if it was run by a webkit-based browser. It won't output an analysis of your code, it will just execute it. You can use it to do a toSource() or a isPrototypeOf() on a function but that would be rather pointless.
  • JSDOM is an implementation of the DOM to use within your script. It can't be run as an external tool so it can't be used to generate tags or analyse your code.
  • Zombie.js is a testing framework that simulates a browser for you. Like JSDOM, it can't be run as an external tool and it has no ability to analyse your code.

You can feed your current script to phantomjs with :!phantomjs % or use zombie or jsdom in your script but none of it will help you have a better idea of the structure of your code or jump to the definition of a method.

However, if you use either zombie or jsdom or whatever other library in your project you can generate their respective tags files and add them to your .vimrc like this:

autocmd FileType javascript     set tags+=path/to/a/library/tags
autocmd FileType javascript     set tags+=path/to/another/library/tags

If what you want is a better/more modern tags generation you can try DoctorJS' jsctags or look at this thread for a more hackish way to make ctags work for you. As far as I know, these are you only options right now.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜