2012-06-16 9 views
6

में रिटर्न प्रकारों को दबाएं मुझे याद है कि स्कैला आरईपीएल में रिटर्न प्रकारों के प्रिंटिंग को दबाने के लिए कहीं कहीं स्विच है, लेकिन मुझे यह नहीं मिल रहा है। मैं विशेष रूप से इस स्विच को एक एसबीटी बिल्ड फ़ाइल में जोड़ने में रूचि रखता हूं। कुछ returnTypes in console := false की तरह।एसबीटी कंसोल/स्कैला आरईपीएल

उदा। अब मैं

scala> within(Span(0, 33)) 
res7: scala.collection.immutable.IndexedSeq[(de.sciss.lucre.expr.SpanLike, scala.collection.immutable.IndexedSeq[(de.sciss.lucre.expr.Expr[de.sciss.lucre.stm.InMemory,de.sciss.lucre.expr.SpanLike], de.sciss.lucre.expr.Expr[de.sciss.lucre.stm.InMemory,Long])])] = Vector() 

है और स्पष्ट कारणों के लिए मैं चाहता हूँ

scala> within(Span(0, 33)) 
res7: Vector() 

उत्तर

5

मेरा प्रश्न मूल रूप से this mailing-list question से नजर आता है। रेक्स केर के विचार के आधार पर, निम्नलिखित build.sbt में जा सकते हैं:

initialCommands in console := """// helper method to disable type printing 
def shortresults[T](t: => T) = { 
    val s = t.toString 
    val name = s.takeWhile(_ != ':') 
    val idx = s.indexOf(" = ") 
    val full = if (idx >= 0) name + s.substring(idx) else s 
    val short = if (full.length>799) full.substring(0,796)+"..." else full 
    print(short) 
    t 
} 
""" 

लेकिन दुर्भाग्य से, अभी भी निम्न तीन आरईपीएल बचने के आदेशों मैन्युअल रूप से निष्पादित किया जाने के बाद सांत्वना ऊपर है और चल जरूरत है:

:power 
:wrap shortresults 
:silent 
+0

कि कुछ समय पहले था। https://issues.scala-lang.org/browse/SI-8349 –