Skip to content

Latest commit

 

History

History
168 lines (125 loc) · 4.56 KB

CHANGELOG.md

File metadata and controls

168 lines (125 loc) · 4.56 KB

Changelog

Unreleased

Compiler

  • Pipelines are now fault tolerant. A type error in the middle of a pipeline won't stop the compiler from figuring out the types of the remaining pieces, enabling the language server to show better suggestions for incomplete pipes. (Giacomo Cavalieri)

  • 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)

  • Parsing of case expressions is now fault tolerant. If a case expressions is missing its body, the compiler can still perform type inference. This also allows the Language Server to provide completion hints for case subjects. (Surya Rose)

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 generate the definition of functions that do not exist in the current file. For example if I write the following piece of code:

    import gleam/io
    
    pub type Pokemon {
      Pokemon(pokedex_number: Int, name: String)
    }
    
    pub fn main() {
      io.println(to_string(pokemon))
      //          ^ If you put your cursor over this function that is
      //            not implemented yet
    }

    Triggering the "generate function" code action, the language server will generate the following function for you:

    fn to_string(pokemon: Pokemon) -> String {
      todo
    }

    (Giacomo Cavalieri)

  • 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)

  • Fixed a typo in the error message when trying to import a test module into an application module. (John Strunk)

  • Fixed a bug where the "Extract variable" code action would erroneously extract a pipeline step as a variable. (Giacomo Cavalieri)