wz1000 / lsif-util

Utility tools for LSIF development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lsif-util

Scripts to help LSIF developers.

What's new

  • Up to date! Support for JSON Lines with the --inputFormat tag
  • Cleaning up! Standard filtering for all tools (no more unnecessary searching)

What's next

  • We are moving! The lsif-util tools will soon migrate to lsif-node
  • Getting official! Global npm package is on the way

Installation

git clone https://github.com/jumattos/lsif-util.git
cd lsif-util
npm install
npm run compile

Usage

node .\lib\main.js [validate|visualize] [file] --inputFormat [line|json] [--stdin] [filters]
Option Description Default
--inputFormat Specify input format (choices: "line", "json") line
--stdin Read from standard input false

You can use the --stdin flag to pipe LSIF output:

lsif-tsc -p .\tsconfig.json | node .\lib\main.js validate --stdin

Validation

Returns whether the LSIF input file is syntatically valid or not.

Verifies the following:

  • Vertex properties are correct
  • Edge properties are correct
  • Vertices are emitted before connecting edges
  • Vertices are used in at least one edge (except metadata)

Visualization

Option Default Description
--distance 1 Max distance between any vertex and the filtered input

Outputs a DOT graph.

You can either visualize it online using Viz.js or install Graphviz and pipe it to the DOT tool:

node .\lib\main.js visualize .\example\line.json --distance 2 | dot -Tpng -o image.png

graph example

Filters

Filters can help you narrow down what you want to validate/visualize. You can filter by some of the most common properties in LSIF. Different values should be separated by space. The "regex" filter is a special case that only accepts one value.

Property Node Example
--id Vertex/Edge 1 2 3
--inV Edge 1 2 3
--outV Edge 1 2 3
--type Vertex/Edge vertex edge
--label Vertex/Edge project range item
--property Edge references definitions
--regex Vertex/Edge foo

Validating outgoing edges from vertices 1, 2 or 3:

node .\lib\main.js validate .\example\line.json --outV 1 2 3

Visualizing ranges that have "foo" somewhere in them:

node .\lib\main.js visualize .\example\line.json --label range --regex foo

About

Utility tools for LSIF development


Languages

Language:TypeScript 100.0%