-
Notifications
You must be signed in to change notification settings - Fork 97
Do not suggest any hole filling if there are too many suggestions #888
Conversation
Perhaps it would be possible to use the type of the hole to make a better limiter here, but this is better than the current situation I think. Closes haskell/haskell-language-server#532
I wonder if we could detect in some way the type is ambiguous, or if there is a bigger, fixed, threshold in that case. |
The test which tests that The test is: globalConvert :: Int -> String
globalConvert = undefined
globalInt :: Int
globalInt = 3
bar :: Int -> Int -> String
bar n parameterInt = _ (n + n + n) where
localConvert = (flip replicate) 'x'
foo :: () -> Int -> String
foo = undefined And the suggested holes are:
I really like the suggestion of filling a hole with I think that although this is a good example of why this is useful, it might not be good to use until holes are either suggested with a bit more restraint, or could be sorted by likely usefulness (and in that case only the top n holes could be reported) |
Ghc flags allow to set the max number of hole suggestions. The code is in D.I.GHC.Compat |
-- not likely to be specific enought to be useful | ||
-- See https://github.com/haskell/haskell-language-server/issues/532 | ||
-- 5 chosen arbitrarily | ||
numberOfHolesLimit = 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5 seems a bit low. I would go for something like 15. Can we make it user configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it can be configured by ghc flags, then perhaps this is better left to cabal.project.local or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But your limit, the one pepe asked for, is now different from the ghc flag, no?
You can set 100 in the flag but you will not show suggestions if they are greater than 5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh sure, it's slightly different; tbh I'd be happy with either
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I selected 5, because if the selection isn't instant, i.e. at a glance, then I'd be better off just typing what I want (I could certainly be blind to other's preferences or use-cases here!). Tbf I have absolutely no UX research behind this!
This site suggests that the "Total Number of words made out of [a] Glance = 50"!!!
I think the limit (be it 5 or 15) should be moved to the GHC flags that we set in GHC.Compat, and make sure we don't override a user value. |
That's fine, although as mentioned above these do do subtly different
things, and as this is it's more of a filter to overwhelming users with
suggestions.
With the ghc limit is there any rhyme or reason to what holes make the cut
if there's a limit?
…On Fri, Oct 30, 2020, 5:01 PM Pepe Iborra ***@***.***> wrote:
I think the limit (be it 5 or 15) should be moved to the GHC flags that we
set in GHC.Compat, and make sure we don't override a user value.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#888 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGRJXDQ7IDER3YZNCD2XBDSNJ6DJANCNFSM4TBXMUPA>
.
|
GHC flags allow specifying the sorting algorithm too |
The ghcide Github project is becoming archived and merged into https://github.com/haskell/haskell-language-server This PR will need to be reopened in the HLS repo. To do that, create a new branch from HLS HEAD in your HLS repo and do:
Thanks! |
Perhaps it would be possible to use the type of the hole to make a
better limiter here, but this is better than the current situation I
think.
Closes haskell/haskell-language-server#532