<commit_before>'use babel';
/**
  Breakpoint Gutter Component
  @description Creates a breakpoint gutter, allows the breakpoint
    functionality for creating/destroying breakpoints as well as drawing
    them, should have one of these *per* editor instance
**/

import { BreakpointActions } from '../actions';

export default class BreakpointGutter {
  /**
    @constructor
    @desc initializes props, sets breakpoint toggle click listener, renders
      the initial breakpoints & creates breakpoint gutter
    @param {TextEditor} editor to put the breakpoint gutter in
    @param {object[]} editorBreakpoints => bps for a single editor
    @param {HTMLElement} $lineNumGutter
  **/
  constructor(editor, editorBreakpoints, $lineNumGutter) {
    this.editor = editor;
    this.editorBreakpoints = editorBreakpoints;
    this.breakpointDecorations = [];
    this.$lineNumGutter = $lineNumGutter;

    this.element = editor.addGutter({name: 'delve-breakpoint', priority: -100});
    this._registerToggleListener($lineNumGutter);
    this.render();
  }

  _registerToggleListener($targetGutter) {
    const _breakpointToggleListener = evt => {
      let $lineNumber = evt.target;
      let row = $lineNumber.getAttribute('data-buffer-row');
      if (row === null) return;

      evt.preventDefault();
      evt.stopPropagation();
      evt.stopImmediatePropagation();

      let existing = this.editorBreakpoints.find(b => b.location.line == row);

      if (existing)
        BreakpointActions.clearBreakpoint(existing.id);
      else
        BreakpointActions.create(null, this.editor.getPath(), row);
    };

    this._breakpointToggleListener = _breakpointToggleListener;
    $targetGutter.addEventListener('click', _breakpointToggleListener);
  }

  destroy() {
    this.$lineNumGutter
    .removeEventListener('click', this._breakpointToggleListener);

    this.element.destroy();
  }

  render() {
    this.breakpointDecorations.forEach(d => d.destroy());<commit_msg>Conv. DOM ele attr to number, rookie mistake<commit_after>'use babel';
/**
  Breakpoint Gutter Component
  @description Creates a breakpoint gutter, allows the breakpoint
    functionality for creating/destroying breakpoints as well as drawing
    them, should have one of these *per* editor instance
**/

import { BreakpointActions } from '../actions';

export default class BreakpointGutter {
  /**
    @constructor
    @desc initializes props, sets breakpoint toggle click listener, renders
      the initial breakpoints & creates breakpoint gutter
    @param {TextEditor} editor to put the breakpoint gutter in
    @param {object[]} editorBreakpoints => bps for a single editor
    @param {HTMLElement} $lineNumGutter
  **/
  constructor(editor, editorBreakpoints, $lineNumGutter) {
    this.editor = editor;
    this.editorBreakpoints = editorBreakpoints;
    this.breakpointDecorations = [];
    this.$lineNumGutter = $lineNumGutter;

    this.element = editor.addGutter({name: 'delve-breakpoint', priority: -100});
    this._registerToggleListener($lineNumGutter);
    this.render();
  }

  _registerToggleListener($targetGutter) {
    const _breakpointToggleListener = evt => {
      let $lineNumber = evt.target;
      let row = parseInt($lineNumber.getAttribute('data-buffer-row'), 10);
      if (isNaN(row)) return;

      evt.preventDefault();
      evt.stopPropagation();
      evt.stopImmediatePropagation();

      let existing = this.editorBreakpoints.find(b => b.location.line == row);

      if (existing)
        BreakpointActions.clearBreakpoint(existing.id);
      else
        BreakpointActions.create(null, this.editor.getPath(), row);
    };

    this._breakpointToggleListener = _breakpointToggleListener;
    $targetGutter.addEventListener('click', _breakpointToggleListener);
  }

  destroy() {
    this.$lineNumGutter
    .removeEventListener('click', this._breakpointToggleListener);

    this.element.destroy();
  }

  render() {
    this.breakpointDecorations.forEach(d => d.destroy());
{'fraction_non_alphanumeric': 0.10824354798296167, 'fraction_numerical': 0.0020045101478326235, 'mean_word_length': 3.868292682926829, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1537992', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1116, 'n_words': 270}