Rux v0.6.1: the first five minutes
Bare `rux` panicked instead of saying anything, a `<style src>` turned off syntax highlighting for the whole file, and the editor over-indented after every image. Four fixes, all of them in the path someone walks before they have written a line of Rux.
Someone tried to build something with Rux and wrote down what happened. Most of what they hit was documentation, and that is a bigger job. Four things were plain bugs, and all four sat in the first five minutes of using Rux, which is the worst place for a bug to sit.
Bare rux crashed
$ rux
thread 'main' panicked at rux-shell-0.6.0/src/lib.rs:4220:10:
watch directory: Error { kind: Generic("Input watch path is neither a
file nor a directory."), paths: [] }
rux with no arguments runs examples/battery.rux. That path exists inside a
checkout of the Rux repository and nowhere else, so for everyone who installed
with cargo install ruxlang, the first command they typed opened a file watcher
on nothing at all.
It now says what it looked for, says why that file is missing, and prints the usage:
$ rux
rux: `examples/battery.rux` does not exist
That is the default, and it only exists inside a checkout of the Rux
repository. Name a file to run:
rux app.rux
A file that is not there and a directory given where a document was expected are messages now too, rather than the same crash one level down. A missing file is an ordinary mistake and should not read like a bug in the language.
A <style src> switched off syntax highlighting
This is the one that had people reporting the editor extension as broken.
External stylesheets arrived in v0.6.0: <style src="theme.css"> pulls a
palette in instead of pasting it into every document. The syntax grammar never
learned about them. Its rule for opening a section demanded a > immediately
after the name, so <style src="…"> matched nothing.
The top level of the grammar is only those three sections, so a section that does not match leaves everything inside it unscoped, and the file renders as plain text. Adding one attribute to a stylesheet turned the colours off for the whole document, including the parts nowhere near it.
All three sections now tolerate attributes, and the attributes are coloured too. The same grammar draws the code on this site and in the playground, so those were wrong in the same way and are fixed by the same change.
use was not a keyword
Rux imports a component with use components::header;. The grammar's keyword
list had rhai's import, a word Rux does not have, and not use. So the import
line sat in plain text directly above a coloured let, which reads like the
highlighter has given up halfway.
Every <image> over-indented what followed it
Tags that never nest must not increase the indent. The editor's list of them was
inherited from HTML, which has img. Rux's element is <image>.
An <image src="logo.png"> written without a self-closing slash therefore
pushed everything after it one level too deep, and kept pushing. The formatter
in the rux binary got this right; the editor's own indentation rules did not,
and the two had disagreed since the grammar was written.
Getting it
cargo install ruxlang
The editor extension is at 0.2.1 in
editors/vscode.
It is still not on the Marketplace, which is the next thing to fix and is why
three of these four bugs survived as long as they did: an extension nobody can
install is an extension nobody reports.
Nothing else changed. No new syntax, no behaviour that was working differently before, nothing to update in an app that already runs.