Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including lsif-util with all npm packages installed. Try it out:

var lsifUtil = require("lsif-util")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

lsif-util v0.2.15

Utility tools for LSIF development.

lsif-util

Scripts to help LSIF developers.

Installation

npm install -g lsif-util

Usage

lsif-util [validate|visualize] [file] --inputFormat [line|json] [--stdin] [filters]
OptionDescriptionDefault
--inputFormatSpecify input format (choices: "line", "json")line
--stdinRead from standard inputfalse

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

lsif-tsc -p .\tsconfig.json | lsif-util 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

OptionDefaultDescription
--distance1Max 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:

lsif-util 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.

PropertyNodeExample
--idVertex/Edge1 2 3
--inVEdge1 2 3
--outVEdge1 2 3
--typeVertex/Edgevertex edge
--labelVertex/Edgeproject range item
--propertyEdgereferences definitions
--regexVertex/Edgefoo

Validating outgoing edges from vertices 1, 2 or 3:

lsif-util validate .\example\line.json --outV 1 2 3

Visualizing ranges that have "foo" somewhere in them:

lsif-util visualize .\example\line.json --label range --regex foo

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free