2 Star 0 Fork 0

mirrors_sourcegraph/srclib-javascript

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

srclib-javascript Build Status

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.

Installation

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)

Screenshot

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.

screenshot

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.

screenshot

Known issues

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.

  • Currently only detects and analyzes CommonJS packages (anything with a package.json), including Node.js packages. In particular, this means it generally does not handle front-end/client-side JavaScript.
  • Does not handle global ECMAScript 5 (Array.prototype. methods, etc.) or browser objects (window, document, etc.) well.
  • Gets easily confused by complex CommonJS module re-exporting. (E.g., when an index.js file requires submodules and re-exports them, it doesn't do a good job of tracing external invocations of the module to their actual function literal definition.)

Tests

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

Contributing

Patches are welcomed via GitHub pull request! See CONTRIBUTING.md for more information.

srclib-javascript's type inference is based on Tern.

空文件

简介

JavaScript (node.js) toolchain for srclib 展开 收起
取消

发行版

暂无发行版

近期动态

4年多前创建了仓库
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_sourcegraph/srclib-javascript.git
git@gitee.com:mirrors_sourcegraph/srclib-javascript.git
mirrors_sourcegraph
srclib-javascript
srclib-javascript
master

搜索帮助