src/Tools/jEdit/src/completion_popup.scala
changeset 55748 2e1398b484aa
parent 55747 bef19c929ba5
child 55749 75a48dc4383e
     1.1 --- a/src/Tools/jEdit/src/completion_popup.scala	Tue Feb 25 20:15:47 2014 +0100
     1.2 +++ b/src/Tools/jEdit/src/completion_popup.scala	Tue Feb 25 20:46:09 2014 +0100
     1.3 @@ -137,6 +137,10 @@
     1.4            val start = buffer.getLineStartOffset(line)
     1.5            val text = buffer.getSegment(start, caret - start)
     1.6  
     1.7 +          val word_context =
     1.8 +            Completion.word_context(
     1.9 +              JEdit_Lib.try_get_text(buffer, JEdit_Lib.point_range(buffer, caret)))
    1.10 +
    1.11            val context =
    1.12              (opt_rendering orElse PIDE.document_view(text_area).map(_.get_rendering()) match {
    1.13                case Some(rendering) =>
    1.14 @@ -144,7 +148,7 @@
    1.15                case None => None
    1.16              }) getOrElse syntax.completion_context
    1.17  
    1.18 -          syntax.completion.complete(history, decode, explicit, start, text, context)
    1.19 +          syntax.completion.complete(history, decode, explicit, start, text, word_context, context)
    1.20  
    1.21          case None => None
    1.22        }
    1.23 @@ -384,8 +388,13 @@
    1.24            val caret = text_field.getCaret.getDot
    1.25            val text = text_field.getText.substring(0, caret)
    1.26  
    1.27 -          syntax.completion.complete(
    1.28 -              history, decode = true, explicit = false, 0, text, syntax.completion_context) match {
    1.29 +          val word_context =
    1.30 +            Completion.word_context(JEdit_Lib.try_get_text(text_field.getText,
    1.31 +              Text.Range(caret, caret + 1)))  // FIXME proper point range!?
    1.32 +
    1.33 +          val context = syntax.completion_context
    1.34 +
    1.35 +          syntax.completion.complete(history, true, false, 0, text, word_context, context) match {
    1.36              case Some(result) =>
    1.37                val fm = text_field.getFontMetrics(text_field.getFont)
    1.38                val loc =