<commit_before>package org.scalaide.extensions
package autoedits

import org.scalaide.core.text.Add

object CloseStringSetting extends AutoEditSetting(
  id = ExtensionSetting.fullyQualifiedName[CloseString],
  name = "Close strings",
  description =
    "Closes a typed opening string literal if necessary."
)

trait CloseString extends AutoEdit {

  override def setting = CloseStringSetting

  override def perform() = {
    rule(textChange) {
      case Add(start, "\"") =>
        if (autoClosingRequired(start))
          Some(Add(start, "\"\"") withLinkedModel (start+2, singleLinkedPos(start+1)))
        else
          None
    }
  }<commit_msg>Use `CloseString` only for some partitions<commit_after>package org.scalaide.extensions
package autoedits

import org.eclipse.jdt.ui.text.IJavaPartitions
import org.eclipse.jface.text.IDocument
import org.scalaide.core.internal.lexical.ScalaPartitions
import org.scalaide.core.text.Add

object CloseStringSetting extends AutoEditSetting(
  id = ExtensionSetting.fullyQualifiedName[CloseString],
  name = "Close strings",
  description = "Closes a typed opening string literal if necessary.",
  partitions = Set(
    IDocument.DEFAULT_CONTENT_TYPE,
    ScalaPartitions.SCALA_MULTI_LINE_STRING,
    ScalaPartitions.SCALADOC_CODE_BLOCK,
    IJavaPartitions.JAVA_DOC,
    IJavaPartitions.JAVA_MULTI_LINE_COMMENT
  )
)

trait CloseString extends AutoEdit {

  override def setting = CloseStringSetting

  override def perform() = {
    rule(textChange) {
      case Add(start, "\"") =>
        if (autoClosingRequired(start))
          Some(Add(start, "\"\"") withLinkedModel (start+2, singleLinkedPos(start+1)))
        else
          None
    }
  }
{'fraction_non_alphanumeric': 0.09476162448499117, 'fraction_numerical': 0.002354326074161271, 'mean_word_length': 3.9707602339181287, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6963888', 'n_tokens_mistral': 517, 'n_tokens_neox': 504, 'n_words': 110}