lsif-node/util
Dirk Baeumer af612ddd52
Upgrade to TS 4.3.0
2021-04-23 15:23:10 +02:00
..
.vscode Fix issue where vertices were treated like edges and uncommented unit tests 2019-06-24 17:16:48 -07:00
bin Move lsif-util code to lsif-node (#45) 2019-06-20 14:06:18 +02:00
example lsif-util: Fix #70 by replacing \\" with \" in vertex extra info sections (#112) 2020-10-29 14:49:49 +01:00
image Move lsif-util code to lsif-node (#45) 2019-06-20 14:06:18 +02:00
src Upgrade to TS 4.3.0 2021-04-23 15:23:10 +02:00
.eslintrc.json Use ESLint to validate TypeScript files 2019-08-30 11:29:47 +02:00
LICENSE Move lsif-util code to lsif-node (#45) 2019-06-20 14:06:18 +02:00
README.md Update README.md 2019-12-11 10:47:01 -08:00
package-lock.json Fix test failures uner Windows 2021-04-21 15:36:16 +02:00
package.json Remove validate from util package and point to tooling. 2021-04-06 13:44:49 +02:00
tsconfig.json Improve tooling setup 2020-11-27 12:08:26 +01:00
tsconfig.publish.json Convert util code to 1::n edges 2019-06-20 15:30:57 +02:00
tsconfig.watch.json Improve tooling setup 2020-11-27 12:08:26 +01:00

README.md

lsif-util

Scripts to help LSIF developers.

Installation

npm install -g lsif-util

Usage

lsif-util [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 --stdout | 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

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:

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.

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:

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