jsctags
v5.2.2
Published
jsctags generator
Downloads
52
Readme
jsctags
jsctags generator using tern
install
For access to the binary:
npm install -g git+https://github.com/ramitos/jsctags.git
Otherwise, add to your project's package.json under dependencies or dev-dependencies:
"jsctags": "git://github.com/ramitos/jsctags.git"
usage
$ jsctags [--dir=/path/to] /path/to/file.js [-f]
$ cat /path/to/file.js | jsctags [--dir=/path/to] [--file=/path/to/file.js] [-f]
By default, jsctags
will output a JSON file. Use the -f
flag to output an exuberant ctags-compatible file.
const jsctags = require('jsctags');
const fs = require('fs');
const file = '/path/to/file.js';
const dir = '/path/to/';
const content = fs.readFileSync(file, 'utf8');
jsctags(file, dir, content, function(e, tags) {
console.log(tags);
});
Usage with Vim
If you'd like to take a JavaScript project and generate a tags
file that Vim can parse, you can use the below command. It searches your directory for any .js
files, excluding ./node_modules
, formats the tags correctly for Vim and outputs them into tags
.
find . -type f -iregex ".*\.js$" -not -path "./node_modules/*" -exec jsctags {} -f \; | sed '/^$/d' | LANG=C sort > tags
If you would like tags generated for files within node_modules/
, just remove the -not -path "./node_modules/*
part of the command:
find . -type f -iregex ".*\.js$" -exec jsctags {} -f \; | sed '/^$/d' | LANG=C sort > tags
examples
- arguments
- array_holes
- arrow
- autothis
- bind
- block_scope
- blowup
- browser
- builtins
- catch_error
- cautiouspropagation
- class
- computedprop
- contextcomplete
- copyprops
- ctorpattern
- defineProperty
- destructure
- docstrings
- effects
- empty_overridden_prop
- es6-features
- extends
- finddef
- findref
- fn_arguments
- for_of
- generate
- generator
- generic_each
- getter
- global_this
- hint-objlit
- hint_browser
- hint_ecma5
- hint_simple
- indirect_class
- infinite-expansion
- jsdoc
- map
- merge
- mixin
- new_array
- new_to_prototype
- object_create
- objectlit
- objnames
- order_of_definition
- phantom_object
- plus
- promise
- proto
- protoname
- react
- replace_bogus_prop
- set
- simple
- simple_generic
- super
- symbol
- template
license
MIT