Nova

Extensions


Readme

TOML Syntax for Nova

A simple Tree Sitter-based Nova extension providing editor support for TOML files.

Language Support

TOML (Tom's Obvious Markup Language) is a very straightforward and, according to Tom, obvious syntax.

Given the relative simplicity of the syntax, this extension is pretty much considered feature-complete. Any future updates would likely only focus on integrating additional IDE-like functionality and keeping up with any relevant changes introduced in Nova's extension API.

Beyond syntax highlighting, this extension also includes very basic implementations of the following features: * Code folding * Symbolication

NOTE: this extension is only supported on Nova v10.0 and higher

Motivation

There already exists a TOML language extension in Nova but it has one really annoying bug which inserts \# instead of # when commenting. That extension doesn't appear to be maintained though, so I thought I'd just keep a local fork of it with that one character removed.

However, since the new Tree Sitter language system was released in Nova 10.0 the same day this was written, I figured I might as well try and compile an existing Tree Sitter grammar for TOML and publish it since the highlighting is more complete.

I've tried to keep the same highlighting selectors/colors as the existing extension, although this syntax also adds highlighting of some value types (numeric, datetime, and other literals) that it didn't pick up.

Development

Tree Sitter

The TOML syntax used by this extension is located at nlydv/tree-sitter-toml and linked here as a submodule. It's a lightly modified fork of ikatyang/tree-sitter-toml that exposes additional nodes in the syntax tree for queries to hook into.

Building

git clone https://github.com/nlydv/nova-toml
cd nova-toml
git submodule update --init
./build.sh

Then, to install the built extension:

open TOML.novaextension

Nova should launch (if not already running) and ask you to confirm.

License

Copyright © Ika Copyright © 2023 Neel Yadav MIT License

Full license text is available in the LICENSE.txt file.


Changelog

TOML Extension Changelog

v1.1.0

July 10, 2023

Added

  • Symbolication for tables/keys
  • Code folding on tables and multi-line arrays

Changed

  • Prefixed all highlighting selectors with toml selector to allow themes to make syntax-specific overrides

v1.0.2

October 28, 2022

Fixed

  • Recursively highlight all dotted key segments as identifier.property

v1.0.1

Version bump solely to publish typo fixes in README

v1.0.0

Initial release


License

The MIT License (MIT)

Copyright (c) Ika ikatyang@gmail.com (https://github.com/ikatyang) Copyright (c) 2023 Neel Yadav mail@neelyadav.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.