X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fghci%2FInteractiveUI.hs;h=d62b3709d96b680b7e0164f55933bae5722e8705;hb=e50364a5a8e5d736445cd8e5b10a813ec0a5a2e0;hp=059d692df697d59c06b8580de739b2429cfe0438;hpb=0b60725b6817a819b0d3c5ad940aef3eda008b88;p=ghc-hetmet.git diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index 059d692..d62b370 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -34,7 +34,8 @@ import PackageConfig import UniqFM #endif -import HscTypes ( implicitTyThings, reflectGhc, reifyGhc ) +import HscTypes ( implicitTyThings, reflectGhc, reifyGhc + , handleFlagWarnings ) import qualified RdrName ( getGRE_NameQualifier_maybes ) -- should this come via GHC? import Outputable hiding (printForUser, printForUserPartWay) import Module -- for ModuleEnv @@ -42,7 +43,6 @@ import Name import SrcLoc -- Other random utilities -import ErrUtils import CmdLineParser import Digraph import BasicTypes hiding (isTopLevel) @@ -143,7 +143,7 @@ builtin_commands = [ ("reload", keepGoing reloadModule, Nothing, completeNone), ("run", keepGoing runRun, Nothing, completeIdentifier), ("set", keepGoing setCmd, Just flagWordBreakChars, completeSetOptions), - ("show", keepGoing showCmd, Nothing, completeNone), + ("show", keepGoing showCmd, Nothing, completeShowOptions), ("sprint", keepGoing sprintCmd, Nothing, completeIdentifier), ("step", keepGoing stepCmd, Nothing, completeIdentifier), ("steplocal", keepGoing stepLocalCmd, Nothing, completeIdentifier), @@ -1210,8 +1210,7 @@ typeOfExpr str ty <- GHC.exprType str dflags <- getDynFlags let pefas = dopt Opt_PrintExplicitForalls dflags - printForUser $ text str <+> dcolon - <+> pprTypeForUser pefas ty + printForUser $ sep [text str, nest 2 (dcolon <+> pprTypeForUser pefas ty)] kindOfType :: String -> GHCi () kindOfType str @@ -1512,7 +1511,7 @@ newDynFlags minus_opts = do dflags <- getDynFlags let pkg_flags = packageFlags dflags (dflags', leftovers, warns) <- io $ GHC.parseDynamicFlags dflags $ map noLoc minus_opts - io $ handleFlagWarnings dflags' warns + handleFlagWarnings dflags' warns if (not (null leftovers)) then ghcError $ errorsToGhcException leftovers @@ -1675,8 +1674,8 @@ completeNone :: String -> IO [String] completeNone _w = return [] completeMacro, completeIdentifier, completeModule, - completeHomeModule, completeSetOptions, completeFilename, - completeHomeModuleOrFile + completeHomeModule, completeSetOptions, completeShowOptions, + completeFilename, completeHomeModuleOrFile :: String -> IO [String] #ifdef USE_EDITLINE @@ -1750,9 +1749,15 @@ completeHomeModule w = do completeSetOptions w = do return (filter (w `isPrefixOf`) options) - where options = "args":"prog":flagList + where options = "args":"prog":"prompt":"editor":"stop":flagList flagList = map head $ group $ sort allFlags +completeShowOptions w = do + return (filter (w `isPrefixOf`) options) + where options = ["args", "prog", "prompt", "editor", "stop", + "modules", "bindings", "linker", "breaks", + "context", "packages", "languages"] + completeFilename w = do ws <- Readline.filenameCompletionFunction w case ws of @@ -1801,12 +1806,13 @@ allExposedModules dflags where pkg_db = pkgIdMap (pkgState dflags) #else -completeMacro = completeNone -completeIdentifier = completeNone -completeModule = completeNone -completeHomeModule = completeNone -completeSetOptions = completeNone -completeFilename = completeNone +completeMacro = completeNone +completeIdentifier = completeNone +completeModule = completeNone +completeHomeModule = completeNone +completeSetOptions = completeNone +completeShowOptions = completeNone +completeFilename = completeNone completeHomeModuleOrFile=completeNone #endif