<commit_before>'use babel';

import ClickableNpmScriptsView from './clickable-npm-scripts-view';
import { CompositeDisposable } from 'atom';

export default {

  clickableNpmScriptsView: null,
  tile: null,
  subscriptions: null,

  activate(state) {
		this.clickableNpmScriptsView = new ClickableNpmScriptsView(state.clickableNpmScriptsViewState);
    console.log(atom);


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

    // Register command that toggles this view
    this.subscriptions.add(atom.commands.add('atom-workspace', {
      'clickable-npm-scripts:toggle': () => this.toggle()
    }));
  },

  consumeStatusBar(statusBar){
		console.log('status bar arrived' , statusBar);
		try{
			this.clickableNpmScriptsView.createElements(this.terminal);
		const button = this.clickableNpmScriptsView.getButton();
		if(button){
			statusBar.addLeftTile({
				item : button
			});
		}

	}catch(err){
		console.log(err);
		atom.notifications.addFatalError('A Fatal error occurred', {
			description : err,
			dismissable : true
		})
	}
  },

	consumeRunInTerminal(terminal){
			console.log('terminal arrived',terminal);<commit_msg>Reload plugin on project path change<commit_after>'use babel';

import ClickableNpmScriptsView from './clickable-npm-scripts-view';
import { CompositeDisposable } from 'atom';

export default {

  clickableNpmScriptsView: null,
  tile: null,
  subscriptions: null,

  activate(state) {
		this.clickableNpmScriptsView = new ClickableNpmScriptsView(state.clickableNpmScriptsViewState);
    console.log(atom);


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

    // Register command that toggles this view
    this.subscriptions.add(atom.commands.add('atom-workspace', {
      'clickable-npm-scripts:toggle': () => this.toggle()
    }));

    if(!atom.project.getDirectories().length){
       atom.project.onDidChangePaths((paths) => this.onPathsChanged(paths));
    }

  },

  consumeStatusBar(statusBar){
		this.statusBar = statusBar;
		try{
  			this.clickableNpmScriptsView.createElements(this.terminal);
    		const button = this.clickableNpmScriptsView.getButton();
    		if(button){
    			statusBar.addLeftTile({
    				item : button
    			});
    		}

  	}catch(err){
    		console.log(err);
    		atom.notifications.addFatalError('A Fatal error occurred', {
    			description : err,
    			dismissable : true
    		});
  	}
  },

  onPathsChanged(){
    this.deactivate();
    this.activate(this.serialize());
    console.log(this);
    if(this.statusBar){
        this.consumeStatusBar(this.statusBar);
    }

  },

	consumeRunInTerminal(terminal){
			console.log('terminal arrived',terminal);
{'fraction_non_alphanumeric': 0.12007042253521127, 'fraction_numerical': 0.0, 'mean_word_length': 3.839863713798978, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '7221035', 'n_tokens_mistral': 964, 'n_tokens_neox': 889, 'n_words': 163}