Rome Formatter and Rust Update

Rome Team

With our last update, we announced a complete rewrite in Rust. As many can attest, rewriting can be a rather long, difficult process. Our team has been working extremely hard on this undertaking and has made great progress. We’ll write a more thorough post about our experience with Rust and rewriting in the future, but here’s a short summary of our efforts.

We started our Rust rewrite by forking the excellent RSLint parser. A huge thanks the entire RSLint team for their work, especially to Riccardo D’Ambrosio for helping us with this process. We chose the RSLint parser as we wanted a more modern, editor-focused architecture inspired by projects such as Roslyn, rust-analyzer, and TypeScript. The parser produces a concrete syntax tree (CST) that represents the original code completely, whitespace, comments and all. While a compiler can throw away semantically irrelevant info such as comments, an editor must preserve these bits of trivia.

However, this CST is not the easiest to navigate, which required an abstract syntax tree (AST) facade on top of this CST that allowed for a cleaner interface. This parsing infrastructure will be the foundation for Rome’s focus on first class editor support. By representing the code in full fidelity, we can offer a code manipulation API for features like refactoring, code fixes, and many others.

We’re also very thrilled to announce the first showcase of this parser in our Rome Formatter: A blazing fast JavaScript and TypeScript formatter. Formatters are a perfect showcase of our parsing architecture, as they too need to preserve trivia. But why create a new formatter? When we began our Rust rewrite, we fell in love with rustfmt, Rust’s own formatter. It formatted code instantly, unlike JavaScript formatters which could often take quite a few seconds on larger files. We wanted that same experience in JavaScript. Rome Formatter, like all our tools, will have the editor experience as the core. We plan on shipping a VSCode extension in the next few months that will allow for one-click adoption and usage.

We’ve also expanded our team, hiring four new members this past six months, bringing us to a total of eight team members. We’re really excited to welcome Daniel, Léo-Paul, and Nicholas onto the team.

Lastly, we shipped out swag to everybody who donated to our fundraising campaign. We’ve received an amazing response!

We have a lot more in the pipeline. Stay tuned for future blog posts, other product announcements and some exciting updates.