Skip to content

v0.11.0

Language

  • Now we published release for Windows platform.

  • Improved the Closure syntax to support write in one line.

    rs
  • spawn, defer now support without block.

    rs
    • And with this support, we have to changed empty map initialization from {} to {:}.
  • Add #[track_caller] annotation for function, see also: Track Caller

    rs

    Will output:

  • Improve init array with rest expr:

    rs
  • Add to support unescape in char.

    rs

Stdlib

  • Add std.net.tcp module, and here is a guides: Echo Server
  • Add std.fs.copy.
  • Add std.io.BufReader, std.io.BufWriter.
  • Add flush method to std.io.Write interface.
  • Add std.str.Debug to create debug string with Debug interface.
    rs
  • Add std.backtrace module to get backtrace info.
  • Add std.env.join_paths method.
  • Improve std.net.http, removed form, multipart argument, let body support more types.
  • Improve array's unique, reverse, sort, sort_by, resize, truncate, clear to return it self.
  • Imporve std.process to add Command, process.run now returns Child instance.
  • Imporve std.fs, std.process internal handle for better performance.
  • Improve std.path.join to supports arbitrary argument: path.join("a", "b", "c", "d").
  • Improve std.crypto, let update and hmac function to support string | Bytes.
  • Fix path join to use push avoid crate Path object.
  • Rename std.url.URL -> std.url.Url.

Pkg

  • Done with longport package.

Tools

We have rewrote navi test, navi doc command, and build a new stdlib docs.

https://navi-lang.org/stdlib/std.crypto

Now, there have more details in the docs, and we will keep improving it.

  • navi doc is rewritten with new output format for better to generate docs.

  • Improve navi test with parallel test running and we optimized the test result output.

  • Improve navi test --doc to show the correct line number in Markdown file.

  • Add Navi info print when run navi test, navi bench command.

  • Temporary workaround for apple-darwin-aarch64 to print backtrace.

Other changes

  • fmt: leave comma in multi-line array_list.
  • fmt: if there is no code in a closure, just an empty {}, no line breaks.
  • fmt: Fix missed the function attributes.
  • lsp: use custom display_value_type only for inlay hint.
  • lsp: call display on ValueType in autocomplete.
  • lsp: find_navi_toml_pathbuf and all *.nv thereunder for cache.
  • lsp: look for immediate parent dir in create_compile_options.
  • lsp: find cache's member info to do when cfg debug assertions
  • lsp: auto complete global vars of a Module.
  • lsp: check the client’s capabilities and returns either a simple code action capability or a detailed set of supported code action kinds.
  • lsp: allow retrying in dispatch.
  • lsp: skeleton of handle_code_action, handle_code_action_resolve.
  • lsp: search cache_stdlib, cache_userlib to generate fix advice.

v0.10.0

Language

  • Added expect, unwrap, unwrap_or, or, or_else, and, and_then, is_nil, map, map_or, ok_or, inspect, flatten methods to optional value.
  • Added type alias statement to define a type alias, and type statement to define a newtype.
  • Improved do/catch to better handle error.
  • Added to support call method in union type.
  • Added support tag attribute for newtype serde.
  • Added to support overridden the default imported names in code scope. e.g.: Error, you can have your own struct Error to override the default Error.

Stdlib

  • Removed std.io.Buffer, instead with new std.io.Bytes.
  • Moved module under lang to std, and default import string, channel, Any, Decimal, removed lang module.
  • Improved to default import print and println method from std, now we can call it directly without use.
  • Added to support log format (full, json, pretty, compact).
  • Renamed URLEncodedForm to UrlEncodedForm in std.net.http.
  • Added File.seek and File.rewind method to std.fs.
  • Added to support flag and mode options for fs.open and File.open method.
  • Added fs.copy, fs.copy_dir, fs.rename, fs.hard_link, fs.symlink, fs.unlink method.
  • Improved assert_throws, the secondary argument support with a closure to write custom assert.

Pkg

  • Added csv package to support read and write CSV file.
  • Add draw function.

