<commit_before>'use babel';

import { CompositeDisposable } from 'atom';

export default {

  subscriptions: null,

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

    this.subscriptions.add(atom.commands.onDidDispatch(ev => {
      if ('originalEvent' in ev) {
        if (ev['originalEvent'] instanceof KeyboardEvent) {
          // This is already a keyboard event, never mind
          return;
        }
      }

      const command = ev['type']; // For example: "autoflow:reflow-selection"

      const keybindings = atom.keymaps.findKeyBindings({"command": command});
      if (keybindings.length == 0) {
        // No keybindings available, never mind
        return;
      }

      // FIXME: Bring up a notification box
      console.log("Command: " + command + "  Bindings: " + keybindings);
      console.log(ev);
      console.log(keybindings);
    }));
  },

  deactivate() {
    this.subscriptions.dispose();
  },
};
<commit_msg>Move event handling into its own method<commit_after>'use babel';

import { CompositeDisposable } from 'atom';

export default {

  subscriptions: null,

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

    this.subscriptions.add(atom.commands.onDidDispatch(this.handleCommand));
  },

  deactivate() {
    this.subscriptions.dispose();
  },

  handleCommand(event) {
    if ('originalEvent' in event) {
      if (event['originalEvent'] instanceof KeyboardEvent) {
        // This is already a keyboard event, never mind
        return;
      }
    }

    const command = event['type']; // For example: "autoflow:reflow-selection"

    const keybindings = atom.keymaps.findKeyBindings({"command": command});
    if (keybindings.length == 0) {
      // No keybindings available, never mind
      return;
    }

    // FIXME: Bring up a notification box
    console.log("Command: " + command + "  Bindings: " + keybindings);
    console.log(event);
    console.log(keybindings);
  }
};

{'fraction_non_alphanumeric': 0.12103083294983893, 'fraction_numerical': 0.0009203865623561896, 'mean_word_length': 2.847787610619469, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 4, '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': '97554', 'n_tokens_mistral': 652, 'n_tokens_neox': 627, 'n_words': 165}