https://github.com/azdavis/rjsonnet
A language server for Jsonnet in Rust.
https://github.com/azdavis/rjsonnet
jsonnet language-server rust
Last synced: about 1 month ago
JSON representation
A language server for Jsonnet in Rust.
- Host: GitHub
- URL: https://github.com/azdavis/rjsonnet
- Owner: azdavis
- License: apache-2.0
- Created: 2023-08-20T02:32:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-08T03:39:46.000Z (about 1 month ago)
- Last Synced: 2025-04-08T04:27:45.312Z (about 1 month ago)
- Topics: jsonnet, language-server, rust
- Language: Rust
- Homepage: https://azdavis.net/posts/rjsonnet/
- Size: 2.57 MB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: docs/CONTRIBUTING.md
- License: LICENSE-APACHE.md
- Code of conduct: docs/CODE_OF_CONDUCT.md
- Security: docs/SECURITY.md
Awesome Lists containing this project
README
# rjsonnet
An implementation of [Jsonnet][] in [Rust][], which aims to conform to the [spec][], and is built with the IDE use-case in mind.
## Install
- [VS Code Marketplace][vs-code-marketplace]
- [Open VSX][open-vsx]## Screenshots
### Syntax highlighting, error tolerant parsing, and inline diagnostics

### Go to (or peek) definition

### Hover for type, standard library docs, and typechecking

### Auto-complete object fields

### Type annotations and signature help

### Flow typing

## Ways to use
### VS Code
The primary intended way to use this is via the [language server][lsp] and its [official VS Code extension][vs-code-marketplace].
### Language server
You can also use the language server with any editor that supports language servers. You'll just have to write your own glue code between this server and your editor.
## Building from source
1. Get [Rust][rustup].
1. Clone or download the repo.
1. Enter the repo.Now you can run things like:
```
$ cargo build
$ cargo test
$ cargo clippy
$ cargo fmt
$ cargo xtask ci
```You can also build the VS Code extension:
1. Get [VS Code][vscode].
1. Get [Node][node].
1. Ensure other Jsonnet-related extensions like [Jsonnet LSP][carl] are disabled.
1. Open the repo in VS Code.
1. Click "Run and Debug" (by default, the triangular play button with bug on the left).
1. In the "Run and Debug" sidebar that appears, click the triangular play button by "extension" (you may need to select it from the drop-down). Another VS Code will pop up, with the extension enabled.
1. Open that VS Code on a folder with Jsonnet files.
1. Try out the IDE features like inline diagnostics and go-to-def.## Credits
I took a lot of inspiration from the existing [Jsonnet LSP][carl] extension, but I wanted to try doing it myself, in Rust, from scratch, specifically for IDEs. I had already done so with Standard ML in [Millet][millet].
## Alternatives
### Jsonnet language servers
Some prior art:
- [Jsonnet LSP][carl], by Carl Verge
- [Jsonnet Language Server][grafana], by GrafanaThese implementations are based off of the [Go implementation of Jsonnet][gojsonnet].
### Rust implementations of Jsonnet
- [jrsonnet](https://github.com/CertainLach/jrsonnet), by CertainLach
- [rsjsonnet](https://github.com/eduardosm/rsjsonnet), by eduardosmConfusingly, the Python bindings for the former are called [rjsonnet](https://pypi.org/project/rjsonnet/).
These implementations are more targeted at implementing the Jsonnet language for evaluating/manifesting it to JSON. This project has some evaluation functionality implemented, but it is mainly intended to be a language server. This makes evaluation of Jsonnet into JSON less of a project goal.
## License
Like Rust itself and many other projects in the Rust community, this project is licensed under either the MIT license or the Apache license v2.0, at your option.
[Jsonnet]: https://jsonnet.org
[lsp]: https://microsoft.github.io/language-server-protocol
[node]: https://nodejs.org/en
[carl]: https://marketplace.visualstudio.com/items?itemName=cverge.jsonnet-lsp
[grafana]: https://marketplace.visualstudio.com/items?itemName=Grafana.vscode-jsonnet
[Rust]: https://www.rust-lang.org
[rustup]: https://rustup.rs
[spec]: https://jsonnet.org/ref/spec.html
[vscode]: https://code.visualstudio.com
[millet]: https://github.com/azdavis/millet
[vs-code-marketplace]: https://marketplace.visualstudio.com/items?itemName=azdavis.rjsonnet
[open-vsx]: https://open-vsx.org/extension/azdavis/rjsonnet
[gojsonnet]: https://github.com/google/go-jsonnet