src/Pure/General/completion.scala
changeset 55914 c5b752d549e3
parent 55813 08a1c860bc12
child 55977 ec4830499634
equal deleted inserted replaced
55913:c1409c103b77 55914:c5b752d549e3
    24     description: String,
    24     description: String,
    25     replacement: String,
    25     replacement: String,
    26     move: Int,
    26     move: Int,
    27     immediate: Boolean)
    27     immediate: Boolean)
    28   { override def toString: String = description }
    28   { override def toString: String = description }
       
    29 
       
    30   object Result
       
    31   {
       
    32     def empty(range: Text.Range): Result = Result(range, "", false, Nil)
       
    33   }
    29 
    34 
    30   sealed case class Result(
    35   sealed case class Result(
    31     range: Text.Range,
    36     range: Text.Range,
    32     original: String,
    37     original: String,
    33     unique: Boolean,
    38     unique: Boolean,
   134                 pair(int, list(pair(string, string)))(body)
   139                 pair(int, list(pair(string, string)))(body)
   135               }
   140               }
   136               Some(Names(info.range, total, names))
   141               Some(Names(info.range, total, names))
   137             }
   142             }
   138             catch { case _: XML.Error => None }
   143             catch { case _: XML.Error => None }
       
   144           case XML.Elem(Markup(Markup.NO_COMPLETION, _), _) =>
       
   145             Some(Names(info.range, 0, Nil))
   139           case _ => None
   146           case _ => None
   140         }
   147         }
   141     }
   148     }
   142   }
   149   }
   143 
   150 
   144   sealed case class Names(range: Text.Range, total: Int, names: List[(String, String)])
   151   sealed case class Names(range: Text.Range, total: Int, names: List[(String, String)])
   145   {
   152   {
       
   153     def no_completion: Boolean = total == 0 && names.isEmpty
       
   154 
   146     def complete(
   155     def complete(
   147       history: Completion.History,
   156       history: Completion.History,
   148       decode: Boolean,
   157       decode: Boolean,
   149       original: String): Option[Completion.Result] =
   158       original: String): Option[Completion.Result] =
   150     {
   159     {