Tools

  • doc: Added more details doc for array methods.
  • doc: Added to support navi-doc to generate method docs in lang.optional, lang.int ...
  • doc: impl Display for Enum, Struct, Interface, and Module.
  • doc: show "instance" for nvs object value types.
  • fmt: Updated to indent for switch and case with different levels.
  • lsp: Added navi_stream language match support for Zed editor.
  • lsp: Added to support goto definition for Navi to Navi Stream source.
  • lsp: Added to support show hover info for struct fields.
  • lsp: Improved find symbol of TypePathNode::Normal.
  • lsp: determine language_id by file extension.
  • lsp: find ImportedModule in current module file symbols first.
  • lsp: fix bug of there being always an error message left (nvs).
  • lsp: generate diagnostics for Navi Stream.
  • lsp: optimize inlay hint padding and improve hover info for Navi Stream.

v0.9.6

Language

  • Improved the navi run and navi test commands for searching the navi.toml within a subproject.
    • Added support for finding navi.toml to locate the workspace path.
    • Added the navi new command to create a new project.
    • Removed the --all-dir option from navi test, as it is no longer necessary.
  • Improved the array type to include more methods: map, filter, filter_map, concat, sum, max, min, position_max, position_min, max_by, position_max_by, min_by, position_min_by, product, index_by, contains_by, clone.
  • Improved the map type by adding clone methods.
  • Updated the spawn behavior to execute immediately.
  • Fixed support to assign closure to closure?.
  • Fixed a bug where the interface default method's first argument must be self error on release.
  • Improved internal conversion from char to string.

Stdlib

  • Added std.log.
  • Added std.io.Write as Logger output support and added the prefix method.
  • Fixed serialization to support union types.
  • Updated the to_string methods of JSON, YAML, and TOML to support any? and added more tests.
  • Fixed serialization bugs for some complex cases.

Tools

  • We have released the Zed extension for Zed with LSP support. Now code formatting, code completion, hover, go-to-definition, find references, rename, and more features are available in Zed.

    • Open your Zed and go to Extensions to search for navi and install it.
    • Currently, only available for Zed Preview version.
  • doc: Added support to generate enum, interface, type for the navi doc command.

  • doc: Fixed impl enum navi doc generation and included the source code signature by using navi-fmt code generation.

  • lsp: Fixed LSP absolute path in Zed and other compatibility fixes for Zed.

  • lsp: Enhanced LSP to support showing hover info on expr nodes.

  • lsp: Fixed LSP inlay hints left padding.

  • fmt: Fixed to ensure that the semicolon comes before for long lines.

Breaking Changes

  • Removed the --all-dir option from navi test, as it is no longer needed.
  • Renamed error interface to Error.
  • Removed execute_many from the sql package because it was deprecated in sqlx.

v0.9.5

Core

  • Add decimal as builtin type.
  • Fix object pool memory leak.

Stdlib

  • Improve stdlib throws errors, now all errors has it's own error type.
  • Add std.time.Instant.
  • Fix std.time.DateTime, iso8601 to use ISO 8601 format, to_string to use RFC 3339 format.
  • Add std.time.Duration and std.time.DateTime, decimal to support serialize and deserialize.
  • Fix operator (>, >=, <, <=) support for std.time.Duration.
  • Fix regex.Captures gc mark leak.

Pkg

  • Add acquire_timeout option for sql.Connection.connect, default is 30s.
  • Add extra-engine support to sql.

    Extra Engine backend is a experimental feature, it can be used to execute sql with different engine (CSV, Aliyun OSS, AWS S3, MySQL, PostgreSQL, etc).

  • Add close method to sql.Rows to close the rows.
  • Add longport SDK basic feature to support LongPort OpenAPI.

Tools

  • Improve Navi LSP performance, and improve auto-completion details.
  • Improve zed-navi syntax highlight v0.0.4
  • Improve vscode-navi to support decimal.

v0.9.4

Language

  • Add to support arbitrary parameters.

    rs,no_run
  • Add top support iterate for channel types.

    rs,no_run
  • Add to support impl for.

    rs
  • Add support lazy initialization.

    rs
  • Add char type.

    rs
  • Add to support while let.

    rs
  • Now can iterate over a string.

    rs
  • Improve string performance.

  • Improve string interpolation for support ${x:?} to print debug format.

  • Improve implicit conversion to support.

    rs
  • Fix the break in do, catch block can't break the outside loop bug.

Stdlib

  • Add time.sleep method.

    rs
  • Improve std.io.print to support arbitrary argument.

    rs
  • Update http Headers apppend, set method, not allows nil value.

  • Update http set_basic_auth the username not allows nil.

Pkg

The pkg is used to manage packages that many split out of Navi in the future.

  • Add sql module to support SQlite, MySQL, PostgreSQL, etc.

    rs
  • Add markdown module to support markdown render to HTML.

    rs

