Skip to content

Latest commit

 

History

History
155 lines (109 loc) · 3.17 KB

CHANGELOG.md

File metadata and controls

155 lines (109 loc) · 3.17 KB

Changelog

Unreleased

Compiler

  • Generated Erlang .app files now include external modules written in Elixir and Erlang. (LostKobrakai)

  • HexDocs documentation of Gleam packages now uses the ExDocs search data model, allowing for global indexing of Gleam packages in HexDocs, and making Gleam packages discoverable through global search of HexDocs. (Diemo Gebhardt)

  • Allow users to set the GLEAM_CACERTS_PATH environment variable to specify a path to a directory containing CA certificates to install Hex packages. (winstxnhdw)

Language server

  • The language server now offers a code action to convert the first step of a pipeline to a regular function call. For example, this code:

    import gleam/list
    
    pub fn main() {
      [1, 2, 3] |> list.map(fn(n) { n * 2 })
    }

    Will be rewritten as:

    import gleam/list
    
    pub fn main() {
      list.map([1, 2, 3], fn(n) { n * 2 })
    }

    (Giacomo Cavalieri)

  • The language server now offers a code action to convert a function call into a pipeline. For example, this code:

    import gleam/list
    
    pub fn main() {
      list.map([1, 2, 3], fn(n) { n * 2 })
    }

    Will be rewritten as:

    import gleam/list
    
    pub fn main() {
      [1, 2, 3] |> list.map(fn(n) { n * 2 })
    }

    You can also pick which argument is going to be piped. In this case:

    import gleam/list
    
    pub fn main() {
      list.map([1, 2, 3], fn(n) { n * 2 })
      //                   ^ If you put your cursor over here
    }

    The code will be rewritten as:

    import gleam/list
    
    pub fn main() {
      fn(n) { n * 2 } |> list.map([1, 2, 3], _)
    }

    (Giacomo Cavalieri)

  • The Language Server now suggests a code action to generate a function to encode a custom type as JSON using the gleam_json package. For example:

    pub type Person {
      Person(name: String, age: Int)
    }

    Will become:

    import gleam/json
    
    pub type Person {
      Person(name: String, age: Int)
    }
    
    fn encode_person(person: Person) -> json.Json {
      json.object([
        #("name", json.string(person.name)),
        #("age", json.int(person.age)),
      ])
    }

    (Surya Rose)

  • The Language Server now suggests a code action to inline a variable which is only used once. For example, this code:

    import gleam/io
    
    pub fn main() {
      let greeting = "Hello!"
      io.println(greeting)
    }

    Will be rewritten as:

    import gleam/io
    
    pub fn main() {
      io.println("Hello!")
    }

    (Surya Rose)

Formatter

Bug fixes

  • Fixed a bug where division and remainder operators would not work correctly in guards on the JavaScript target. (Surya Rose)

v1.8.1 - 2025-02-11

Bug fixes

  • Fixed a metadata caching bug where accessors for opaque types could sometimes be used in other modules. (Louis Pilfold)