Skip to content
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

Show type signature for selected Haskell expression #2702

Closed
Martinsos opened this issue Feb 11, 2022 · 2 comments
Closed

Show type signature for selected Haskell expression #2702

Martinsos opened this issue Feb 11, 2022 · 2 comments
Labels

Comments

@Martinsos
Copy link

Martinsos commented Feb 11, 2022

Is your feature request related to a problem? Please describe.

Often, I might want to learn the type of an expression in Haskell. So far I haven't figure out how to do that with hls and while looking through its features I also haven't found this listed as capability. On the other hand, if I remember correctly, Dante (or was it Intero?) has this functionality.

Describe the solution you'd like

If I select a piece of code in my editor (I am in Spacemacs but it shouldn't matter I assume), I would expect lsp to show information (type signature) for that piece of code, if it is a valid Haskell expression. If it is an invalid Haskell expression, it shouldn't show anything.

So for example, if we have myFunc = Just [3] <> Nothing, then currently we have:

  • cursor on Just -> [Int] -> Maybe [Int]
  • cursor on [ -> [Int]
  • cursor on 3 -> Int

If I select Just [3], I would expect to see Maybe [Int]. However, right now lsp doesn't care about the selection, only about the position of the cursor itself, so if cursor is e.g. at the end of that selection, I will get just Int.

I don't know if cause of this is this feature not being implemented in HLS, or Spacemacs not passing the selection/region information to the HLS.

Describe alternatives you've considered

I remember this working either in Dante or Intero, can't remember exactly.

@kokobd
Copy link
Collaborator

kokobd commented Feb 11, 2022

Is this a duplicate of #709?

@Martinsos
Copy link
Author

Ah yes it is, sorry haven't seen it! I was searching for region but should have searched for portion. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants