Open MatthewDaggitt opened 1 year ago
Another sorting criteria for within the import
options: when a qualified variable is not in scope, e.g. Map.member
then the qualified import suggestions which have Map
in their name should be lifted to the top of the suggestions.
For example here Data.Map
, Data.Map.Strict
and Data.Map.Lazy
should all be at the top of the suggestions.
So one issue is that get
is re-exported frequently. I think that would be less bad if we implemented this suggestion.
But yes, I think it would be sensible to put the "Add to import list" code actions before the ones that create new imports.
For your second suggestion there is an importance score calculation which can be tweaked: https://github.com/haskell/haskell-language-server/blob/master/plugins/hls-refactor-plugin/src/Development/IDE/Plugin/CodeAction.hs#L1500
The second suggestion has been implemented in https://github.com/haskell/haskell-language-server/pull/3271
Moving the 'Add to import list' code action to the top is all that remains to do here, I think
Is your enhancement request related to a problem? Please describe.
When giving a list of suggestions for a variable not in scope 98% of the time, the action I want to do is to add it to the imports of an already existing module. The problem is when the list of possible modules is very long the
add
suggestions are right down the bottom.Describe the solution you'd like
Sort the list of suggested actions to put the more likely ones at the top. In particular the
import
options (of which there may be zillions) should be below theadd
options.Describe alternatives you've considered
N/A
Additional context
N/A