gleam-lang/gleam

Formatter: Replace = symbols by : symbols where syntactically correct

Open

#2,979 opened on Apr 12, 2024

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Rust (960 forks)batch import
help wanted

Repository metrics

Stars
 (21,417 stars)
PR merge metrics
 (Avg merge 10d 19h) (69 merged PRs in 30d)

Description

I'm learning Gleam, and sometimes it's hard to remember to use = or : in some cases, especially for record expressions.

pub fn new(name: String) {
  Thing(
    name = name, // should have `:`
  )
}

A nice thing that elm-format does for Elm files, is to transform = to : (and the reverse) where appropriate. This is a time-saver and very nice for beginners. For instance, I have several times taught Elm to beginners, and when they would use the incorrect symbol, then save, the symbol would be fixed without them even noticing (or seeing an error message).

I don't know in how many places this kind of change could be applied, I think it could at least be done reliably in record expressions, maybe as well in type annotations.

Contributor guide