From 2204a484bd6899cf57e3d13c3ee471558ae43b93 Mon Sep 17 00:00:00 2001 From: Ori Avtalion Date: Tue, 9 Dec 2008 19:42:10 +0000 Subject: [PATCH] Add GHCi completions to :set and :show --- compiler/ghci/InteractiveUI.hs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index 54bdebb..c1062e7 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -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), @@ -1749,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 @@ -1800,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 -- 1.7.10.4