Show more than one Djinn completion

This commit is contained in:
Alejandro Serrano
2014-08-02 09:52:36 +02:00
parent 31a7ce3d19
commit 3aa83e14dd
5 changed files with 73 additions and 4 deletions

View File

@@ -81,6 +81,11 @@ instance ToString ((Int,Int,Int,Int),String) where
toLisp opt x = ('(' :) . tupToString opt x . (')' :)
toPlain opt x = tupToString opt x
instance ToString ((Int,Int,Int,Int),[String]) where
toLisp opt (x,s) = ('(' :) . fourIntsToString opt x .
(' ' :) . toLisp opt s . (')' :)
toPlain opt (x,s) = fourIntsToString opt x . ('\n' :) . toPlain opt s
instance ToString (String, (Int,Int,Int,Int),[String]) where
toLisp opt (s,x,y) = toSexp2 [toLisp opt s, ('(' :) . fourIntsToString opt x . (')' :), toLisp opt y]
toPlain opt (s,x,y) = inter '\n' [toPlain opt s, fourIntsToString opt x, toPlain opt y]

View File

@@ -8,7 +8,7 @@ module Language.Haskell.GhcMod.FillSig (
import Data.Char (isSymbol)
import Data.Function (on)
import Data.List (find, sortBy)
import Data.List (find, nub, sortBy)
import Data.Maybe (isJust)
import Exception (ghandle, SomeException(..))
import GHC (GhcMonad, Id, ParsedModule(..), TypecheckedModule(..), DynFlags, SrcSpan, Type, GenLocated(L))
@@ -332,7 +332,7 @@ auto file lineNo colNo = ghandle handler body
p <- G.parseModule modSum
tcm@TypecheckedModule{tm_typechecked_source = tcs} <- G.typecheckModule p
whenFound' opt (findVar dflag style tcm tcs lineNo colNo) $ \(loc, _name, rty, paren) -> do
text:_ <- djinn False rty
return (fourInts loc, doParen paren text)
djinns <- djinn True rty
return (fourInts loc, map (doParen paren) (nub djinns))
handler (SomeException _) = emptyResult =<< options