<commit_before>'use strict';

var files = {};
var $codeContainer;
var $code;

var $continueBtn;
var $stepBtn;
var $stepOverBtn;
var $stepInBtn;
var $stepOutBtn;
var $stackTrace;

$(function() {
    $('#breakpoints').val("[]");
    $('#eval').val("");

    $('#btn-update-breakpoints').click(updateBreakpoints);
    $('#btn-breakon-next').click(setBreakOnNext);
    $('#btn-eval').click(evalCodeRemotely);
    $('#btn-continue').click(breakpointContinue);
    $('#btn-step').click(breakpointStep);
    $('#btn-step-over').click(breakpointStepOver);
    $('#btn-step-in').click(breakpointStepIn);
    $('#btn-step-out').click(breakpointStepOut);
    $('#file-switcher').change(switcherSwitchFile);

    $continueBtn = $('#btn-continue');
    $stepBtn = $('#btn-step');
    $stepOverBtn = $('#btn-step-over');
    $stepInBtn = $('#btn-step-in');
    $stepOutBtn = $('#btn-step-out');
    $stackTrace = $('#stack');
    $codeContainer = $('#code-container');
    $code = $('#code');

    loadSourceFiles();
    listenToServer();

    showFile({ file: $('#file-switcher').val() });
});

function initDebugger() {
    loadSourceFiles();
    postToServer({ command: 'set-breakpoints', data: JSON.parse($('#breakpoints').val()) });
}

function loadSourceFiles() {
    var fileList = getFromServer('/files/list');
    files = {};<commit_msg>key shortcuts in debugger<commit_after>'use strict';

var files = {};
var $codeContainer;
var $code;

var $continueBtn;
var $stepBtn;
var $stepOverBtn;
var $stepInBtn;
var $stepOutBtn;
var $stackTrace;

$(function() {
    $('#breakpoints').val("[]");
	$('#breakpoints').keydown(function(e) {
		e.stopPropagation();
	});
    $('#eval').val("");

	$('#eval').keydown(function(e) {
		e.stopPropagation();
	});

    $('#btn-update-breakpoints').click(updateBreakpoints);
    $('#btn-breakon-next').click(setBreakOnNext);
    $('#btn-eval').click(evalCodeRemotely);
    $('#btn-continue').click(breakpointContinue);
    $('#btn-step').click(breakpointStep);
    $('#btn-step-over').click(breakpointStepOver);
    $('#btn-step-in').click(breakpointStepIn);
    $('#btn-step-out').click(breakpointStepOut);
    $('#file-switcher').change(switcherSwitchFile);

    $continueBtn = $('#btn-continue');
    $stepBtn = $('#btn-step');
    $stepOverBtn = $('#btn-step-over');
    $stepInBtn = $('#btn-step-in');
    $stepOutBtn = $('#btn-step-out');
    $stackTrace = $('#stack');
    $codeContainer = $('#code-container');
    $code = $('#code');

	$(window).keydown(function(e) {
		console.log(e.which)
		switch(e.which) {
			case 80: // P - Continue
				if ($continueBtn.attr('disabled') == null) {
					breakpointContinue();
				}
				break;
			case 79: // O- Over
				if ($stepOverBtn.attr('disabled') == null) {
					breakpointStepOver();
				}
				break;
			case 78: // I- In
				if ($stepInBtn.attr('disabled') == null) {
					breakpointStepIn();
				}
				break;
			case 77: // U- Out
				if ($stepOutBtn.attr('disabled') == null) {
					breakpointStepOut();
				}
				break;
		}
	});

    loadSourceFiles();
    listenToServer();

    showFile({ file: $('#file-switcher').val() });
});

function initDebugger() {
    loadSourceFiles();
    postToServer({ command: 'set-breakpoints', data: JSON.parse($('#breakpoints').val()) });
}

function loadSourceFiles() {
    var fileList = getFromServer('/files/list');
    files = {};
{'fraction_non_alphanumeric': 0.22659511031604054, 'fraction_numerical': 0.002385211687537269, 'mean_word_length': 3.977744807121662, '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': '1486532', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1120, 'n_words': 180}