Skip to content

Feature request: Fixity information in hover #2019

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
viluon opened this issue Jul 14, 2021 · 10 comments · Fixed by #2941
Closed

Feature request: Fixity information in hover #2019

viluon opened this issue Jul 14, 2021 · 10 comments · Fixed by #2941
Assignees
Labels
type: enhancement New feature or request

Comments

@viluon
Copy link

viluon commented Jul 14, 2021

Pardon me if there's a better place to open this issue, or if it has been discussed already. I tried to look for similar suggestions but could not find any.

When dealing with infix operators -heavy expressions, it is sometimes difficult to tell what precedence various operators have. In some cases, different parenthesising can lead to semantically different but equally type-correct expressions.

It would be helpful if HLS could show the fixity of an operator along with its type in the hover. (Not very relevant screenshot follows)

image

@isovector
Copy link
Collaborator

@ErnestKz and I did some work on this front. He might be in a good position to get it pushed through

ErnestKz@c23b213

@ErnestKz
Copy link

Recently wrapped up some other stuff, I can pick this up now and try get it pushed through. 👍

@ErnestKz
Copy link

ErnestKz commented Sep 24, 2021

Hey, unfortunately did not get around to spending time on it, and I'm not sure I can see myself spending time on it in the near future.

The fork https://github.com/ErnestKz/haskell-language-server/tree/explicit-prescedence is the most up to date I have it, so feel free if anyone would like to pick it up.

Also, here's a pair programming session with Isovector that built up to that point VIDEO

@jneira
Copy link
Member

jneira commented Sep 24, 2021

Many thanks for share your work

@Vlix
Copy link

Vlix commented Oct 7, 2021

I just thought of this feature request too. Maybe this is self-evident, but I hope if this gets implemented, it also works for non-operator functions that have explicit infix notations ❤️

@July541
Copy link
Collaborator

July541 commented Jun 2, 2022

I'll pick this.

I'm thinking of adding an extra inlay hint for the operator, is it reasonable?

/cc @michaelpj

@July541
Copy link
Collaborator

July541 commented Jun 2, 2022

More a little off-topic, how about adding inlay hints to show signature for inner expressions?

f = g
  where
     -- inlay hint here
     g = undefined

@michaelpj
Copy link
Collaborator

The lsp library doesn't support inlay hints yet, I think.

Indeed, I would love to have type signature code lenses for local bindings, I'm not really sure why we don't!

@michaelpj
Copy link
Collaborator

I think just putting the fixity in the hover doc would be good enough for starters.

@July541
Copy link
Collaborator

July541 commented Jun 2, 2022

OK, we can put inlay hints later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants