Navi Tools
Cli Commands
Navi has a command line tool navi
, you can use it to run, test, and benchmark your Navi code.
Use navi -h
to see the help.
navi run
Use navi run
to run a Navi file, default it will run main.nv
in the current directory.
$ navi run
Or you can pass a file name to run it.
$ navi run main.nv
Or use -s
to run a script.
navi run -s 'use std.io; io.println("Hello World!");'
navi test
Use navi test
to run tests in a Navi file, default it will run all tests (*/.{nv,nvs}) in the current directory.
$ navi test
Or you can pass a file name to run it.
$ navi test foo/bar.nv
navi bench
Use navi bench
to run benchmarks in a Navi file, default it will run all benchmarks (*.{nv,nvs}) in the current directory.
WARNING
Unlike navi test
, navi bench
will not iter all subdirectories, it will only run benchmarks in the current directory.
$ navi bench
Or you can pass a file name to run it.
$ navi bench foo/bar.nv
navi fmt
navi fmt
is a code formatter for Navi, it can format your code to a standard style.
$ navi fmt -h
Format all Navi files (*.nv)
Usage: navi fmt [OPTIONS] [INPUT]
Arguments:
[INPUT] File (.nv) or path to format [default: .]
Options:
-e, --emit <EMIT> Emit formatted code to stdout or write to file [default: files] [possible values: files, stdout]
-s, --stdin Read code from stdin
-t, --type <TYPE> Whether to read Navi code or Navi Stream code [default: nv] [possible values: nv, nvs]
-h, --help Print help information
Editor Support
VS Code
Navi has an VS Code extension, which can help you to write Navi code.
https://marketplace.visualstudio.com/items?itemName=huacnlee.navi
Zed
https://github.com/navi-language/zed-navi
We have a Zed extension for Navi, just open you Zed Extensions and search navi
, you will find it.
Navi LSP Server
Navi LSP Server is a Language Server Protocol for Navi and Navi Stream, it can be used in any IDEs that support LSP.
The navi-lsp-server
bin is included in the release package: when you install Navi, you will get the navi-lsp-server
bin.
$ navi-lsp-server &
Starting Navi LSP server
Tree Sitter
We have tree-sitter support for Navi and Navi Stream, you can use it in any editor that supports tree-sitter.
tmLanguage
There have a tmLanguage
file of Navi and Navi Stream for syntax highlight.
GitHub Actions
We have a GitHub Action for Navi, you can use it like this:
- uses: navi-language/setup-navi@v1
If you want a special Navi version:
- uses: navi-language/setup-navi@v1
with:
navi-version: 0.9.0
Visit navi-language/setup-navi to learn more.