<commit_before>'use babel';

import { Point } from 'atom';

export default class MapQueriesView {

  constructor(serializedState) {
    // Create root element
    this.element = document.createElement('div');
    this.element.classList.add('map-queries');

    console.log(this.element.children);

    // Create message element
    const queries = document.createElement('div');
    queries.classList.add('query-list');
    this.element.appendChild(queries);
  }

  // Returns an object that can be retrieved when package is activated
  serialize() {}

  // Tear down any state and detach
  destroy() {
    this.element.remove();
  }

  getElement() {
    return this.element;
  }

  addQueries(queries) {

    var queryList = this.element.children[0];

    for (let i = 0; i < queries.length; i++) {
      var query = document.createElement('div');
      query.innerHTML = queries[i].query + " " + queries[i].line;
      let line = queries[i].line - 1;
      query.onclick = function() {
        var editor = atom.workspace.getActiveTextEditor();
        position = new Point(line, 0);
        editor.setCursorBufferPosition(position);
      };
      queryList.appendChild(query);
    }

  };

}
<commit_msg>Fixed issue where queries get appended everytime you try to map a file, instead of starting fresh.<commit_after>'use babel';

import { Point } from 'atom';

export default class MapQueriesView {

  constructor(serializedState) {
    // Create root element
    this.element = document.createElement('div');
    this.element.classList.add('map-queries');

    console.log(this.element.children);

    // Create message element
    const queries = document.createElement('div');
    queries.classList.add('query-list');
    this.element.appendChild(queries);
  }

  // Returns an object that can be retrieved when package is activated
  serialize() {}

  // Tear down any state and detach
  destroy() {
    this.element.remove();
  }

  getElement() {
    return this.element;
  }

  addQueries(queries) {

    var queryList = this.element.children[0];
    queryList.innerHTML = "";


    for (let i = 0; i < queries.length; i++) {
      var query = document.createElement('div');
      query.innerHTML = queries[i].query + " " + queries[i].line;
      let line = queries[i].line - 1;
      query.onclick = function() {
        var editor = atom.workspace.getActiveTextEditor();
        position = new Point(line, 0);
        editor.setCursorBufferPosition(position);
      };
      queryList.appendChild(query);
    }

  };

}

{'fraction_non_alphanumeric': 0.1298342541436464, 'fraction_numerical': 0.0031570639305445935, 'mean_word_length': 2.979591836734694, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7355736', 'n_tokens_mistral': 753, 'n_tokens_neox': 722, 'n_words': 179}