[Haskell-cafe] Useful IDE features - What abaut
automaticallyadding import statements?
claus.reinke at talk21.com
Sun Jun 17 10:39:25 EDT 2007
>> > Eclipse does have this which saves you a lot of time:
>> > Fix imports.
>> Could you describe the semantics of that more precisely?
> You get the error:
> Not in scope 'c'
> and the IDE should figure out automatically which used packages have
> modules exporting c.
> Then it should ask wether you want import one of those modules and add
> the module to the import list.
in my vim setup, i can hit '_i' (import) or '_im' (import module) on an
identifier to get a menu of modules from which it could be imported;
selecting an entry adds an import to the current module, either for the
identifier only, or for the whole module it comes from (this feature
gets its information from haddock's indices of the standard
hierarchical libs, so it is currently limited to identifiers found there) .
combined with quickfix mode, which will jump to the identifier not
in scope, this seems to be quite close to what you ask for?
[while useful, it doesn't check for existing imports, and it relies on
ghc --make/--interactive to find the packages holding the modules]
there's also '_.' which will use the same data to suggest possible
fully qualified identifiers for the id under cursor.
HaRe also had some transformations for manipulating imports/exports.
More information about the Haskell-Cafe