"use babel";

import store from "./../store";
import { grammarToLanguage } from "./../utils";
/**
 * @version 1.0.0
 *
 *
 * The Plugin API allows you to make Hydrogen awesome.
 * You will be able to interact with this class in your Hydrogen Plugin using
 * Atom's [Service API](http://blog.atom.io/2015/03/25/new-services-API.html).
 *
 * Take a look at our [Example Plugin](https://github.com/lgeiger/hydrogen-example-plugin)
 * and the [Atom Flight Manual](http://flight-manual.atom.io/hacking-atom/) for
 * learning how to interact with Hydrogen in your own plugin.
 *
 * @class HydrogenProvider
 */
export default class HydrogenProvider {
  constructor(_hydrogen) {
    this._hydrogen = _hydrogen;
    this._happy = true;
  }

  /*
   * Calls your callback when the kernel has changed.
   * @param {Function} Callback
   */
  onDidChangeKernel(callback) {
    this._hydrogen.emitter.on("did-change-kernel", kernel => {
      if (kernel) {
        return callback(kernel.getPluginWrapper());
      }
      return callback(null);
    });
  }

  /*
   * Get the `HydrogenKernel` of the currently active text editor.
   * @return {Class} `HydrogenKernel`
   */
  getActiveKernel() {
    if (!store.kernel) {
      const grammar = store.editor.getGrammar();
      const language = grammarToLanguage(grammar);
      throw new Error(`No running kernel for language \`${language}\` found`);
    }

    return store.kernel.getPluginWrapper();
  }
}

@@ -43,56 +43,8 @@
 e%22;%0A
-import %7B grammarToLanguage %7D from %22./../utils%22;%0A
 /**%0A
@@ -1213,118 +1213,79 @@
     
-const language = grammarToLanguage(grammar);%0A      throw new Error(%60No running kernel for language %5C%60$%7Blanguag
+throw new Error(%0A        %60No running kernel for grammar %5C%60$%7Bgrammar.nam
 e%7D%5C%60
@@ -1291,16 +1291,23 @@
 %60 found%60
+%0A      
 );%0A    %7D

Remove use of grammarToLanguage