
I wrote fix-imports, which is on hackage. Works for me, but assumes
you use qualified imports.
On Wed, Dec 25, 2013 at 3:45 AM, cdep.illabout@gmail.com
Are there any tools or vim-plugins that will automatically add import statements?
For instance, I have the following code:
... import Data.Maybe (fromJust) import Text.ParserCombinators.Parsec (ParseError) import Text.Printf (printf) ...
parseMyString :: String -> Either ParseError String parseMyString stringToParse = parse myParser "(unknown)" stringToParse
Here's what I want to have happen. I put my cursor over "parse" and press some keystroke. It automatically adds the parse function to the list of import statements from the Text.ParserCombinators.Parsec module (hopefully sorted alphabetically). So the import statements end up looking like this:
... import Data.Maybe (fromJust) import Text.ParserCombinators.Parsec (ParseError, parse) import Text.Printf (printf) ...
The haskellmode vim plugin (https://github.com/lukerandall/haskellmode-vim) has functionality similar to this, but it can only add new import lines. It can't add functions/types to existing import lines.
The best it can do is something like this:
... import Data.Maybe (fromJust) import Text.ParserCombinators.Parsec (ParseError) import Text.Printf (printf) import Text.ParserCombinators.Parsec (parse) ...
This is alright, but I have to go back and edit it by hand to make it look like the above.
Are there any tools or vim-plugins that can do this automatically? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe