Re: [Haskell-cafe] Useful IDE features - What abaut automaticallyadding import statements?

2007-06-17 Thread Claus Reinke

  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?

http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/Vim/

[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.

claus

ps
HaRe also had some transformations for manipulating imports/exports.
http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Useful IDE features - What abaut automaticallyadding import statements?

2007-06-17 Thread Marc Weber
On Sun, Jun 17, 2007 at 03:39:25PM +0100, Claus Reinke wrote:
 in my vim setup, i can hit '_i' (import) or '_im' (import module) on an 
Great. To late ;(
I've now implemented this as well. My setup is getting the information
directly from the installed packages (thus ghc-pkg describe package and
then ghc -show-iface eachmodule.hi) Because I use caching it
should be reasonable fast ? (I hope so, I still have to do some testing)
The used packages are taken from the cabal file (and / or buffer
setting)

 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, 

  import Foo (a)

add identifier b
results in
  import Foo (a,b) 

? 

or for the whole module it comes from (this feature 
 gets its information from haddock's indices 
I'm using tags and the plain source file most of the time.
So I don't have trouble generating haddock documentation.
I think its easy but I haven't spent much time on this.
It contains all, the documentation and the implementation.

 combined with quickfix mode, which will jump to the identifier not
 in scope, this seems to be quite close to what you ask for?
I'll let you know when having finished the quickfix integration.
Perhaps this can be done all automatically?
 http://www.cs.kent.ac.uk/people/staff/cr3/toolbox/haskell/Vim/
 there's also '_.' which will use the same data to suggest possible
 fully qualified identifiers for the id under cursor.
This might be useful, too

 HaRe also had some transformations for manipulating imports/exports.
 http://www.cs.kent.ac.uk/projects/refactor-fp/hare.html
I don't know HaRe at all. Would this even work when working with #ifdef
etc?

I'd like to have some features, such as _T ..
But this only works if the file can be parsed by ghc, right?

Thanks for your suggestion.
Marc Weber
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe