<commit_before>require('acorn-jsx');

var tern = require('tern');
var infer = require('tern/lib/infer');
var walk = require('acorn/dist/walk');

tern.registerPlugin("reactjs", function(server) {
	server.on("preParse", function(text, options) {
		var plugins = options.plugins || {};
		plugins.jsx = true;
		options.plugins = plugins;
	});
	walk.base.JSXElement = function(node, state, cb) {
		node.children.forEach(function (n) {
       		cb(n, state);
     	});
	};
	walk.base.JSXExpressionContainer = function(node, state, cb) {
		if (node.expression.type != "JSXEmptyExpression") {
            cb(node.expression, state);
        }
	};
    infer.typeFinder.JSXElement = function(node, scope) {
        return scope.hasProp(node.openingElement.name.name) || infer.ANull;
    };
    infer.scopeGatherer.JSXElement = function() {
    };
    infer.inferWrapper.JSXElement = function() {
    };
    infer.searchVisitor.JSXElement = function() {
    };
});
<commit_msg>search visitor for JSX elements<commit_after>require('acorn-jsx');

var tern = require('tern');
var infer = require('tern/lib/infer');
var walk = require('acorn/dist/walk');

tern.registerPlugin("reactjs", function(server) {
	server.on("preParse", function(text, options) {
		var plugins = options.plugins || {};
		plugins.jsx = true;
		options.plugins = plugins;
	});
	walk.base.JSXElement = function(node, state, cb) {
		node.children.forEach(function (n) {
       		cb(n, state);
     	});
	};
	walk.base.JSXExpressionContainer = function(node, state, cb) {
		if (node.expression.type != "JSXEmptyExpression") {
            cb(node.expression, state);
        }
	};
    infer.typeFinder.JSXElement = function(node, scope) {
        return scope.hasProp(node.openingElement.name.name) || infer.ANull;
    };
    infer.scopeGatherer.JSXElement = function() {
    };
    infer.inferWrapper.JSXElement = function() {
    };
    infer.searchVisitor.JSXElement = function(node, scope, callback) {
        node.children.forEach(function(child) {
            callback(child, scope);
        });
    };
});

{'fraction_non_alphanumeric': 0.15510777881911902, 'fraction_numerical': 0.0, 'mean_word_length': 3.0056285178236397, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '176557', 'n_tokens_mistral': 686, 'n_tokens_neox': 672, 'n_words': 111}