<commit_before>'use babel';

/**
* TRIGGER FORMATTING ON ENTER KEY
* On action newline below
 * CHECK LINE CONTEXT TextEditor ::scopeDescriptorForBufferPosition(bufferPosition)
 * FORMAT ON ENTER Mutating Text ::insert new line (TextEditor) // Trigger any shortcuts on
 * ADD EW FILE BUTTON
 *
 *
 * For this 15 mins session, I want to
 * - emit a fake event
 * - check that it launched
 * - check that =y plugin's function was called
 * || check my pugin subscribttions
 */

import { CompositeDisposable } from 'atom'; // Atom event handle
import { Package } from './package'; // Our package class
import debounce from 'lodash.debounce';

const pack = new Package();
let isActive = true;
let saveDelay;

export default {

    config: {
      delay: {
        title: 'Delay',
        description: 'The amount of milliseconds after a change before editor auto saves',
        type: 'integer',
        default: 500,
        minimum: 500
      }
    },

    toggle() {
      let message = null;
      console.log('Toggle!');
      isActive = !isActive;

      if(isActive) {
        atom.notifications.addInfo('Autosave Onchange Enabled!', {
          text: '',
          dismissable: true
        });
      } else {
        atom.notifications.addInfo('Autosave Onchange Disabled!', {
          text: '',
          dismissable: true
        });
      }
    },

    activate(state) {

        // Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
        this.subscriptions = new CompositeDisposable();

        this.subscriptions.add(
          atom.commands.add('atom-workspace', {
            'autosave-onchange:toggle': this.toggle
          })
        );

        atom.config.onDidChange('autosave-onchange.delay', (values) => {
          console.log(`autosave delay changed from ${values.oldValue} to ${values.newValue}`);
          saveDelay = values.newValue;
        });

        saveDelay = atom.config.get('autosave-onchange.delay');

        atom.workspace.observeTextEditors((editor) => {

            let activeWorkspace = atom.views.getView(editor);

            activeWorkspace.addEventListener('autocomplete-plus:cancel', (e) =>
                pack.onAutoCompleteClose(editor, isActive) );

            editor.onDidChangeCursorPosition(
                debounce((ev) =>
                    pack.onDidChangeCursorPosition(editor, activeWorkspace, isActive), saveDelay));
        });
    },

    deactivate() {
        // Remove all package event subscriptions
        this.subscriptions.dispose();
    },

    // Is called every time package executes a command
    serialize() {
        return;
    }
};<commit_msg>Add param to toggle method to change state<commit_after>'use babel';

/**
* TRIGGER FORMATTING ON ENTER KEY
* On action newline below
 * CHECK LINE CONTEXT TextEditor ::scopeDescriptorForBufferPosition(bufferPosition)
 * FORMAT ON ENTER Mutating Text ::insert new line (TextEditor) // Trigger any shortcuts on
 * ADD EW FILE BUTTON
 *
 *
 * For this 15 mins session, I want to
 * - emit a fake event
 * - check that it launched
 * - check that =y plugin's function was called
 * || check my pugin subscribttions
 */

import { CompositeDisposable } from 'atom'; // Atom event handle
import { Package } from './package'; // Our package class
import debounce from 'lodash.debounce';

const pack = new Package();
let isActive = true;
let saveDelay;

export default {

    config: {
      delay: {
        title: 'Delay',
        description: 'The amount of milliseconds after a change before editor auto saves',
        type: 'integer',
        default: 500,
        minimum: 500
      }
    },

    toggle() {
      let message = null;
      console.log('Toggle!');
      isActive = !isActive;

      if(isActive) {
        atom.notifications.addInfo('Autosave Onchange Enabled!', {
          text: '',
          dismissable: true
        });
      } else {
        atom.notifications.addInfo('Autosave Onchange Disabled!', {
          text: '',
          dismissable: true
        });
      }
    },

    activate(state) {

        // Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
        this.subscriptions = new CompositeDisposable();

        this.subscriptions.add(
          atom.commands.add('atom-workspace', {
            'autosave-onchange:toggle': this.toggle
          })
        );

        atom.config.onDidChange('autosave-onchange.delay', (values) => {
          console.log(`autosave delay changed from ${values.oldValue} to ${values.newValue}`);
          saveDelay = values.newValue;
        });

        saveDelay = atom.config.get('autosave-onchange.delay');

        atom.workspace.observeTextEditors((editor) => {


            let activeWorkspace = atom.views.getView(editor);

            activeWorkspace.addEventListener('git-plus:commit', (e) => {
              console.log('Test command hook');
            });

            activeWorkspace.addEventListener('autocomplete-plus:cancel', (e) =>
                pack.onAutoCompleteClose(editor, isActive) );

            editor.onDidChangeCursorPosition(
                debounce((ev) =>
                    pack.onDidChangeCursorPosition(editor, activeWorkspace, isActive), saveDelay));
        });
    },

    deactivate() {
        // Remove all package event subscriptions
        this.subscriptions.dispose();
    },

    // Is called every time package executes a command
    serialize() {
        return;
    }
};
{'fraction_non_alphanumeric': 0.11068702290076336, 'fraction_numerical': 0.0029080334423845873, 'mean_word_length': 2.3412264723740135, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '628392', 'n_tokens_mistral': 1547, 'n_tokens_neox': 1471, 'n_words': 408}