2

Je crée une extension très simple de scala.tools.nsc.interpreter.ILoop dans le but d'ajouter des liaisons supplémentaires, mais même dans le cas d'utilisation le plus basique, la complétion de tabulation ne semble pas fonctionner. Si je tape du code, il interprète et fonctionne comme prévu, mais je n'ai pas de tabulation. Y a-t-il quelque chose de spécifique qui doit être défini pour que l'achèvement de tabulation soit activé dans l'interpréteur interactif (REPL)?Achèvement de l'onglet ILoop

Mon cas d'utilisation est aussi simple que:

val repl = new ILoop 
repl.process(new Settings { 
    usejavacp.value = true 
    deprecation.value = true 
}) 

Y at-il autre chose que ILoop j'utiliser?

+0

Êtes-vous en cours d'exécution sous '' scala' ou sbt' ou d'un autre chemin de classe? –

Répondre

2

Ca fonctionne pour moi, version modulo.

$ scalacm myintp.scala && scalam myintp.Test 
Welcome to Scala 2.12.0-RC2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_101). 
Type in expressions for evaluation. Or try :help. 

scala> 42 
res0: Int = 42 

scala> 42. 
!= < >>>   doubleValue isNaN   isValidShort shortValue  toDouble  toShort  
% << ^   floatValue isNegInfinity isWhole  signum   toFloat   unary_+  
& <= abs   floor   isPosInfinity longValue  to    toHexString  unary_-  
* == byteValue getClass  isValidByte  max   toBinaryString toInt   unary_~  
+ > ceil  intValue  isValidChar  min   toByte   toLong   underlying 
- >= compare  isInfinite isValidInt  round   toChar   toOctalString until   
/ >> compareTo isInfinity isValidLong  self   toDegrees  toRadians  |    

scala> 42.s 
self shortValue signum synchronized 

scala> 42.self 
res1: Int = 42 

scala> :quit 

Source:

$ cat myintp.scala 
package myintp 

import scala.tools.nsc._ 
import scala.tools.nsc.interpreter._ 

/* 2.12 */ 
object Test extends App { 
    val ss = new Settings { 
    usejavacp.value = true 
    deprecation.value = true 
    } 
    def repl = new ILoop { 
    override def createInterpreter(): Unit = { 
     super.createInterpreter() 
    } 
    } 
    repl process ss 
} 

/* 2.11 
object Test extends App { 
    def repl = new ILoop { 
    override def createInterpreter(): Unit = { 
     def binder: Unit = intp beQuietDuring { 
     intp directBind ("foo", "bar") 
     intp bind ("baz", "boo") 
     } 
     super.createInterpreter() 
     intp initialize binder 
    } 
    } 
    repl process new Settings 
} 
*/ 

/* 2.9 
object Test extends App { 
    def repl = new ILoop { 
    def binder: Unit = intp beQuietDuring { 
     intp bind ("baz", "boo") 
    } 
    override def loop(): Unit = { 
     binder 
     super.loop() 
    } 
    } 
    repl process new Settings 
} 
*/ 
+0

va explorer plus dans un peu .. –