azdavis / rjsonnet

An implementation of Jsonnet in Rust.

Home Page:https://marketplace.visualstudio.com/items?itemName=azdavis.rjsonnet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rjsonnet

An implementation of Jsonnet in Rust, which aims to conform to the spec, and is built with the IDE use-case in mind.

Warning

This project is pre-MVP. Most IDE features are not implemented. Some language features haven't even been implemented. There are a lot of TODOs and probably a good amount of latent bugs.

For more mature alternatives, consider:

Install

Features

  • Inline diagnostics
  • Go-to-definition
  • Hover for info

Demo

demo.mov

Ways to use

VS Code

The primary intended way to use this is via the language server and its official VS Code extension.

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.

CLI

There is also a CLI that can translate Jsonnet files into JSON.

Try it

First time repo setup

  1. Get Rust.
  2. Clone or download the repo.
  3. Enter the repo.

Now you can run things like:

$ cargo build
$ cargo test
$ cargo clippy
$ cargo fmt
$ cargo xtask ci

CLI

Run:

$ cargo run --bin jsonnet-cli -- --manifest foo.jsonnet

to turn foo.jsonnet into JSON and report any errors.

Language server + VS Code extension

  1. Get VS Code.
  2. Get Node.
  3. Open the repo in VS Code.
  4. Click "Run and Debug" (by default, the triangular play button with bug on the left).
  5. 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.
  6. Open that VS Code on a folder with Jsonnet files.
  7. Ensure other Jsonnet-related extensions like Jsonnet LSP are disabled.
  8. Try out the IDE features like inline diagnostics and go-to-def.

Credits

I took a lot of inspiration from the existing Jsonnet LSP 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.

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.

About

An implementation of Jsonnet in Rust.

https://marketplace.visualstudio.com/items?itemName=azdavis.rjsonnet

License:Apache License 2.0


Languages

Language:Rust 99.6%Language:TypeScript 0.4%