srclib-javascript is a srclib toolchain that performs JavaScript (Node.js) code analysis: type inference, documentation generation, jump-to-definition, dependency resolution, etc.
It enables this functionality in any client application whose code analysis is powered by srclib, including Sourcegraph.
Screenshots are below.
This toolchain is not a standalone program; it provides additional functionality to applications that use srclib.
First,
install the srclib
program (see srclib installation instructions).
Then run:
srclib toolchain install javascript
To verify that installation succeeded, run:
srclib toolchain list
You should see this srclib-javascript toolchain in the list.
Now that this toolchain is installed, any program that relies on srclib will support JavaScript.
(TODO(sqs): add a tutorial link)
Here's what srclib-javascript's analysis looks like in these applications.
The first screenshot shows the Underscore JavaScript library on Sourcegraph.com. Here, srclib-javascript enables clickable links for every identifier (that take you to their definitions), automatic cross-repository usage examples, type inference, and documentation generation.
The second screenshot shows the emacs-sourcegraph-mode plugin for Emacs with this toolchain installed. Here, srclib-javascript enables jump-to-definition, type inference, documentation generation, and automatic cross-repository usage examples from Sourcegraph.com. All code analysis is performed locally by srclib using this toolchain.
srclib-javascript is alpha-quality software. It powers code analysis on Sourcegraph.com but has not been widely tested or adapted for other use cases. It also has several limitations.
Array.prototype.
methods, etc.) or
browser objects (window
, document
, etc.) well.Testing this toolchain requires that you have installed srclib
from
srclib and that you have this
toolchain set up. See srclib documentation for more information.
To test this toolchain's output against the expected output, run:
srclib test
Patches are welcomed via GitHub pull request! See CONTRIBUTING.md for more information.
srclib-javascript's type inference is based on Tern.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。