|
236 | 236 | function to prevent accidental publishing of unmodified template code.
|
237 | 237 | ([Joohoon Cha](https://github.com/jcha0713))
|
238 | 238 |
|
| 239 | +- When generating documentation, the build tool will now print the names of |
| 240 | + public type aliases instead of internal type names when annotating functions |
| 241 | + and types. For example, for the following code: |
| 242 | + |
| 243 | + ```gleam |
| 244 | + import my_package/internal |
| 245 | +
|
| 246 | + pub type ExternalAlias = internal.InternalRepresentation |
| 247 | +
|
| 248 | + pub fn do_thing() -> ExternalAlias { ... } |
| 249 | + ``` |
| 250 | + |
| 251 | + This is what the build tool used to generate: |
| 252 | + |
| 253 | + ```gleam |
| 254 | + pub fn do_thing() -> @internal InternalRepresentation |
| 255 | + ``` |
| 256 | + |
| 257 | + Whereas now it will not use the internal name, and instead produce: |
| 258 | + |
| 259 | + ```gleam |
| 260 | + pub fn do_thing() -> ExternalAlias |
| 261 | + ``` |
| 262 | + |
| 263 | + ([Surya Rose](https://github.com/GearsDatapacks)) |
| 264 | + |
239 | 265 | ### Language server
|
240 | 266 |
|
241 | 267 | - The language server now offers a code action to remove all the unreachable
|
|
475 | 501 |
|
476 | 502 | ([fruno](https://github.com/fruno-bulax))
|
477 | 503 |
|
| 504 | +- When showing types of values on hover, or adding type annotations, the language |
| 505 | + server will now prefer public type aliases to internal types. For example, if |
| 506 | + the "Add type annotations" code action was triggered on the following code: |
| 507 | + |
| 508 | + ```gleam |
| 509 | + import lustre/html |
| 510 | + import lustre/element |
| 511 | + import lustre/attribute |
| 512 | +
|
| 513 | + pub fn make_link(attribute, element) { |
| 514 | + html.a([attribute], [elements]) |
| 515 | + } |
| 516 | + ``` |
| 517 | + |
| 518 | + Previously, the following code would have been generated: |
| 519 | + |
| 520 | + ```gleam |
| 521 | + pub fn make_link( |
| 522 | + attribute: vattr.Attribute, |
| 523 | + element: vdom.Element(a) |
| 524 | + ) -> vdom.Element(a) { |
| 525 | + html.a([attribute], [elements]) |
| 526 | + } |
| 527 | + ``` |
| 528 | + |
| 529 | + Which references internal types which should not be imported by the user. |
| 530 | + However, now the language server will produce the following: |
| 531 | + |
| 532 | + ```gleam |
| 533 | + pub fn make_link( |
| 534 | + attribute: attribute.Attribute, |
| 535 | + element: element.Element(a) |
| 536 | + ) -> element.Element(a) { |
| 537 | + html.a([attribute], [elements]) |
| 538 | + } |
| 539 | + ``` |
| 540 | + |
| 541 | + ([Surya Rose](https://github.com/GearsDatapacks)) |
| 542 | + |
478 | 543 | ### Formatter
|
479 | 544 |
|
480 | 545 | - The formatter now removes needless multiple negations that are safe to remove.
|
|
0 commit comments