gleam-lang / gleam

⭐️ A friendly language for building type-safe, scalable systems!
https://gleam.run
Apache License 2.0
16.4k stars 686 forks source link

LSP: Inlay hints for multiline pipelines #3291

Open ascandone opened 1 week ago

ascandone commented 1 week ago

It would be nice to have inlay hints showing the type of each line in a pipeline expression (that span across multiple lines)

This is the way this is shown in Rust: Screenshot 2024-06-18 at 18 25 21

I have a working POC in this PR

Open questions

  1. in a a |> f() |> ... |> g() expression, should we show a's type? (Rust shows it)
    1. should we show it even if the value if a simple literal (e.g. string or int)?
    2. should we show it even if the value is a variable whose type is a type with the same name? (e.g. html: Html)

Previous attempts

https://github.com/gleam-lang/gleam/issues/2319, https://github.com/gleam-lang/gleam/pull/2393, https://github.com/gleam-lang/gleam/pull/2525

lpil commented 1 week ago

Sounds good! One thing I want to make sure is that we don't make it too overwhelming with too much information.

should we show it even if the value if a simple literal (e.g. string or int)?

Let's not show it.

should we show it even if the value is a variable whose type is a type with the same name? (e.g. html: Html)

Yes