Reason
  • Docs
  • Try
  • API
  • Community
  • Blog
  • Languages iconEnglish
    • 日本語
    • Deutsch
    • Español
    • Français
    • 한국어
    • Português (Brasil)
    • Русский
    • Українська
    • 中文
    • 繁體中文
    • Help Translate
  • GitHub

›Recent Posts

Recent Posts

  • ReasonConf Videos & Reason 3.3.2!
  • Reason 3.2.0!
  • Try Page Now Has Built-in ReasonReact Support
  • Reason 3.1.0 Released
  • Reason Forum Now Open!

Reason 3.2.0!

May 25, 2018

This release should be used in conjunction with bs-platform 3.1.4.

Rejoice! The release you've all been waiting for. This fixes bring three major quality-of-life improvements when using Reason's formatter, refmt.

Whitespace Tuning

Your empty lines will now be preserved when you format your code! Multiple lines still collapse into one in most cases.

This also mean that those awkward, forced new lines refmt previously inserted between e.g. top-level statements are now gone too (unless you insert them yourself). Here's an example snippet where whitespaces are preserved as-is:

let confName = "Reason Conf";

let month = "May";
let year = "2018";
let location = Some("Vienna");

module Venue = {
  let secretCode = c =>
    switch (c) {
    | 0 => "Turn on the mic"
    | 1 => "Turn off the mic"
    | 3 => "Start the slides"

    | _ => "Talk to organizer"
    };

  /* important, grouped let statements */
  let venuePassword = 123;
  let contact = ["ryyppy", "nikgraf", "okonetchnikov"];
};

This change was very complex to implement; please thank Iwan, our refmt expert.

Semicolon Relaxation

Ever gotten those cryptic syntax errors when you write this?

let a = 1
let b = 2

We now gracefully accept this! No more semicolon syntax errors.

However, for good measure, refmt will still print it into:

let a = 1;
let b = 2;

Because we're hesitant to recommend the former for now. Under the current syntax, some semicolons are still hard to remove completely. We'll keep working on this; in the meantime, do write in the latter style. If you forget a semicolon, refmt will add it back.

This improvement is made by Fred (Merlin, Reason 3, and many others). Another very challenging change.

Unicode String Printing

let message = "Hi! Unicode formats correctly now. Sorry for the wait 😅"

Note that to compile to the correct unicode string to JavaScript, you'd still need to use BuckleScript's {js|foo|js} interpolation feature. We'll try to unify the effort here.

Again, by Fred. Thanks!

As always, full list of changes here. Enjoy!

Recent Posts
  • Whitespace Tuning
  • Semicolon Relaxation
  • Unicode String Printing