You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Related to #2040. It would also be nice to have a setting to choose one of:
show unqualified imports only
show qualified imports only
show both qualified and unqualified imports (this might be annoying for packages like Data.Vector)
I know that qualified import completions are more difficult since the qualifier name can be subjective, but I'd say a simple first step could be just reusing the module name:
Data.Vector -> import qualified Data.Vector as Vector
I'm a little biased though, since that's the format my work codebase uses 😉
Then future work could easily have some configuration that lets you choose QualifiedImportStyle and maybe provides:
WholeWord
FirstLetter
Where FirstLetter provides the popular variant (though it has more edge cases than WholeWord):
Data.Vector -> import qualified Data.Vector as V
Then other ideas include seeing how other modules in the codebase import that module and importing it the same way. For instance this option would be like:
User types take with QualifiedOnlyImportStyle configured and QualifiedImportStyle of Auto.
One module already imports Data.Vector as import qualified Data.Vector as V
Another module imports Data.Vector as import qualified Data.Vector as Vect
Anyway, I just wanted to get my thoughts out fully but in the short term my only hope is for the initial qualified imports feature to be added with the WholeWord style since that meets my use case. The rest of the thoughts are mainly geared towards solving the problem more generally in hopes of satisfying more users use cases.
Thanks for implementing this feature at all, it really makes everything so much nicer. In my own codebases I don't use qualified imports much and this saves me so much annoyance (and a little bit of time).
The text was updated successfully, but these errors were encountered:
codygman
changed the title
Add support for qualified import Completions from other modules
Add support for qualified import Completions from non-imported modules
Jan 7, 2022
Related to #2040. It would also be nice to have a setting to choose one of:
Data.Vector
)I know that qualified import completions are more difficult since the qualifier name can be subjective, but I'd say a simple first step could be just reusing the module name:
Data.Vector
->import qualified Data.Vector as Vector
I'm a little biased though, since that's the format my work codebase uses 😉
Then future work could easily have some configuration that lets you choose
QualifiedImportStyle
and maybe provides:WholeWord
FirstLetter
Where
FirstLetter
provides the popular variant (though it has more edge cases thanWholeWord
):Data.Vector
->import qualified Data.Vector as V
Then other ideas include seeing how other modules in the codebase import that module and importing it the same way. For instance this option would be like:
take
withQualifiedOnlyImportStyle
configured andQualifiedImportStyle
ofAuto
.Data.Vector
asimport qualified Data.Vector as V
Data.Vector
asimport qualified Data.Vector as Vect
The user sees these completions:
Dreaming further, perhaps those completions are annotated with instances of the imports?
Anyway, I just wanted to get my thoughts out fully but in the short term my only hope is for the initial qualified imports feature to be added with the
WholeWord
style since that meets my use case. The rest of the thoughts are mainly geared towards solving the problem more generally in hopes of satisfying more users use cases.Thanks for implementing this feature at all, it really makes everything so much nicer. In my own codebases I don't use qualified imports much and this saves me so much annoyance (and a little bit of time).
The text was updated successfully, but these errors were encountered: