Skip to content

Commit 7e9ff7c

Browse files
add 'merge case branches' code action
1 parent 80644ae commit 7e9ff7c

15 files changed

+1617
-1
lines changed

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,31 @@
178178

179179
### Language server
180180

181+
- The language server can now offer a code action to merge consecutive case
182+
branches with the same body. For example:
183+
184+
```gleam
185+
case user {
186+
Admin(name:, ..) -> todo
187+
//^^^^^^^^^^^^^^^^^^^^^^^^
188+
Guest(name:, ..) -> todo
189+
//^^^^^^^^^^^^^^^^ Selecting these two branches you can
190+
// trigger the "Merge case branches" code action
191+
_ -> todo
192+
}
193+
```
194+
195+
Triggering the code action would result in the following code:
196+
197+
```gleam
198+
case user {
199+
Admin(name:, ..) | Guest(name:, ..) -> todo
200+
_ -> todo
201+
}
202+
```
203+
204+
([Giacomo Cavalieri](https://github.com/giacomocavalieri))
205+
181206
- The "inline variable" code action can now trigger when used over the let
182207
keyword of a variable to inline.
183208
([Giacomo Cavalieri](https://github.com/giacomocavalieri))

0 commit comments

Comments
 (0)