<commit_before>package com.jetbrains.edu.learning.core;

import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.event.DocumentAdapter;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.impl.event.DocumentEventImpl;
import com.intellij.openapi.util.TextRange;
import com.jetbrains.edu.learning.courseFormat.AnswerPlaceholder;
import com.jetbrains.edu.learning.courseFormat.TaskFile;

import java.util.ArrayList;
import java.util.List;

/**
 * Listens changes in study files and updates
 * coordinates of all the windows in current task file
 */
public class EduDocumentListener extends DocumentAdapter {
  private final TaskFile myTaskFile;
  private final boolean myTrackLength;
  private final List<AnswerPlaceholderWrapper> myAnswerPlaceholders = new ArrayList<>();


  public EduDocumentListener(TaskFile taskFile) {
    myTaskFile = taskFile;
    myTrackLength = true;
  }

  public EduDocumentListener(TaskFile taskFile, boolean trackLength) {
    myTaskFile = taskFile;
    myTrackLength = trackLength;
  }

  @Override
  public void beforeDocumentChange(DocumentEvent e) {
    if (!myTaskFile.isTrackChanges()) {
      return;<commit_msg>deprecate DocumentAdapter<commit_after>package com.jetbrains.edu.learning.core;

import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.event.DocumentListener;
import com.intellij.openapi.editor.impl.event.DocumentEventImpl;
import com.intellij.openapi.util.TextRange;
import com.jetbrains.edu.learning.courseFormat.AnswerPlaceholder;
import com.jetbrains.edu.learning.courseFormat.TaskFile;

import java.util.ArrayList;
import java.util.List;

/**
 * Listens changes in study files and updates
 * coordinates of all the windows in current task file
 */
public class EduDocumentListener implements DocumentListener {
  private final TaskFile myTaskFile;
  private final boolean myTrackLength;
  private final List<AnswerPlaceholderWrapper> myAnswerPlaceholders = new ArrayList<>();


  public EduDocumentListener(TaskFile taskFile) {
    myTaskFile = taskFile;
    myTrackLength = true;
  }

  public EduDocumentListener(TaskFile taskFile, boolean trackLength) {
    myTaskFile = taskFile;
    myTrackLength = trackLength;
  }

  @Override
  public void beforeDocumentChange(DocumentEvent e) {
    if (!myTaskFile.isTrackChanges()) {
      return;
{'fraction_non_alphanumeric': 0.08364083640836409, 'fraction_numerical': 0.0, 'mean_word_length': 5.288659793814433, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4156714', 'n_tokens_mistral': 705, 'n_tokens_neox': 683, 'n_words': 158}