Tools

  • Fix Navi LSP to better autocomplete and documentations support.
  • Add cache support in Navi LSP for better performance.
  • Add format support in Navi LSP.
  • fmt: insert a new line after std uses.
  • fmt: sort outer-layer use { ... } statements
  • New tree-sitter-navi, tree-sitter-navi-stream project for tree-sitter support.
  • Add Zed extension support, current only syntax highlight support.

v0.9.3

Language

  • Add generic function supports.

  • Add the enum syntax.

    rs
  • Add the const syntax to define a constant.

    rs
  • Add the pub keyword to define a public fn, struct, struct field, const, enum ..., now only the pub members can be visited from other modules.

    rs
  • Improve compile error message, and write test case for it.

  • Allows to visit the const from other modules.

  • Add r\`raw string\` syntax to better write Regex rules.

    rs
  • Improvement performance for internal calls, string, Object Ref.

  • Add to support use _ in a number literal.

    rs
  • Add interface inheritance support, and support default implementation.

    rs
  • Improve assignment detect, now array, map can avoid declaring types, if the left side is a known type.

    rs
  • Improve Struct Field and Kw Arguments assignment, if the variable name is the same as the field name, we can use a short syntax.

    rs
  • Add Union Type support.

    rs

Stdlib

  • Rewrite stdlib by Navi wrapper (internal is Rust Native), for better interface, and error support.

  • Add std.io.{Read, Write, Close} interface.

  • Rewrite stdlib by using interface io.Read, io.Write instead of [byte] for support stream, mostly for std.fs and std.net.http.

    rs
  • Add std.net.http.Client to create an HTTP client.

  • Add std.io.Cursor for writing a [byte] or string to support std.io.Read interface.

  • Add json.from_reader to support parse JSON from a std.io.Read in stream.

  • Fix sort array incorrect order bug in some cases.

  • Add std.xml module to support parsing XML.

  • Add std.toml module to support parsing TOML.

  • Add std.io.StringBuffer for mutable string like std.io.Buffer.

Tools

  • lsp: Add Go to define support for LSP, and support to visit Navi stdlib source code.
  • lsp: Add Hover document for LSP.
  • lsp: Add support newline to keep /// comment in next line.
  • lsp: Add support a bit of Auto Complete support, still need to improve.
  • fmt: use statement will be sorted by alphabet, and keep self in the first.
  • test: Add navi test --all-dirs to test all sub-dir, and default test current dir.
  • test: Improve assert results and use "" to wrap them for a better read.
  • build: We use Navi to write our internal CI build and publish script now.

v0.9.1

Language

  • Add to support error handling, see Error doc.

    rs
  • Add Static Method support, and rewrite all stdlib.

    rs
  • The first argument on the Instance Method now must have a self parameter.

    rs
  • Add new serialization support for json, yaml module.

    rs
    • Add also support to deserialize to the any type.
    rs
  • Add Raw String syntax: r`this is string` for better use for the regular expression.

    rs
  • Improve the use syntax to support as and import multiple items.

    rs
  • Add type keyword to define Type Alias.

    rs
  • Improve syntax to assign an array, or map without type annotation, if the left side has a known type.

    rs

Stdlib

  • Rewrite all stdlib to use Static Method, Error Handling, and the new Serialization support.
  • Removed to_json, to_yaml method, use json.to_string, yaml.to_stirng instead.
  • Add File.open, File.create and fs.write, fs.write_string.
  • Add replace_with, replace_all_with, captures to regex.Regex.
  • Rename match, match_all to find and find_all for regex.Regex to avoid keywords.
  • Add utc, to_offset method to time.DateTime.
  • Add step method to Range type.
  • Add bytes method to Buffer.
  • Add set_file method to multipart.Form to support file upload, see Multipart doc.
  • Rename to_int, to_float into parse_int, parse_float for string.

Tools

  • Publish Navi Learn, Navi Stdlib docs on the website.
    • And now use Navi instead of TypeScript to write scripts for website docs generated.
    • All stdlib docs have been generated by navi doc --stdlib command.
    • Add Navi Stream doc.
  • Add Outline display support for LSP and VS Code extension.
  • Add Inlay Hints support for LSP and VS Code extension.
  • Add new syntax support for navi fmt.
  • Add navi doc command to generate documentation for Navi files.
  • Add navi doc --stdlib command to generate documentation for Navi's standard library.
  • Add navi test --doc command to test the Markdown code blocks in Navi files.

v0.9.0

Language

  • Add interface support.
  • Add navi fmt to format code, and install the VS Code extension.
  • Add loop statement to loop forever.
  • Add getter, and setter to built-in type.
  • Add dotenv support, now will auto load .env file in the current directory as environment variables.
  • Add if let statement.
  • Add main function, now navi run will run the main function in main.nv file in default.
  • Add httpbin feature into testharness to speedup HTTP test.

Stdlib

  • Add resize, truncate, split_off, chunks method to array.
  • Add weekday to std.time.
  • Add std.process with exit, abort, pid, exec, run, args function.
  • Add std.json, std.yaml, std.querystring modules for JSON, YAML, QueryString parse, and stringify.
  • Add std.value module to common value type.
  • Add basic_auth method to HTTP Request.
  • Add chunk method to HTTP Response.
  • Add multipart, form, timeout to http.Request.
  • Add read, read_string to fs.File, and read, read_string to fs module.
  • Add std.io.stdin, std.io.stdout, std.io.stderr.
  • Add join to std.url.
  • Add std.env.vars to get all vars.

Breaking Changes

  • Rewrite string interpolation from {1 + 2} to ${1 + 2} like JavaScript.
  • Kw Arguments now use : instead of =, e.g.: fn(a: 1, b: 2), no longer allowed to be passed positionally.
  • Most struct get method in stdlib now is getter, e.g.: host instead of host() for url.URL.
  • Rename fs.read_string to fs.read_to_string.
  • Rename io.from_bytes to io.new_bytes_from_array.
  • Move cwd, chdir from std.path to std.env.

Examples

Interface

Like Go, you can define an interface in the following way:

rs

If let

rs

v0.8.6

What's Changed

  • Add Optional Type and Optional Chaining.
    • All Stdlib API will return an optional type if it can be nil, like Rust.
    • Now all Object Types can't be nil, but you can use ? to make it optional.
  • Done with the Keywords Arguments support.
  • Add sub for std.time.DateTime with return a Duration.
  • Add std.net.http with HTTP request methods and Headers, Request, Response types.
  • Add std.net.tcp_conn, std.net.tcp_listener, std.net.ip_addr this is still in development.
  • Add std.io.bytes to the storage bytes array, move std.buffer to std.io.buffer and base on std.io.bytes.
    • Now all bytes methods will return std.io.Bytes type.
    • Refactor Stdlib API, std.io.bytes.new to std.io.new_bytes, std.io.buffer.new to std.io.new_buffer.

Optional Type

Navi's optional type is similar to Rust's optional type, but it has some differences.

rs

Keywords Arguments

All optional argument values can be called with keywords argument syntax.

rs

Other Changes

  • Improve test results to show the test file path.
  • Move std.path.glob to std.fs.glob.

v0.8.4

Language

  • Add closure statement support.

    rs
  • Improve the internal objects to map string interpolation call to to_string method.

  • Fix to assign map element by key: items["foo"] = 1.

  • Fix comparing object and nil.

Test

  • Add bench for write benchmark tests, and navi bench command.
  • Allows navi test to run all tests in the current folder.
  • Add tests and benches statements for wrapper test cases.
  • Add assert_eq, assert_ne statements for tests.
  • Improve the test result, and only show diff when it has multiple lines/

Stdlib

  • Add std.time and std.time.DateTime, std.time.Duration.
  • Add std.regex and std.regex.Match, with match, is_match, replace, replace_all methods.
  • Add std.crypto with hash, hmac and md5, sha1, sha256, sha512 algorithms.
  • Add std.buffer.
  • Add std.rand with rand.int, rand.float, rand.bytes methods.
  • Add module std.base64 with encode, decode, urlsafe_encode, urlsafe_decode methods.
  • Add std.url and std.url.URL.
  • Add math functions to int and float.
  • Add std.path with extension, join, base, parent, and exists methods...
  • Add std.fs with open, create, create_dir, create_dir_all, remove_file, remove_dir, remove_dir_all, glob methods, now we can read and write file.
  • Add std.env to read & write env variables.
  • Add keys, values method to std.collection.Map.
  • Add len, bytes, contains, to_lowercase, to_uppercase, substring, split, replace, starts_with, ends_with, trim, repeat, strip_prefix, strip_suffix ... method to string.
  • Add to_int, to_float to string.
  • Add unique, reverse, sort methods for array.