<commit_before>'use strict';

const $ = require('jquery');
const view = require('../libs/view');

var search = (query, callback) => {
  query = query.join("+");
  query += "+!helloworld";
  $.get('https://searchcode.com/api/search_IV/?q='+query+'&p=0')
    .done(function(data) {
      if(data.results.length === 0) {
        view.addNode(null, '404', 'Nothing found... How sad...');
      } else {
        data.results.forEach(function(curRes) {
          view.addNode(curRes.url, curRes.type, curRes.synopsis, curRes.description);
        });
      }
    })
    .fail(function() {
      view.addNode(null, 'Failed', 'Request failed', 'Maybe check your internet connexion or your query');
    })
    .always(function() {
      callback();
    });
};

var cmds =  {
  "php": (query, callback) => {
    query[0] = 'php';
    search(query, callback);
  },
  "js": (query, callback) => {
    query[0] = 'javascript';
    search(query, callback);
  }
};

module.exports = {
  "cmds": cmds
};<commit_msg>More languages in searchcode extension<commit_after>'use strict';

const $ = require('jquery');
const view = require('../libs/view');

var search = (query, callback) => {
  query = query.join("+");
  query += "+!helloworld";
  $.get('https://searchcode.com/api/search_IV/?q='+query+'&p=0')
    .done(function(data) {
      if(data.results.length === 0) {
        view.addNode(null, '404', 'Nothing found... How sad...');
      } else {
        data.results.forEach(function(curRes) {
          view.addNode(curRes.url, curRes.type, curRes.synopsis, curRes.description);
        });
      }
    })
    .fail(function() {
      view.addNode(null, 'Failed', 'Request failed', 'Maybe check your internet connexion or your query');
    })
    .always(function() {
      callback();
    });
};

var cmds =  {
  "php": (query, callback) => {
    query[0] = 'php';
    search(query, callback);
  },
  "js": (query, callback) => {
    query[0] = 'javascript';
    search(query, callback);
  },
  "py": (query, callback) => {
    query[0] = 'python';
    search(query, callback);
  },
  "java": (query, callback) => {
    query[0] = 'java';
    search(query, callback);
  },
  "clojure": (query, callback) => {
    query[0] = 'clojure';
    search(query, callback);
  },
  "perl": (query, callback) => {
    query[0] = 'perl5';
    search(query, callback);
  }
};

module.exports = {
  "cmds": cmds
};
{'fraction_non_alphanumeric': 0.20753138075313807, 'fraction_numerical': 0.007949790794979079, 'mean_word_length': 2.900489396411093, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '7085394', 'n_tokens_mistral': 833, 'n_tokens_neox': 822, 'n_words': 162}