src/Tools/jEdit/src/rendering.scala
changeset 55690 d73949233c2e
parent 55689 13b58baf994b
child 55710 2d623ab55672
     1.1 --- a/src/Tools/jEdit/src/rendering.scala	Sun Feb 23 15:38:21 2014 +0100
     1.2 +++ b/src/Tools/jEdit/src/rendering.scala	Sun Feb 23 16:08:38 2014 +0100
     1.3 @@ -273,41 +273,27 @@
     1.4  
     1.5    /* completion */
     1.6  
     1.7 -  def completion_range(caret: Text.Offset): Option[Text.Range] =
     1.8 -    if (!snapshot.is_outdated) {
     1.9 -      snapshot.select(Text.Range(caret - 1, caret + 1), Rendering.completion_names_elements, _ =>
    1.10 -        {
    1.11 -          case Completion.Names.Info(names) => Some(names.range)
    1.12 -          case _ => None
    1.13 -        }).headOption.map(_.info)
    1.14 -    }
    1.15 -    else None
    1.16 -
    1.17 -  def completion_names(caret: Text.Offset): Option[Completion.Names] =
    1.18 -    if (caret > 0 && !snapshot.is_outdated)
    1.19 -    {
    1.20 -      snapshot.select(Text.Range(caret - 1, caret + 1), Rendering.completion_names_elements, _ =>
    1.21 +  def completion_names(range: Text.Range): Option[Completion.Names] =
    1.22 +    if (snapshot.is_outdated) None
    1.23 +    else {
    1.24 +      snapshot.select(range, Rendering.completion_names_elements, _ =>
    1.25          {
    1.26            case Completion.Names.Info(names) => Some(names)
    1.27            case _ => None
    1.28          }).headOption.map(_.info)
    1.29      }
    1.30 -    else None
    1.31  
    1.32 -  def completion_context(caret: Text.Offset): Option[Completion.Context] =
    1.33 -    if (caret > 0) {
    1.34 -      snapshot.select(Text.Range(caret - 1, caret + 1), Rendering.completion_context_elements, _ =>
    1.35 -        {
    1.36 -          case Text.Info(_, elem)
    1.37 -          if elem.name == Markup.ML_STRING || elem.name == Markup.ML_COMMENT =>
    1.38 -            Some(Completion.Context.ML_inner)
    1.39 -          case Text.Info(_, XML.Elem(Markup.Language(language, symbols, antiquotes), _)) =>
    1.40 -            Some(Completion.Context(language, symbols, antiquotes))
    1.41 -          case Text.Info(_, _) =>
    1.42 -            Some(Completion.Context.inner)
    1.43 -        }).headOption.map(_.info)
    1.44 -    }
    1.45 -    else None
    1.46 +  def completion_context(range: Text.Range): Option[Completion.Context] =
    1.47 +    snapshot.select(range, Rendering.completion_context_elements, _ =>
    1.48 +      {
    1.49 +        case Text.Info(_, elem)
    1.50 +        if elem.name == Markup.ML_STRING || elem.name == Markup.ML_COMMENT =>
    1.51 +          Some(Completion.Context.ML_inner)
    1.52 +        case Text.Info(_, XML.Elem(Markup.Language(language, symbols, antiquotes), _)) =>
    1.53 +          Some(Completion.Context(language, symbols, antiquotes))
    1.54 +        case Text.Info(_, _) =>
    1.55 +          Some(Completion.Context.inner)
    1.56 +      }).headOption.map(_.info)
    1.57  
    1.58  
    1.59    /* command status overview */