Language Server Index Format (LSIF) generator for JSonnet
21
stars
26
commits
Go
primary language
Jul 3, 2026
updated
🚨 This implementation is still in very early stage and follows the latest LSIF specification closely.
The purpose of the Language Server Index Format (LSIF) is to define a standard format for language servers or other programming tools to dump their knowledge about a workspace. This dump can later be used to answer language server LSP requests for the same workspace without running the language server itself. Since much of the information would be invalidated by a change to the workspace, the dumped information typically excludes requests used when mutating a document. So, for example, the result of a code complete request is typically not part of such a dump.
A first draft specification can be found here.
JSonnet is a data templating language related to JSON.
In true open-source spirit the implementation is made from these parts:
The parser is generated by Antlr4 from a grammar file modified from this GitHub Gist.
The protocol.go code was borrowed and modified from lsif-go.
The LSIF dumper is a modification of indexer.go from lsif-go.
The scope implementation is a modification of go.types.Scope.
Many thanks to the creators of these.
This was put together quickly to learn LSIF and JSonnet. It is missing many features, for example hover results, documentation comments (parser currently discards comments), error handling, the standard library is not covered. It has not seen code reviews, so it's highly likely that there are bugs, omissions and oversights. It can serve as a starting point for more production-ready implementations for JSonnet or other languages.
cmd/lsif-jsonnet cli the usual way with Go.jsonnet cli, so you can specify libsonnet search paths with -J and the output
file with -o.After installing Antlr4 and the Go target you can run this command from the repo root:
antlr -Dlanguage=Go -o parser Jsonnet.g4
lsif-util is a commandline tool for validating the generated LSIF data syntactically. It also supports producing dot graphs that can be turned into PNG images with dot.
lsif-util validate data.lsiflsif-util visualize data.lsif --distance 2 | dot -Tpng -o image.pngGo
86.1%
ANTLR
12.0%
Jsonnet
1.9%
Language Server Index Format (LSIF) generator for JSonnet
21
stars
26
commits
Go
primary language
Jul 3, 2026
updated
🚨 This implementation is still in very early stage and follows the latest LSIF specification closely.
The purpose of the Language Server Index Format (LSIF) is to define a standard format for language servers or other programming tools to dump their knowledge about a workspace. This dump can later be used to answer language server LSP requests for the same workspace without running the language server itself. Since much of the information would be invalidated by a change to the workspace, the dumped information typically excludes requests used when mutating a document. So, for example, the result of a code complete request is typically not part of such a dump.
A first draft specification can be found here.
JSonnet is a data templating language related to JSON.
In true open-source spirit the implementation is made from these parts:
The parser is generated by Antlr4 from a grammar file modified from this GitHub Gist.
The protocol.go code was borrowed and modified from lsif-go.
The LSIF dumper is a modification of indexer.go from lsif-go.
The scope implementation is a modification of go.types.Scope.
Many thanks to the creators of these.
This was put together quickly to learn LSIF and JSonnet. It is missing many features, for example hover results, documentation comments (parser currently discards comments), error handling, the standard library is not covered. It has not seen code reviews, so it's highly likely that there are bugs, omissions and oversights. It can serve as a starting point for more production-ready implementations for JSonnet or other languages.
cmd/lsif-jsonnet cli the usual way with Go.jsonnet cli, so you can specify libsonnet search paths with -J and the output
file with -o.After installing Antlr4 and the Go target you can run this command from the repo root:
antlr -Dlanguage=Go -o parser Jsonnet.g4
lsif-util is a commandline tool for validating the generated LSIF data syntactically. It also supports producing dot graphs that can be turned into PNG images with dot.
lsif-util validate data.lsiflsif-util visualize data.lsif --distance 2 | dot -Tpng -o image.pngGo
86.1%
ANTLR
12.0%
Jsonnet
1.9%