Skip to content

Latest commit

 

History

History
123 lines (90 loc) · 2.99 KB

CHANGELOG.md

File metadata and controls

123 lines (90 loc) · 2.99 KB

Changelog

Unreleased

Compiler

  • Improved code generation for blocks in tail position on the Javascript target. (Giacomo Cavalieri)

  • Function documentation comments and module documentation comments are now included in the generated Erlang code and can be browsed from the Erlang shell starting from OTP27. (Giacomo Cavalieri)

Build tool

  • gleam new now has refined project name validation - rather than failing on invalid project names, it suggests a valid alternative and prompts for confirmation to use it. (Diemo Gebhardt)

Language server

  • The language server can now fill in the labels of any function call, even when only some of the arguments are provided. For example:

    import gleam/string
    
    pub fn main() {
      string.replace("wibble")
    }

    Will be completed to:

    import gleam/string
    
    pub fn main() {
      string.replace("wibble", each: todo, with: todo)
    }

    (Giacomo Cavalieri)

  • The language server now suggests a code action to pattern match on a function's argument. For example:

    pub type Pokemon {
      Pokemon(pokedex_number: Int, name: String)
    }
    
    pub fn to_string(pokemon: Pokemon) {
      //             ^ If you put your cursor over the argument
      todo
    }

    Triggering the code action on the pokemon argument will generate the following code for you:

    pub type Pokemon {
      Pokemon(pokedex_number: Int, name: String)
    }
    
    pub fn to_string(pokemon: Pokemon) {
      let Pokemon(pokedex_number:, name:) = pokemon
      todo
    }

    (Giacomo Cavalieri)

  • The language server now suggests a code action to pattern match on a variable. For example:

    pub fn main() {
      let result = list.first(a_list)
      //  ^ If you put your cursor over the variable
      todo
    }

    Triggering the code action on the result variable will generate the following code for you:

    pub fn main() {
      let result = list.first(a_list)
      case result {
        Ok(value) -> todo
        Error(value) -> todo
      }
      todo
    }

    (Giacomo Cavalieri)

Formatter

Bug fixes

  • Fixed a bug where the "convert from use" code action would generate invalid code for use expressions ending with a trailing comma. (Giacomo Cavalieri)

  • Fixed a bug where floats outside of Erlang's floating point range were not causing errors. (shayan)

  • Fixed a bug where build tool could fail to add new dependencies when dependencies with optional dependencies are present in the manifest. (Louis Pilfold)

  • Fixed a bug where a block expression containing a singular record update would produce invalid erlang. (yoshi)