X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fghci%2FInteractiveUI.hs;h=c53fcf20793c81c5d45028c449daf2ddc1191832;hb=421819753b3eb4940a26e578ef0e4c5cd31761fa;hp=4bc8c545fda5b9e98f724814eec0bdf146da720e;hpb=3240dc3b54438e55cdbc7d449aeaaad705bbb653;p=ghc-hetmet.git diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index 4bc8c54..c53fcf2 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -6,6 +6,13 @@ -- (c) The GHC Team 2005-2006 -- ----------------------------------------------------------------------------- +{-# OPTIONS -w #-} +-- The above warning supression flag is a temporary kludge. +-- While working on this module you are encouraged to remove it and fix +-- any warnings in the module. See +-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings +-- for details + module InteractiveUI ( interactiveUI, ghciWelcomeMsg ) where #include "HsVersions.h" @@ -601,7 +608,7 @@ afterRunStmt step_here run_result = do where printTypeAndContentOfNames session names = do let namesSorted = sortBy compareNames names tythings <- catMaybes `liftM` - io (mapM (GHC.lookupName session) names) + io (mapM (GHC.lookupName session) namesSorted) docs_ty <- mapM showTyThing tythings terms <- mapM (io . GHC.obtainTermB session 10 False) [ id | (AnId id, Just _) <- zip tythings docs_ty] @@ -1338,10 +1345,11 @@ completeNone w = return [] completeWord :: String -> Int -> Int -> IO (Maybe (String, [String])) completeWord w start end = do line <- Readline.getLineBuffer - case w of + let line_words = words (dropWhile isSpace line) + case w of ':':_ | all isSpace (take (start-1) line) -> wrapCompleter completeCmd w _other - | Just c <- is_cmd line -> do + | ((':':c) : _) <- line_words -> do maybe_cmd <- lookupCommand c let (n,w') = selectWord (words' 0 line) case maybe_cmd of @@ -1350,6 +1358,8 @@ completeWord w start end = do Just (_,_,True,complete) -> let complete' w = do rets <- complete w return (map (drop n) rets) in wrapCompleter complete' w' + | ("import" : _) <- line_words -> + wrapCompleter completeModule w | otherwise -> do --printf "complete %s, start = %d, end = %d\n" w start end wrapCompleter completeIdentifier w @@ -1365,9 +1375,6 @@ completeWord w start end = do | offset+length x >= start = (start-offset,take (end-offset) x) | otherwise = selectWord xs -is_cmd line - | ((':':w) : _) <- words (dropWhile isSpace line) = Just w - | otherwise = Nothing completeCmd w = do cmds <- readIORef commands