···11# Changelog
2233-## v1.10.0 - 2025-04-14
44-55-### Bug fixes
66-77-- Fixed a bug where the code action to unqualify types and values would add an
88- unqualified import even if it was already imported.
99- ([Surya Rose](https://github.com/GearsDatapacks))
1010-1111-- Fixed a bug where numbers starting with `0x_`, `0o_` and `0b_` would cause
1212- a syntax error when compiling to JavaScript.
1313- ([Surya Rose](https://github.com/GearsDatapacks))
1414-1515-## v1.10.0-rc1 - 2025-04-05
33+## Unreleased
164175### Compiler
1861919-- On the JavaScript target, bit arrays can now use the `unit` option to control
2020- the units of the `size` option.
2121- ([Surya Rose](https://github.com/GearsDatapacks))
2222-2323-- The compiler can now tell if string branches are unreachable. For example, the
2424- following code:
2525-2626- ```gleam
2727- case a_string {
2828- "Hello, " <> name -> name
2929- "Hello, Jak" -> "Jak"
3030- _ -> "Stranger"
3131- }
3232- ```
3333-3434- Will raise the following warning:
3535-3636- ```
3737- warning: Unreachable case clause
3838- ┌─ /src/greet.gleam:7:5
3939- │
4040- 7 │ "Hello, Jak" -> "Jak"
4141- │ ^^^^^^^^^^^^^^^^^^^^^
4242-4343- This case clause cannot be reached as a previous clause matches the same
4444- values.
4545-4646- Hint: It can be safely removed.
4747- ```
4848-4949- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
5050-5151-- On the JavaScript target, blocks and various other expressions no longer
5252- compile to immediately invoked function expressions.
5353- ([Surya Rose](https://github.com/GearsDatapacks))
5454-5555-- On the JavaScript target, bit arrays can now use 16-bit floats in expressions
5656- and patterns.
5757- ([Richard Viney](https://github.com/richard-viney))
5858-5959-- Improved the error message for unknown and missing target names in the
6060- `@target` attribute.
6161- ([Alexander Keleschovsky](https://github.com/AlecGhost))
6262-6363-- The compiler now uses a call graph for detecting unused types and values.
6464- This means that among other things, it can now detect unused recursive
6565- functions. For example:
6666-6767- ```gleam
6868- // warning: unused
6969- fn some_recursive_function() {
7070- some_recursive_function()
7171- }
7272- ```
7373-7474- ([Surya Rose](https://github.com/GearsDatapacks))
7575-7676-- The compiler now emits a warning when using `let assert` to assert a value
7777- whose variant has already been inferred. For example:
7878-7979- ```gleam
8080- // warning: This will always crash
8181- let assert Ok(_) = Error("Some error")
8282- ```
8383-8484- ([Surya Rose](https://github.com/GearsDatapacks))
8585-8686-- It is now possible to omit the `:float` option for literal floats used in a
8787- `BitArray` segment.
8888-8989- ```gleam
9090- <<1.11>>
9191- ```
9292-9393- Is the same as:
9494-9595- ```gleam
9696- <<1.11:float>>
9797- ```
9898-9999- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
100100-101101-- Compilation of binary operators is now fault tolerant and won't stop at the
102102- first type error.
103103- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
104104-105105-- The compiler now provides a better error message when using the wrong operator
106106- to try and join two strings together. For example:
107107-108108- ```txt
109109- error: Type mismatch
110110- ┌─ /src/wibble.gleam:2:13
111111- │
112112- 2 │ "Hello, " + "Lucy"
113113- │ ^ Use <> instead
114114-115115- The + operator can only be used on Ints.
116116- To join two strings together you can use the <> operator.
117117- ```
118118-119119- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
120120-121121-- The compiler now provides a better error message when using an Int operator on
122122- Float values, suggesting the correct replacement. For example:
123123-124124- ```txt
125125- error: Type mismatch
126126- ┌─ /Users/giacomocavalieri/Desktop/prova/src/prova.gleam:2:7
127127- │
128128- 2 │ 1.0 + 2.0
129129- │ ^ Use +. instead
130130-131131- The + operator can only be used on Ints.
132132- ```
133133-134134- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
135135-136136-- The compiler now provides a better error message when using a Float operator
137137- on Int values, suggesting the correct replacement. For example:
138138-139139- ```txt
140140- error: Type mismatch
141141- ┌─ /Users/giacomocavalieri/Desktop/prova/src/prova.gleam:2:5
142142- │
143143- 2 │ 1 >. 2
144144- │ ^^ Use > instead
145145-146146- The >. operator can only be used on Floats.
147147- ```
148148-149149- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
150150-151151-- The compiler no longer shows errors for a function's labels if the called
152152- function itself doesn't exist.
153153- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
154154-1557### Build tool
1568157157-- Include a type annotation for the `main` function generated by `gleam new`.
158158- ([Drew Olson](https://github.com/drewolson))
159159-160160-- Two entry point scripts are now always generated by `gleam export erlang-shipment`:
161161-162162- - `entrypoint.sh` for POSIX Shell
163163- - `entrypoint.ps1` for PowerShell
164164-165165- ([Greg Burri](https://github.com/ummon))
166166-167167-- The `gleam export` command now takes a `package-information` option to
168168- export the project's `gleam.toml` as a JSON file.
169169- ([Rodrigo Álvarez](https://github.com/Papipo))
170170-171171-- Improved the error message when failing to encrypt or decrypt a local
172172- Hex API key.
173173- ([Samuel Cristobal](https://github.com/scristobal))
174174-175175-- The `HEXPM_USER` and `HEXPM_PASS` environment variables when running
176176- `gleam publish` have been deprecated in favour of `HEXPM_API_KEY`.
177177- ([Samuel Cristobal](https://github.com/scristobal))
178178-179179-- The "functions" and "constants" sections of generated HTML documentation have
180180- been merged into one "values" section.
181181- ([Sam Zanca](https://github.com/metruzanca))
182182-1839### Language server
18410185185-- The language server now allows renaming of functions, constants,
186186- custom type variants and custom types across modules. For example:
187187-188188- ```gleam
189189- // wibble.gleam
190190- pub fn wibble() {
191191- wibble()
192192- //^ Trigger rename
193193- }
194194- // wobble.gleam
195195- import wibble
196196-197197- pub fn main() {
198198- wibble.wibble()
199199- }
200200- ```
201201-202202- Becomes:
203203-204204- ```gleam
205205- // wibble.gleam
206206- pub fn wobble() {
207207- wobble()
208208- }
209209- // wobble.gleam
210210- import wibble
211211-212212- pub fn main() {
213213- wibble.wobble()
214214- }
215215- ```
216216-217217- ([Surya Rose](https://github.com/GearsDatapacks))
218218-219219-- The language server can now offer a code action to replace a `..` in a pattern
220220- with all the fields that are being ignored. For example triggering the code
221221- action on this spread:
222222-223223- ```gleam
224224- pub type Pokemon {
225225- Pokemon(id: Int, name: String, moves: List(String))
226226- }
227227-228228- pub fn main() {
229229- let Pokemon(..) = todo
230230- // ^ If you put your cursor here
231231- }
232232- ```
233233-234234- Would generate the following code:
235235-236236- ```gleam
237237- pub type Pokemon {
238238- Pokemon(id: Int, name: String, moves: List(String))
239239- }
240240-241241- pub fn main() {
242242- let Pokemon(id:, name:, moves:) = todo
243243- }
244244- ```
245245-246246- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
247247-248248-- The function generated by the "Generate JSON encoder" code action has been
249249- slightly modified so that it will now fail to compile if the type has new
250250- fields added, ensuring the programmer remembers to re-run the code action.
251251- For example, for this type:
252252-253253- ```gleam
254254- type Person {
255255- Person(name: String, age: Int)
256256- }
257257- ```
258258-259259- The following code used to be generated:
260260-261261- ```gleam
262262- fn encode_person(person: Person) -> json.Json {
263263- json.object([
264264- #("name", json.string(person.name)),
265265- #("age", json.int(person.age)),
266266- ])
267267- }
268268- ```
269269-270270- But now, this code is generated:
271271-272272- ```gleam
273273- fn encode_person(person: Person) -> json.Json {
274274- let Person(name:, age:) = person
275275- json.object([
276276- #("name", json.string(name)),
277277- #("age", json.int(age)),
278278- ])
279279- }
280280- ```
281281-282282- ([Surya Rose](https://github.com/GearsDatapacks))
283283-284284-- The language server now supports finding references to values and types,
285285- both within a module and across multiple modules.
286286- ([Surya Rose](https://github.com/GearsDatapacks))
287287-288288-- The language server now offers a code action to remove all `echo`s in a
289289- module. For example:
290290-291291- ```gleam
292292- pub fn main() {
293293- [1, 2, 3]
294294- |> echo
295295- // ^^^^ If you put your cursor over here
296296- |> list.filter(int.is_even)
297297- |> echo
298298- }
299299- ```
300300-301301- Triggering the code action would remove all the `echo` pipeline steps:
302302-303303- ```gleam
304304- pub fn main() {
305305- [1, 2, 3]
306306- |> list.filter(int.is_even)
307307- }
308308- ```
309309-310310- This also works with all the `echo`s used before an expression:
311311-312312- ```gleam
313313- pub fn main() {
314314- echo 1 + 2
315315- //^^^^^^^^^^ If hovering anywhere over here
316316- }
317317- ```
318318-319319- Triggering the code action would remove the `echo`:
320320-321321- ```gleam
322322- pub fn main() {
323323- 1 + 2
324324- }
325325- ```
326326-327327- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
328328-329329-- The language server now offers a code action to replace a Float operator used
330330- on Int values with the correct operator. For example:
331331-332332- ```gleam
333333- pub fn main() {
334334- 11 +. 1
335335- //^^^^^^^ When hovering anywhere over here
336336- }
337337- ```
338338-339339- Triggering the code action would fix the compilation error by using the
340340- correct Int operator:
341341-342342- ```gleam
343343- pub fn main() {
344344- 11 + 1
345345- }
346346- ```
347347-348348- This also works the other way around:
349349-350350- ```gleam
351351- pub fn main() {
352352- 1.1 + 10.0
353353- //^^^^^^^^^^ If hovering anywhere over here
354354- }
355355- ```
356356-357357- Triggering the code action would replace the wrong operator with the correct
358358- equivalent Float operator:
359359-360360- ```gleam
361361- pub fn main() {
362362- 1.1 +. 10.0
363363- }
364364- ```
365365-366366- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
367367-368368-- If there's a compilation error because two strings are being joined with the
369369- wrong `+` operator (instead of using `<>`), the language server now offers a
370370- code action to fix the error automatically. For example:
371371-372372- ```gleam
373373- pub fn main() {
374374- "Hello, " + "Jak"
375375- //^^^^^^^^^^^^^^^^^ When hovering anywhere over here
376376- }
377377- ```
378378-379379- Triggering the code action would fix the compilation error by using the
380380- correct `<>` operator instead of `+`:
381381-382382- ```gleam
383383- pub fn main() {
384384- "Hello, " <> "Jak"
385385- }
386386- ```
387387-388388- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
389389-390390-- The language server now offers the option to lift expressions into consts.
391391- For example, in two uses of the code action:
392392-393393- ```gleam
394394- pub fn main() {
395395- [#("a", 0), #("b", 1), #("a", 2)]
396396- |> key_filter("a")
397397- }
398398- ```
399399-400400- Becomes:
401401-402402- ```gleam
403403- const values = [#("a", 0), #("b", 1), #("a", 2)]
404404-405405- const string = "a"
406406-407407- pub fn main() {
408408- values
409409- |> key_filter(string)
410410- }
411411- ```
412412-413413- ([Matias Carlander](https://github.com/matiascr))
414414-415415-- The language server will now only offer the code action to generate a JSON
416416- encoder if the `gleam_json` package is installed as a dependency.
417417- ([Surya Rose](https://github.com/GearsDatapacks))
418418-419419-- The language server will offer to wrap assignment or case clause values in
420420- blocks. Useful when adding more expressions to an existing case clause or
421421- variable assignment.
422422-423423- ```gleam
424424- pub fn f(pokemon_type: PokemonType) {
425425- case pokemon_type {
426426- Water -> soak()
427427- // ^^^^^^ selecting the right-hand side of the `->` in a clause
428428- Fire -> burn()
429429- }
430430- }
431431- ```
432432-433433- Becomes
434434-435435- ```gleam
436436- pub fn f(pokemon_type: PokemonType) {
437437- case pokemon_type {
438438- Water -> {
439439- soak()
440440- }
441441- Fire -> burn()
442442- }
443443- }
444444- ```
445445-446446- ([Matias Carlander](https://github.com/matiascr))
447447-448448-- The "Generate function" code action now uses labels or variable names to improve
449449- the names of generated arguments. For example:
450450-451451- ```gleam
452452- pub fn main() {
453453- let language = English
454454- greet(language, name: "Louis")
455455- }
456456- ```
457457-458458- Will generate the following function:
459459-460460- ```gleam
461461- pub fn greet(language: String, name name: String) -> a {
462462- todo
463463- }
464464- ```
465465-466466- ([Surya Rose](https://github.com/GearsDatapacks))
467467-468468-- The "Rewrite from `use`" code action now only triggers if the cursor is on the
469469- first line of the `use` expression to rewrite.
470470- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
471471-47211### Formatter
47312474474-### Container images
475475-476476-- Container images now contain Software Bill of Materials (SBoM) and SLSA
477477- Provenance information.
478478- ([Jonatan Männchen](https://github.com/maennchen))
479479-48013### Bug fixes
481481-482482-- Fixed a bug where tuples with atoms in the first position could be
483483- incorrectly formatted by `echo`.
484484- ([Louis Pilfold](https://github.com/lpil))
485485-486486-- Fixed a bug where unlabelled arguments would be allowed after labelled
487487- arguments in variant constructor definitions.
488488- ([Surya Rose](https://github.com/GearsDatapacks))
489489-490490-- Fixed a bug where using the "Convert to pipe" code action on a function whose
491491- first argument is itself a pipe would result in invalid code.
492492- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
493493-494494-- Fixed a bug where using the "Convert to pipe" code action on a function or
495495- record capture produces invalid code.
496496- ([Matias Carlander](https://github.com/matiascr))
497497-498498-- Fixed a bug where a temporarily moved or removed file does not get recompiled,
499499- even though its dependencies changed in the meanwhile.
500500- ([Sakari Bergen](http://github.com/sbergen))
501501-502502-- Fixed a bug where the "Inline variable" code action would not work properly
503503- if used inside a record update.
504504- ([Surya Rose](https://github.com/GearsDatapacks))
505505-506506-- Fixed a bug where variant inference wouldn't work on `let assert` assignments.
507507- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
508508-509509-- Fixed a bug where the build tool could fail to lock the build directory but
510510- not report an error.
511511- ([Louis Pilfold](https://github.com/lpil))
512512-513513-- Fixed a bug where the language server would be too eager to recompile modules
514514- when it could use the cache from previous compilations.
515515- ([Louis Pilfold](https://github.com/lpil))
516516-517517-- Fixed a bug where `let assert` would not assert that the given value matched
518518- the pattern if it was the only expression inside a block.
519519- ([Surya Rose](https://github.com/GearsDatapacks))
520520-521521-- Fixed a bug where the code generated for `echo` on JavaScript could have name
522522- collisions if there are functions called `console` or `process`, or custom type
523523- variants called `Object` or `Deno` defined in the module.
524524- ([Louis Pilfold](https://github.com/lpil))
525525-526526-- Fixed a bug where the language server would stop working if the build
527527- directory was deleted e.g. as a result of `gleam clean`.
528528- ([Sakari Bergen](https://github.com/sbergen))
529529-530530-- Fixed a bug where the "Rewrite to pipe" code action could generate invalid
531531- code when the piped argument was a binary operation.
532532- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
533533-534534-- Fixed a bug where prelude types and values would be suggested in autocomplete
535535- when part of a module select.
536536- ([Surya Rose](https://github.com/GearsDatapacks))
537537-538538-- Fixed a bug where the check for multiple top-level modules when publishing
539539- would incorrectly print a warning.
540540- ([Surya Rose](https://github.com/GearsDatapacks))
541541-542542-## v1.9.1 - 2025-03-10
543543-544544-### Formatter
545545-546546-- Improved the formatting of pipelines printed with `echo`.
547547- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
548548-549549-### Bug fixes
550550-551551-- Fixed a bug where `echo` used before a pipeline would generate invalid code
552552- for the Erlang target.
553553- ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
···11+# Changelog
22+33+## v1.10.0 - 2025-04-14
44+55+### Bug fixes
66+77+- Fixed a bug where the code action to unqualify types and values would add an
88+ unqualified import even if it was already imported.
99+ ([Surya Rose](https://github.com/GearsDatapacks))
1010+1111+- Fixed a bug where numbers starting with `0x_`, `0o_` and `0b_` would cause
1212+ a syntax error when compiling to JavaScript.
1313+ ([Surya Rose](https://github.com/GearsDatapacks))
1414+1515+## v1.10.0-rc1 - 2025-04-05
1616+1717+### Compiler
1818+1919+- On the JavaScript target, bit arrays can now use the `unit` option to control
2020+ the units of the `size` option.
2121+ ([Surya Rose](https://github.com/GearsDatapacks))
2222+2323+- The compiler can now tell if string branches are unreachable. For example, the
2424+ following code:
2525+2626+ ```gleam
2727+ case a_string {
2828+ "Hello, " <> name -> name
2929+ "Hello, Jak" -> "Jak"
3030+ _ -> "Stranger"
3131+ }
3232+ ```
3333+3434+ Will raise the following warning:
3535+3636+ ```
3737+ warning: Unreachable case clause
3838+ ┌─ /src/greet.gleam:7:5
3939+ │
4040+ 7 │ "Hello, Jak" -> "Jak"
4141+ │ ^^^^^^^^^^^^^^^^^^^^^
4242+4343+ This case clause cannot be reached as a previous clause matches the same
4444+ values.
4545+4646+ Hint: It can be safely removed.
4747+ ```
4848+4949+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
5050+5151+- On the JavaScript target, blocks and various other expressions no longer
5252+ compile to immediately invoked function expressions.
5353+ ([Surya Rose](https://github.com/GearsDatapacks))
5454+5555+- On the JavaScript target, bit arrays can now use 16-bit floats in expressions
5656+ and patterns.
5757+ ([Richard Viney](https://github.com/richard-viney))
5858+5959+- Improved the error message for unknown and missing target names in the
6060+ `@target` attribute.
6161+ ([Alexander Keleschovsky](https://github.com/AlecGhost))
6262+6363+- The compiler now uses a call graph for detecting unused types and values.
6464+ This means that among other things, it can now detect unused recursive
6565+ functions. For example:
6666+6767+ ```gleam
6868+ // warning: unused
6969+ fn some_recursive_function() {
7070+ some_recursive_function()
7171+ }
7272+ ```
7373+7474+ ([Surya Rose](https://github.com/GearsDatapacks))
7575+7676+- The compiler now emits a warning when using `let assert` to assert a value
7777+ whose variant has already been inferred. For example:
7878+7979+ ```gleam
8080+ // warning: This will always crash
8181+ let assert Ok(_) = Error("Some error")
8282+ ```
8383+8484+ ([Surya Rose](https://github.com/GearsDatapacks))
8585+8686+- It is now possible to omit the `:float` option for literal floats used in a
8787+ `BitArray` segment.
8888+8989+ ```gleam
9090+ <<1.11>>
9191+ ```
9292+9393+ Is the same as:
9494+9595+ ```gleam
9696+ <<1.11:float>>
9797+ ```
9898+9999+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
100100+101101+- Compilation of binary operators is now fault tolerant and won't stop at the
102102+ first type error.
103103+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
104104+105105+- The compiler now provides a better error message when using the wrong operator
106106+ to try and join two strings together. For example:
107107+108108+ ```txt
109109+ error: Type mismatch
110110+ ┌─ /src/wibble.gleam:2:13
111111+ │
112112+ 2 │ "Hello, " + "Lucy"
113113+ │ ^ Use <> instead
114114+115115+ The + operator can only be used on Ints.
116116+ To join two strings together you can use the <> operator.
117117+ ```
118118+119119+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
120120+121121+- The compiler now provides a better error message when using an Int operator on
122122+ Float values, suggesting the correct replacement. For example:
123123+124124+ ```txt
125125+ error: Type mismatch
126126+ ┌─ /Users/giacomocavalieri/Desktop/prova/src/prova.gleam:2:7
127127+ │
128128+ 2 │ 1.0 + 2.0
129129+ │ ^ Use +. instead
130130+131131+ The + operator can only be used on Ints.
132132+ ```
133133+134134+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
135135+136136+- The compiler now provides a better error message when using a Float operator
137137+ on Int values, suggesting the correct replacement. For example:
138138+139139+ ```txt
140140+ error: Type mismatch
141141+ ┌─ /Users/giacomocavalieri/Desktop/prova/src/prova.gleam:2:5
142142+ │
143143+ 2 │ 1 >. 2
144144+ │ ^^ Use > instead
145145+146146+ The >. operator can only be used on Floats.
147147+ ```
148148+149149+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
150150+151151+- The compiler no longer shows errors for a function's labels if the called
152152+ function itself doesn't exist.
153153+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
154154+155155+### Build tool
156156+157157+- Include a type annotation for the `main` function generated by `gleam new`.
158158+ ([Drew Olson](https://github.com/drewolson))
159159+160160+- Two entry point scripts are now always generated by `gleam export erlang-shipment`:
161161+162162+ - `entrypoint.sh` for POSIX Shell
163163+ - `entrypoint.ps1` for PowerShell
164164+165165+ ([Greg Burri](https://github.com/ummon))
166166+167167+- The `gleam export` command now takes a `package-information` option to
168168+ export the project's `gleam.toml` as a JSON file.
169169+ ([Rodrigo Álvarez](https://github.com/Papipo))
170170+171171+- Improved the error message when failing to encrypt or decrypt a local
172172+ Hex API key.
173173+ ([Samuel Cristobal](https://github.com/scristobal))
174174+175175+- The `HEXPM_USER` and `HEXPM_PASS` environment variables when running
176176+ `gleam publish` have been deprecated in favour of `HEXPM_API_KEY`.
177177+ ([Samuel Cristobal](https://github.com/scristobal))
178178+179179+- The "functions" and "constants" sections of generated HTML documentation have
180180+ been merged into one "values" section.
181181+ ([Sam Zanca](https://github.com/metruzanca))
182182+183183+### Language server
184184+185185+- The language server now allows renaming of functions, constants,
186186+ custom type variants and custom types across modules. For example:
187187+188188+ ```gleam
189189+ // wibble.gleam
190190+ pub fn wibble() {
191191+ wibble()
192192+ //^ Trigger rename
193193+ }
194194+ // wobble.gleam
195195+ import wibble
196196+197197+ pub fn main() {
198198+ wibble.wibble()
199199+ }
200200+ ```
201201+202202+ Becomes:
203203+204204+ ```gleam
205205+ // wibble.gleam
206206+ pub fn wobble() {
207207+ wobble()
208208+ }
209209+ // wobble.gleam
210210+ import wibble
211211+212212+ pub fn main() {
213213+ wibble.wobble()
214214+ }
215215+ ```
216216+217217+ ([Surya Rose](https://github.com/GearsDatapacks))
218218+219219+- The language server can now offer a code action to replace a `..` in a pattern
220220+ with all the fields that are being ignored. For example triggering the code
221221+ action on this spread:
222222+223223+ ```gleam
224224+ pub type Pokemon {
225225+ Pokemon(id: Int, name: String, moves: List(String))
226226+ }
227227+228228+ pub fn main() {
229229+ let Pokemon(..) = todo
230230+ // ^ If you put your cursor here
231231+ }
232232+ ```
233233+234234+ Would generate the following code:
235235+236236+ ```gleam
237237+ pub type Pokemon {
238238+ Pokemon(id: Int, name: String, moves: List(String))
239239+ }
240240+241241+ pub fn main() {
242242+ let Pokemon(id:, name:, moves:) = todo
243243+ }
244244+ ```
245245+246246+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
247247+248248+- The function generated by the "Generate JSON encoder" code action has been
249249+ slightly modified so that it will now fail to compile if the type has new
250250+ fields added, ensuring the programmer remembers to re-run the code action.
251251+ For example, for this type:
252252+253253+ ```gleam
254254+ type Person {
255255+ Person(name: String, age: Int)
256256+ }
257257+ ```
258258+259259+ The following code used to be generated:
260260+261261+ ```gleam
262262+ fn encode_person(person: Person) -> json.Json {
263263+ json.object([
264264+ #("name", json.string(person.name)),
265265+ #("age", json.int(person.age)),
266266+ ])
267267+ }
268268+ ```
269269+270270+ But now, this code is generated:
271271+272272+ ```gleam
273273+ fn encode_person(person: Person) -> json.Json {
274274+ let Person(name:, age:) = person
275275+ json.object([
276276+ #("name", json.string(name)),
277277+ #("age", json.int(age)),
278278+ ])
279279+ }
280280+ ```
281281+282282+ ([Surya Rose](https://github.com/GearsDatapacks))
283283+284284+- The language server now supports finding references to values and types,
285285+ both within a module and across multiple modules.
286286+ ([Surya Rose](https://github.com/GearsDatapacks))
287287+288288+- The language server now offers a code action to remove all `echo`s in a
289289+ module. For example:
290290+291291+ ```gleam
292292+ pub fn main() {
293293+ [1, 2, 3]
294294+ |> echo
295295+ // ^^^^ If you put your cursor over here
296296+ |> list.filter(int.is_even)
297297+ |> echo
298298+ }
299299+ ```
300300+301301+ Triggering the code action would remove all the `echo` pipeline steps:
302302+303303+ ```gleam
304304+ pub fn main() {
305305+ [1, 2, 3]
306306+ |> list.filter(int.is_even)
307307+ }
308308+ ```
309309+310310+ This also works with all the `echo`s used before an expression:
311311+312312+ ```gleam
313313+ pub fn main() {
314314+ echo 1 + 2
315315+ //^^^^^^^^^^ If hovering anywhere over here
316316+ }
317317+ ```
318318+319319+ Triggering the code action would remove the `echo`:
320320+321321+ ```gleam
322322+ pub fn main() {
323323+ 1 + 2
324324+ }
325325+ ```
326326+327327+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
328328+329329+- The language server now offers a code action to replace a Float operator used
330330+ on Int values with the correct operator. For example:
331331+332332+ ```gleam
333333+ pub fn main() {
334334+ 11 +. 1
335335+ //^^^^^^^ When hovering anywhere over here
336336+ }
337337+ ```
338338+339339+ Triggering the code action would fix the compilation error by using the
340340+ correct Int operator:
341341+342342+ ```gleam
343343+ pub fn main() {
344344+ 11 + 1
345345+ }
346346+ ```
347347+348348+ This also works the other way around:
349349+350350+ ```gleam
351351+ pub fn main() {
352352+ 1.1 + 10.0
353353+ //^^^^^^^^^^ If hovering anywhere over here
354354+ }
355355+ ```
356356+357357+ Triggering the code action would replace the wrong operator with the correct
358358+ equivalent Float operator:
359359+360360+ ```gleam
361361+ pub fn main() {
362362+ 1.1 +. 10.0
363363+ }
364364+ ```
365365+366366+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
367367+368368+- If there's a compilation error because two strings are being joined with the
369369+ wrong `+` operator (instead of using `<>`), the language server now offers a
370370+ code action to fix the error automatically. For example:
371371+372372+ ```gleam
373373+ pub fn main() {
374374+ "Hello, " + "Jak"
375375+ //^^^^^^^^^^^^^^^^^ When hovering anywhere over here
376376+ }
377377+ ```
378378+379379+ Triggering the code action would fix the compilation error by using the
380380+ correct `<>` operator instead of `+`:
381381+382382+ ```gleam
383383+ pub fn main() {
384384+ "Hello, " <> "Jak"
385385+ }
386386+ ```
387387+388388+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
389389+390390+- The language server now offers the option to lift expressions into consts.
391391+ For example, in two uses of the code action:
392392+393393+ ```gleam
394394+ pub fn main() {
395395+ [#("a", 0), #("b", 1), #("a", 2)]
396396+ |> key_filter("a")
397397+ }
398398+ ```
399399+400400+ Becomes:
401401+402402+ ```gleam
403403+ const values = [#("a", 0), #("b", 1), #("a", 2)]
404404+405405+ const string = "a"
406406+407407+ pub fn main() {
408408+ values
409409+ |> key_filter(string)
410410+ }
411411+ ```
412412+413413+ ([Matias Carlander](https://github.com/matiascr))
414414+415415+- The language server will now only offer the code action to generate a JSON
416416+ encoder if the `gleam_json` package is installed as a dependency.
417417+ ([Surya Rose](https://github.com/GearsDatapacks))
418418+419419+- The language server will offer to wrap assignment or case clause values in
420420+ blocks. Useful when adding more expressions to an existing case clause or
421421+ variable assignment.
422422+423423+ ```gleam
424424+ pub fn f(pokemon_type: PokemonType) {
425425+ case pokemon_type {
426426+ Water -> soak()
427427+ // ^^^^^^ selecting the right-hand side of the `->` in a clause
428428+ Fire -> burn()
429429+ }
430430+ }
431431+ ```
432432+433433+ Becomes
434434+435435+ ```gleam
436436+ pub fn f(pokemon_type: PokemonType) {
437437+ case pokemon_type {
438438+ Water -> {
439439+ soak()
440440+ }
441441+ Fire -> burn()
442442+ }
443443+ }
444444+ ```
445445+446446+ ([Matias Carlander](https://github.com/matiascr))
447447+448448+- The "Generate function" code action now uses labels or variable names to improve
449449+ the names of generated arguments. For example:
450450+451451+ ```gleam
452452+ pub fn main() {
453453+ let language = English
454454+ greet(language, name: "Louis")
455455+ }
456456+ ```
457457+458458+ Will generate the following function:
459459+460460+ ```gleam
461461+ pub fn greet(language: String, name name: String) -> a {
462462+ todo
463463+ }
464464+ ```
465465+466466+ ([Surya Rose](https://github.com/GearsDatapacks))
467467+468468+- The "Rewrite from `use`" code action now only triggers if the cursor is on the
469469+ first line of the `use` expression to rewrite.
470470+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
471471+472472+### Formatter
473473+474474+### Container images
475475+476476+- Container images now contain Software Bill of Materials (SBoM) and SLSA
477477+ Provenance information.
478478+ ([Jonatan Männchen](https://github.com/maennchen))
479479+480480+### Bug fixes
481481+482482+- Fixed a bug where tuples with atoms in the first position could be
483483+ incorrectly formatted by `echo`.
484484+ ([Louis Pilfold](https://github.com/lpil))
485485+486486+- Fixed a bug where unlabelled arguments would be allowed after labelled
487487+ arguments in variant constructor definitions.
488488+ ([Surya Rose](https://github.com/GearsDatapacks))
489489+490490+- Fixed a bug where using the "Convert to pipe" code action on a function whose
491491+ first argument is itself a pipe would result in invalid code.
492492+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
493493+494494+- Fixed a bug where using the "Convert to pipe" code action on a function or
495495+ record capture produces invalid code.
496496+ ([Matias Carlander](https://github.com/matiascr))
497497+498498+- Fixed a bug where a temporarily moved or removed file does not get recompiled,
499499+ even though its dependencies changed in the meanwhile.
500500+ ([Sakari Bergen](http://github.com/sbergen))
501501+502502+- Fixed a bug where the "Inline variable" code action would not work properly
503503+ if used inside a record update.
504504+ ([Surya Rose](https://github.com/GearsDatapacks))
505505+506506+- Fixed a bug where variant inference wouldn't work on `let assert` assignments.
507507+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
508508+509509+- Fixed a bug where the build tool could fail to lock the build directory but
510510+ not report an error.
511511+ ([Louis Pilfold](https://github.com/lpil))
512512+513513+- Fixed a bug where the language server would be too eager to recompile modules
514514+ when it could use the cache from previous compilations.
515515+ ([Louis Pilfold](https://github.com/lpil))
516516+517517+- Fixed a bug where `let assert` would not assert that the given value matched
518518+ the pattern if it was the only expression inside a block.
519519+ ([Surya Rose](https://github.com/GearsDatapacks))
520520+521521+- Fixed a bug where the code generated for `echo` on JavaScript could have name
522522+ collisions if there are functions called `console` or `process`, or custom type
523523+ variants called `Object` or `Deno` defined in the module.
524524+ ([Louis Pilfold](https://github.com/lpil))
525525+526526+- Fixed a bug where the language server would stop working if the build
527527+ directory was deleted e.g. as a result of `gleam clean`.
528528+ ([Sakari Bergen](https://github.com/sbergen))
529529+530530+- Fixed a bug where the "Rewrite to pipe" code action could generate invalid
531531+ code when the piped argument was a binary operation.
532532+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
533533+534534+- Fixed a bug where prelude types and values would be suggested in autocomplete
535535+ when part of a module select.
536536+ ([Surya Rose](https://github.com/GearsDatapacks))
537537+538538+- Fixed a bug where the check for multiple top-level modules when publishing
539539+ would incorrectly print a warning.
540540+ ([Surya Rose](https://github.com/GearsDatapacks))
541541+542542+## v1.9.1 - 2025-03-10
543543+544544+### Formatter
545545+546546+- Improved the formatting of pipelines printed with `echo`.
547547+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))
548548+549549+### Bug fixes
550550+551551+- Fixed a bug where `echo` used before a pipeline would generate invalid code
552552+ for the Erlang target.
553553+ ([Giacomo Cavalieri](https://github.com/giacomocavalieri))