[GHC] #5687: Friendly Interface for auto-completion of GHCi

GHC ghc-devs at haskell.org
Sat Jun 1 19:35:02 CEST 2013


#5687: Friendly Interface for auto-completion of GHCi
---------------------------------+------------------------------------------
    Reporter:  linsumang         |       Owner:                  
        Type:  feature request   |      Status:  patch           
    Priority:  normal            |   Milestone:  7.6.2           
   Component:  GHCi              |     Version:  7.2.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by hvr):

 I've attached a patch providing a more refined `:complete` command:

 This one takes an optional range (1-based indexing, syntax `[n-][m]` where
 `n` denotes first index, and `m` the last index shown), allowing to slice
 the result list; moreover the first line emitted now contains:

 {{{
 <completions-printed-count> <total-completions-count> <line-prefix>
 }}}

 And here's an example session again:

 {{{
 Prelude> :complete
 Syntax: :complete repl [<range>] <quoted-string-to-complete>
 Prelude> :complete repl 5 "import For"
 5 21 "import "
 "Foreign"
 "Foreign.C"
 "Foreign.C.Error"
 "Foreign.C.String"
 "Foreign.C.Types"
 Prelude> :complete repl 5-10 "import For"
 6 21 "import "
 "Foreign.C.Types"
 "Foreign.Concurrent"
 "Foreign.ForeignPtr"
 "Foreign.ForeignPtr.Safe"
 "Foreign.ForeignPtr.Unsafe"
 "Foreign.Marshal"
 Prelude> :complete repl 20- "import For"
 2 21 "import "
 "Foreign.StablePtr"
 "Foreign.Storable"
 Prelude> :complete repl "map"
 3 3 ""
 "map"
 "mapM"
 "mapM_"
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5687#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list