{"action":"created","issue":{"url":"https://api.github.com/repos/clojure-emacs/cider-nrepl/issues/335","repository_url":"https://api.github.com/repos/clojure-emacs/cider-nrepl","labels_url":"https://api.github.com/repos/clojure-emacs/cider-nrepl/issues/335/labels{/name}","comments_url":"https://api.github.com/repos/clojure-emacs/cider-nrepl/issues/335/comments","events_url":"https://api.github.com/repos/clojure-emacs/cider-nrepl/issues/335/events","html_url":"https://github.com/clojure-emacs/cider-nrepl/pull/335","id":147289509,"number":335,"title":"Debugger: Step in","user":{"login":"grammati","id":94716,"avatar_url":"https://avatars.githubusercontent.com/u/94716?v=3","gravatar_id":"","url":"https://api.github.com/users/grammati","html_url":"https://github.com/grammati","followers_url":"https://api.github.com/users/grammati/followers","following_url":"https://api.github.com/users/grammati/following{/other_user}","gists_url":"https://api.github.com/users/grammati/gists{/gist_id}","starred_url":"https://api.github.com/users/grammati/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grammati/subscriptions","organizations_url":"https://api.github.com/users/grammati/orgs","repos_url":"https://api.github.com/users/grammati/repos","events_url":"https://api.github.com/users/grammati/events{/privacy}","received_events_url":"https://api.github.com/users/grammati/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2016-04-11T01:29:17Z","updated_at":"2016-04-12T21:16:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/clojure-emacs/cider-nrepl/pulls/335","html_url":"https://github.com/clojure-emacs/cider-nrepl/pull/335","diff_url":"https://github.com/clojure-emacs/cider-nrepl/pull/335.diff","patch_url":"https://github.com/clojure-emacs/cider-nrepl/pull/335.patch"},"body":"This commit implements \"step in\" for the debugger.\r\n\r\nWhen stepping past a form that is a call to a function stored in a var,\r\nprompt the user with the option to step in to the called function.\r\n\r\nThe prompt takes the form \"Step in to foo/bar?\", where \"foo/bar\" is the\r\nfunction as it appears in the source, and the options are \"yes\" and \"no.\r\n\r\nSelecting \"no\" will display the result of the function, just as it\r\nalways has. Note that because the key for \"no\" is the same as the key\r\nfor \"next\", those in the habit of rapidly hitting \"n\" will notice little\r\ndifference to their workflow, although more presses of \"n\" will be\r\nrequired - one extra for each function call.\r\n\r\nSelecting \"yes\" will instrument the called function and then step in to\r\nit. The instrumentation is done in a special way. It is not simply\r\ninstrumented in the normal way, because that would cause all subsequent\r\ncalls to it to trigger the debugger. Instead, an instrumented version of\r\nthe function is compiled and put into the var's metadata, and this\r\ninstrumented version is explicitly called in response to the \"yes\"\r\ncommand.\r\n\r\nMost normal functions can be stepped in to, including both those in\r\nsource files and in jars.\r\n\r\nLimitations:\r\n\r\nThe debugger needs to be able to find on-disk source code for a function\r\nin order to instrument it. Functions that have been eval'ed, but not\r\nsaved, cannot be stepped into.\r\n\r\nInitially, I have disabled the \"step in\" prompt for functions in\r\nclojure.core, and enabled it for everything else. This could be made\r\nmore customizable in the future, perhaps with additional options to the\r\n\"step in?\" prompt, such as \"never\", \"always\", etc.\r\n\r\nOnly functions that can be resolved to a var can be stepped in to.\r\nStepping in to higher-order functions does not work (eg: `((:f m) x)`).\r\n\r\nOpportunities:\r\n\r\nThis implements most of the ability to instrument functions without\r\nhaving to send the source code over from emacs - the var name is enough.\r\nPerhaps we could instrument functions from the namespace browser, or\r\nfrom a stacktrace view (eg: instrument all the functions that are part\r\nof my project and appear in this stacktrace)."},"comment":{"url":"https://api.github.com/repos/clojure-emacs/cider-nrepl/issues/comments/209106002","html_url":"https://github.com/clojure-emacs/cider-nrepl/pull/335#issuecomment-209106002","issue_url":"https://api.github.com/repos/clojure-emacs/cider-nrepl/issues/335","id":209106002,"user":{"login":"grammati","id":94716,"avatar_url":"https://avatars.githubusercontent.com/u/94716?v=3","gravatar_id":"","url":"https://api.github.com/users/grammati","html_url":"https://github.com/grammati","followers_url":"https://api.github.com/users/grammati/followers","following_url":"https://api.github.com/users/grammati/following{/other_user}","gists_url":"https://api.github.com/users/grammati/gists{/gist_id}","starred_url":"https://api.github.com/users/grammati/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grammati/subscriptions","organizations_url":"https://api.github.com/users/grammati/orgs","repos_url":"https://api.github.com/users/grammati/repos","events_url":"https://api.github.com/users/grammati/events{/privacy}","received_events_url":"https://api.github.com/users/grammati/received_events","type":"User","site_admin":false},"created_at":"2016-04-12T21:16:01Z","updated_at":"2016-04-12T21:16:01Z","body":"@Malabarba, I was thinking of changing the :input-type from a vector of keywords (`[:next :in ...]`) to a vector of pairs: `[[:next \"n\"] [:in \"i\"] [:inject \"j\"] [:inspect \"p\"] ...], so we can have keys for everything. Does that sound reasonable to you?"}}