<commit_before>/*JSHINT info*/
/* globals chrome*/ 

var contexts = ["selection"]; 

function varDumpIt(info, tabs) {
	"use strict";
	var dump = info.selectionText; //cannot use this because chrome strips out the \n's
	chrome.tabs.query({ //get current tab
		"active": true,
        "currentWindow": true
	}, function (tabs) {
		chrome.tabs.sendMessage(tabs[0].id, {
			"fn": "printTree",
			"dump": dump //passing it incase chrome ever does keep the \n's
		});
	});
}

chrome.contextMenus.create({"title": "var_dump here", "contexts": [contexts[0]], "onclick": varDumpIt});<commit_msg>cleaned up addContextMenu<commit_after>function triggerVarDump(info, tabs) {
	/*
	 * Chrome Strips out '\n' from selection text, so although using into.selectionText would be ideal,
	 * it wont currently work. If this chrome bug is fixed we can the following simplified solution:
	 * BUG: https://bugs.chromium.org/p/chromium/issues/detail?id=116429
	 * SIMPLE SOLUTION: const dump = info.selectionText;
	 *
	 * For now, we are using a more complex solution in var_dump.js (getSelectionHtml)
	 */

	chrome.tabs.query({ //get current tab
		"active": true,
        "currentWindow": true
	}, (tabs) => {
		chrome.tabs.sendMessage(tabs[0].id, {"fn": "printTree"});
	});
}

chrome.contextMenus.create({
    "title": "var_dump here",
    "contexts": ["selection"],
    "onclick": triggerVarDump
});
{'fraction_non_alphanumeric': 0.15239477503628446, 'fraction_numerical': 0.006531204644412192, 'mean_word_length': 4.069852941176471, 'pattern_counts': {'":': 13, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 1, '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': '7052344', 'n_tokens_mistral': 482, 'n_tokens_neox': 438, 'n_words': 129}