Coder Social home page Coder Social logo

jsctags's Introduction

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

license

MIT

jsctags's People

Contributors

sergioramos avatar faceleg avatar timkendrick avatar mohitleo9 avatar arnaudvalensi avatar denton-l avatar jackfranklin avatar jelera avatar lastjune avatar asmod3us avatar herrernst avatar tecfu avatar

Watchers

James Cloos avatar Rom Grk 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.