<commit_before>package org.jetbrains.plugins.scala.codeInsight.implicits

import com.intellij.openapi.editor.{Inlay, InlayModel}
import com.intellij.openapi.util.Key
import com.intellij.psi.PsiElement

private class Hint(val parts: Seq[Text],
                   val element: PsiElement,
                   val suffix: Boolean,
                   val menu: Option[String]) {

  def addTo(model: InlayModel): Inlay = {
    val inlay = {
      val offset = if (suffix) element.getTextRange.getEndOffset else element.getTextRange.getStartOffset
      val renderer = new TextRenderer(parts, menu)
      if (ImplicitHints.expanded) {
        renderer.expand()
      }
      model.addInlineElement(offset, suffix, renderer)
    }
    inlay.putUserData(Hint.ElementKey, element)
    inlay
  }
}

private object Hint {
  private val ElementKey: Key[PsiElement] = Key.create("SCALA_IMPLICIT_HINT_ELEMENT")

  def apply(parts: Seq[Text],
            element: PsiElement,<commit_msg>Implicit hints: jumps of inlay on enter fixed, see Inlay.isRelatedToPrecedingText #SCL-14036<commit_after>package org.jetbrains.plugins.scala.codeInsight.implicits

import com.intellij.openapi.editor.{Inlay, InlayModel}
import com.intellij.openapi.util.Key
import com.intellij.psi.PsiElement

private class Hint(val parts: Seq[Text],
                   val element: PsiElement,
                   val suffix: Boolean,
                   val menu: Option[String]) {

  def addTo(model: InlayModel): Inlay = {
    val inlay = {
      val offset = if (suffix) element.getTextRange.getEndOffset else element.getTextRange.getStartOffset
      val renderer = new TextRenderer(parts, menu)
      if (ImplicitHints.expanded) {
        renderer.expand()
      }
      //gives more natural behaviour
      val relatesToPrecedingText = false
      model.addInlineElement(offset, relatesToPrecedingText, renderer)
    }
    inlay.putUserData(Hint.ElementKey, element)
    inlay
  }
}

private object Hint {
  private val ElementKey: Key[PsiElement] = Key.create("SCALA_IMPLICIT_HINT_ELEMENT")

  def apply(parts: Seq[Text],
            element: PsiElement,
{'fraction_non_alphanumeric': 0.091725768321513, 'fraction_numerical': 0.002364066193853428, 'mean_word_length': 3.1409001956947162, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4673494', 'n_tokens_mistral': 679, 'n_tokens_neox': 658, 'n_words': 142}