src/Pure/General/completion.scala
changeset 63869 856d2f74c303
parent 63808 e8462a4349fc
child 63871 f745c6e683b7
equal deleted inserted replaced
63868:22037a819276 63869:856d2f74c303
   327     val remove_abbrevs = (for { (a, b) <- more_abbrevs if b == "" } yield a).toSet
   327     val remove_abbrevs = (for { (a, b) <- more_abbrevs if b == "" } yield a).toSet
   328 
   328 
   329     (symbol_abbrevs ::: more_abbrevs).filterNot({ case (a, _) => remove_abbrevs.contains(a) })
   329     (symbol_abbrevs ::: more_abbrevs).filterNot({ case (a, _) => remove_abbrevs.contains(a) })
   330   }
   330   }
   331 
   331 
   332   private val caret_indicator = '\u0007'
   332   val caret_indicator = '\u0007'
       
   333   def split_template(s: String): (String, String) =
       
   334     space_explode(caret_indicator, s) match {
       
   335       case List(s1, s2) => (s1, s2)
       
   336       case _ => (s, "")
       
   337     }
       
   338 
   333   private val antiquote = "@{"
   339   private val antiquote = "@{"
   334 
   340 
   335   private val default_abbrevs =
   341   private val default_abbrevs =
   336     List("@{" -> "@{\u0007}",
   342     List("@{" -> "@{\u0007}",
   337       "`" -> "\\<close>",
   343       "`" -> "\\<close>",
   503         val items =
   509         val items =
   504           for {
   510           for {
   505             (complete_word, name0) <- completions
   511             (complete_word, name0) <- completions
   506             name1 = decode(name0)
   512             name1 = decode(name0)
   507             if name1 != original
   513             if name1 != original
   508             (s1, s2) =
   514             (s1, s2) = Completion.split_template(name1)
   509               space_explode(Completion.caret_indicator, name1) match {
       
   510                 case List(s1, s2) => (s1, s2)
       
   511                 case _ => (name1, "")
       
   512               }
       
   513             move = - s2.length
   515             move = - s2.length
   514             description =
   516             description =
   515               if (is_symbol(name0)) {
   517               if (is_symbol(name0)) {
   516                 if (name0 == name1) List(name0)
   518                 if (name0 == name1) List(name0)
   517                 else List(name1, "(symbol " + quote(name0) + ")")
   519                 else List(name1, "(symbol " + quote(name0) + ")")