|
1 | 1 | # Changelog |
2 | 2 |
|
3 | | -## v1.9.0-rc2 - 2025-03-07 |
| 3 | +## Unreleased |
4 | 4 |
|
5 | 5 | ### Compiler |
6 | 6 |
|
7 | | -- Made runtime warnings regarding the use of deprecated BitArray properties in |
8 | | - JavaScript FFI code more compact. They are now one line instead of three. |
9 | | - ([Richard Viney](https://github.com/richard-viney)) |
10 | | - |
11 | | -### Bug fixes |
12 | | - |
13 | | -- Fixed a bug that would result in displaying the wrong name when running |
14 | | - `gleam --version`. |
15 | | - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
16 | | - |
17 | | -- Fixed a bug in the `generate json encoder` and `generate dynamic decoder` that |
18 | | - would result in generating invalid code for variants with no fields. |
19 | | - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
20 | | - |
21 | | -## v1.9.0-rc1 - 2025-03-04 |
22 | | - |
23 | | -### Compiler |
24 | | - |
25 | | -- You can now use the `echo` keyword to debug print any value: `echo` can be |
26 | | - followed by any expression and it will print it to stderr alongside the module |
27 | | - it comes from and its line number. This: |
28 | | - |
29 | | - ```gleam |
30 | | - pub fn main() { |
31 | | - echo [1, 2, 3] |
32 | | - } |
33 | | - ``` |
34 | | - |
35 | | - Will output to stderr: |
36 | | - |
37 | | - ```txt |
38 | | - /src/module.gleam:2 |
39 | | - [1, 2, 3] |
40 | | - ``` |
41 | | - |
42 | | - `echo` can also be used in the middle of a pipeline. This: |
43 | | - |
44 | | - ```gleam |
45 | | - pub fn main() { |
46 | | - [1, 2, 3] |
47 | | - |> echo |
48 | | - |> list.map(fn(x) { x * 2 }) |
49 | | - |> echo |
50 | | - } |
51 | | - ``` |
52 | | - |
53 | | - Will output to stderr: |
54 | | - |
55 | | - ```txt |
56 | | - /src/module.gleam:3 |
57 | | - [1, 2, 3] |
58 | | - /src/module.gleam:5 |
59 | | - [2, 4, 6] |
60 | | - ``` |
61 | | - |
62 | | - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
63 | | - |
64 | | -- Generated Erlang `.app` files now include external modules written in Elixir |
65 | | - and Erlang. |
66 | | - ([LostKobrakai](https://github.com/lostkobrakai)) |
67 | | - |
68 | | -- HexDocs documentation of Gleam packages now uses the ExDocs search data model, |
69 | | - allowing for global indexing of Gleam packages in HexDocs, and |
70 | | - making Gleam packages discoverable through global search of HexDocs. |
71 | | - ([Diemo Gebhardt](https://github.com/diemogebhardt)) |
72 | | - |
73 | | -- Improved the styling of constructor argument descriptions in the generated |
74 | | - documentation. |
75 | | - ([Mikko Ahlroth](https://git.ahlcode.fi/nicd)) |
76 | | - |
77 | | -- Allow users to set the `GLEAM_CACERTS_PATH` environment variable to specify a |
78 | | - path to a directory containing CA certificates to install Hex packages. |
79 | | - ([winstxnhdw](https://github.com/winstxnhdw)) |
80 | | - |
81 | | -- On the JavaScript target, bit array expressions and patterns no longer need to |
82 | | - be byte aligned, and the `bits` segment type is now supported in patterns. |
83 | | - ([Richard Viney](https://github.com/richard-viney)) |
84 | | - |
85 | | -- The code generated for list pattern matching on the JavaScript target is now |
86 | | - more efficient. Gleam code that relies heavily on list pattern matching can |
87 | | - now be up to twice as fast. |
88 | | - ([yoshi~](https://github.com/yoshi-monster)) |
89 | | - |
90 | | -- On the JavaScript target, bit array patterns can now match segments of dynamic |
91 | | - size. |
92 | | - ([Surya Rose](https://github.com/GearsDatapacks)) |
93 | | - |
94 | 7 | ### Build tool |
95 | 8 |
|
96 | | -- The build tool now supports Git dependencies. For example: |
97 | | - |
98 | | - ``` |
99 | | - [dependencies] |
100 | | - gleam_stdlib = { git = "https://github.com/gleam-lang/stdlib.git", ref = "957b83b" } |
101 | | - ``` |
102 | | - |
103 | | - ([Surya Rose](https://github.com/GearsDatapacks)) |
104 | | - |
105 | | -- The build tool now refuses to publish any incomplete package that has any |
106 | | - `echo` debug printing left. |
107 | | - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
108 | | - |
109 | 9 | ### Language server |
110 | 10 |
|
111 | | -- The language server now has the ability to jump to the type definition of any |
112 | | - hovered value. |
113 | | - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
114 | | - |
115 | | -- The language server now offers a code action to convert the first step of a |
116 | | - pipeline to a regular function call. For example, this code: |
117 | | - |
118 | | - ```gleam |
119 | | - import gleam/list |
120 | | -
|
121 | | - pub fn main() { |
122 | | - [1, 2, 3] |> list.map(fn(n) { n * 2 }) |
123 | | - } |
124 | | - ``` |
125 | | - |
126 | | - Will be rewritten as: |
127 | | - |
128 | | - ```gleam |
129 | | - import gleam/list |
130 | | -
|
131 | | - pub fn main() { |
132 | | - list.map([1, 2, 3], fn(n) { n * 2 }) |
133 | | - } |
134 | | - ``` |
135 | | - |
136 | | - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
137 | | - |
138 | | -- The language server now offers a code action to convert a function call into |
139 | | - a pipeline. For example, this code: |
140 | | - |
141 | | - ```gleam |
142 | | - import gleam/list |
143 | | -
|
144 | | - pub fn main() { |
145 | | - list.map([1, 2, 3], fn(n) { n * 2 }) |
146 | | - } |
147 | | - ``` |
148 | | - |
149 | | - Will be rewritten as: |
150 | | - |
151 | | - ```gleam |
152 | | - import gleam/list |
153 | | -
|
154 | | - pub fn main() { |
155 | | - [1, 2, 3] |> list.map(fn(n) { n * 2 }) |
156 | | - } |
157 | | - ``` |
158 | | - |
159 | | - You can also pick which argument is going to be piped. In this case: |
160 | | - |
161 | | - ```gleam |
162 | | - import gleam/list |
163 | | -
|
164 | | - pub fn main() { |
165 | | - list.map([1, 2, 3], fn(n) { n * 2 }) |
166 | | - // ^ If you put your cursor over here |
167 | | - } |
168 | | - ``` |
169 | | - |
170 | | - The code will be rewritten as: |
171 | | - |
172 | | - ```gleam |
173 | | - import gleam/list |
174 | | -
|
175 | | - pub fn main() { |
176 | | - fn(n) { n * 2 } |> list.map([1, 2, 3], _) |
177 | | - } |
178 | | - ``` |
179 | | - |
180 | | - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
181 | | - |
182 | | -- The language server now suggests a code action to generate a function to |
183 | | - encode a custom type as JSON using the `gleam_json` package. For example: |
184 | | - |
185 | | - ```gleam |
186 | | - pub type Person { |
187 | | - Person(name: String, age: Int) |
188 | | - } |
189 | | - ``` |
190 | | - |
191 | | - Will become: |
192 | | - |
193 | | - ```gleam |
194 | | - import gleam/json |
195 | | -
|
196 | | - pub type Person { |
197 | | - Person(name: String, age: Int) |
198 | | - } |
199 | | -
|
200 | | - fn encode_person(person: Person) -> json.Json { |
201 | | - json.object([ |
202 | | - #("name", json.string(person.name)), |
203 | | - #("age", json.int(person.age)), |
204 | | - ]) |
205 | | - } |
206 | | - ``` |
207 | | - |
208 | | - ([Surya Rose](https://github.com/GearsDatapacks)) |
209 | | - |
210 | | -- The language server now suggests a code action to inline a variable |
211 | | - which is only used once. For example, this code: |
212 | | - |
213 | | - ```gleam |
214 | | - import gleam/io |
215 | | -
|
216 | | - pub fn main() { |
217 | | - let greeting = "Hello!" |
218 | | - io.println(greeting) |
219 | | - } |
220 | | - ``` |
221 | | - |
222 | | - Will be rewritten as: |
223 | | - |
224 | | - ```gleam |
225 | | - import gleam/io |
226 | | -
|
227 | | - pub fn main() { |
228 | | - io.println("Hello!") |
229 | | - } |
230 | | - ``` |
231 | | - |
232 | | - ([Surya Rose](https://github.com/GearsDatapacks)) |
233 | | - |
234 | | -- The code action to generate a dynamic decoder for a custom type can now |
235 | | - generate decoders for types with multiple variants. For example this code: |
236 | | - |
237 | | - ```gleam |
238 | | - pub type Person { |
239 | | - Adult(age: Int, job: String) |
240 | | - Child(age: Int, height: Float) |
241 | | - } |
242 | | - ``` |
243 | | - |
244 | | - Becomes: |
245 | | - |
246 | | - ```gleam |
247 | | - import gleam/dynamic/decode |
248 | | -
|
249 | | - pub type Person { |
250 | | - Adult(age: Int, job: String) |
251 | | - Child(age: Int, height: Float) |
252 | | - } |
253 | | -
|
254 | | - fn person_decoder() -> decode.Decoder(Person) { |
255 | | - use variant <- decode.field("type", decode.string) |
256 | | - case variant { |
257 | | - "adult" -> { |
258 | | - use age <- decode.field("age", decode.int) |
259 | | - use job <- decode.field("job", decode.string) |
260 | | - decode.success(Adult(age:, job:)) |
261 | | - } |
262 | | - "child" -> { |
263 | | - use age <- decode.field("age", decode.int) |
264 | | - use height <- decode.field("height", decode.float) |
265 | | - decode.success(Child(age:, height:)) |
266 | | - } |
267 | | - _ -> decode.failure(todo as "Zero value for Person", "Person") |
268 | | - } |
269 | | - } |
270 | | - ``` |
271 | | - |
272 | | - ([Surya Rose](https://github.com/GearsDatapacks)) |
273 | | - |
274 | | -- The language server now suggests a code action to easily interpolate a value |
275 | | - into a string. If the cursor is inside a literal string the language server |
276 | | - will offer to split it: |
277 | | - |
278 | | - ```gleam |
279 | | - "wibble | wobble" |
280 | | - // ^ Triggering the action with the cursor |
281 | | - // here will produce this: |
282 | | - "wibble " <> todo <> " wobble" |
283 | | - ``` |
284 | | - |
285 | | - And if the cursor is selecting a valid gleam name, the language server will |
286 | | - offer to interpolate it as a variable: |
287 | | - |
288 | | - ```gleam |
289 | | - "wibble wobble woo" |
290 | | - // ^^^^^^ Triggering the code action if you're |
291 | | - // selecting an entire name, will produce this: |
292 | | - "wibble " <> wobble <> " woo" |
293 | | - ``` |
294 | | - |
295 | | - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
296 | | - |
297 | | -- The language server now shows module documentation when hovering over a module |
298 | | - name. |
299 | | - ([Surya Rose](https://github.com/GearsDatapacks)) |
300 | | - |
301 | 11 | ### Formatter |
302 | 12 |
|
303 | | -- Redundant function captures that take no additional arguments are now |
304 | | - rewritten to not use the function capture syntax. |
305 | | - |
306 | | - ```gleam |
307 | | - some_module.some_function(_) |
308 | | - ``` |
309 | | - |
310 | | - This code is reformatted like so: |
311 | | - |
312 | | - ```gleam |
313 | | - some_module.some_function |
314 | | - ``` |
315 | | - |
316 | | - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
317 | | - |
318 | 13 | ### Bug fixes |
319 | 14 |
|
320 | | -- Fixed a bug where division and remainder operators would not work correctly |
321 | | - in guards on the JavaScript target. |
322 | | - ([Surya Rose](https://github.com/GearsDatapacks)) |
| 15 | +## v1.9.1 - 2025-03-10 |
323 | 16 |
|
324 | | -- Fixed a bug where the "Generate function" code action would ignore the |
325 | | - provided labels. |
326 | | - ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
| 17 | +### Formatter |
327 | 18 |
|
328 | | -- Fixed a bug where the "Pattern match on argument" and |
329 | | - "Pattern match on variable" code actions would not allow to pattern match on a |
330 | | - private type used in the same module it's defined in. |
| 19 | +- Improved the formatting of pipelines printed with `echo`. |
331 | 20 | ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
332 | 21 |
|
333 | | -- Fixed a bug where `gleam export package-interface` would not properly generate |
334 | | - the package interface file if some modules were cached. |
335 | | - ([Pedro Francisco](https://github.com/mine-tech-oficial)) and |
336 | | - ([Surya Rose](https://github.com/GearsDatapacks)) |
337 | | - |
338 | | -- Fixed a bug where pattern matching using a UTF-8 string constant would not |
339 | | - work correctly on the JavaScript target when the string contained escape |
340 | | - characters. |
341 | | - ([Richard Viney](https://github.com/richard-viney)) |
342 | | - |
343 | | -- Fixed a bug where `gleam publish` wouldn't include gitignored or nested native |
344 | | - files. |
345 | | - ([PgBiel](https://github.com/PgBiel)) |
346 | | - |
347 | | -## v1.8.1 - 2025-02-11 |
348 | | - |
349 | 22 | ### Bug fixes |
350 | 23 |
|
351 | | -- Fixed a metadata caching bug where accessors for opaque types could sometimes |
352 | | - be used in other modules. |
353 | | - ([Louis Pilfold](https://github.com/lpil)) |
| 24 | +- Fixed a bug where `echo` used before a pipeline would generate invalid code |
| 25 | + for the Erlang target. |
| 26 | + ([Giacomo Cavalieri](https://github.com/giacomocavalieri)) |
0 commit comments