Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[debugger] Add P command to inspect the currently evaluted value #613

Closed
wants to merge 1 commit into from

Conversation

alexander-yakushev
Copy link
Member

I can't possibly count how many times I struggled to inspect the value that is right there in the debugger, right next to my cursor, teasing me with its printed representation, but impossible to inspect because I didn't let it to anything.

These times are no more. This little fix will make it possible to press P while in the debugger to inspect the value of the latest debugging step.

@alexander-yakushev
Copy link
Member Author

There is an alternative approach: p inspect prompts the user for the value to be inspected. We can treat empty input as "inspect current value". One less binding, but have to tell that to user somehow (in the prompt? Inspect value (empty for this value):?)

@@ -305,6 +305,7 @@ this map (identified by a key), and will `dissoc` it afterwards."}
"n" :next
"o" :out
"p" :inspect
"P" :insPect
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't name the keyword differently? This seems pretty confusing to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I followed suit with :continue and :Continue :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:inspect-current-value is wordy and will all indentation in read-debug-command

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I just remembered this. :-) I recall I had the same misgivings about it, but space is truly at a premium.

@alexander-yakushev
Copy link
Member Author

alexander-yakushev commented Jun 1, 2019

Another alternative (slightly breaking): we can switch p to inspect current value, and P to inspect... which will prompt the user for thing to be inspected. Arguably and subjectively, inspecting the current value would be a much more common action than inspecting something else (given that to inspect a local binding you can also press l and navigate to it).

@bbatsov
Copy link
Member

bbatsov commented Jun 2, 2019

I completely agree. Let's swap the two commands.

@Malabarba
Copy link
Member

Agreed as well.

@alexander-yakushev
Copy link
Member Author

Doing this turns out to be more annoying than I thought. Just adding a command with the key P puts it in front of the list because we send it as a hashmap, and somewhere inside bencode I guess it gets sorted by keys... This luckily worked fine for Continue because it just happened to end up near continue, but two inspects being far from each other looks kinda dumb.

image

Ideas?

@Malabarba
Copy link
Member

Maybe it's time we start hiding some of these commands from the prompt. At some point "self-documented" starts to turn-into "confusing".
Ideally, we would have a Help key in there which would bring up a list of commands with description. But that would be beyond the scope of this PR.

Additionally, it sounds odd that the order of the commands is given by the order of keys in a hash-map. This order should probably be decided by the frontend (cider.el, in this case).

@bbatsov
Copy link
Member

bbatsov commented Jun 3, 2019

Additionally, it sounds odd that the order of the commands is given by the order of keys in a hash-map. This order should probably be decided by the frontend (cider.el, in this case).

I completely agree. I think we should tweak the UI code in general to give control to the users over what's shown be default as well.

@alexander-yakushev
Copy link
Member Author

Can we perhaps start with this, and think about improving the presentation side later? I'm afraid I can't properly implement either the help window, and replacing the input-type map with a vector requires plenty of ceremonial dancing to avoid breaking changes.

@Malabarba
Copy link
Member

Malabarba commented Jun 3, 2019

Although I think such improvements are beyond the scope of this PR, I don't like that we'll have insPect at the very start of the list for an indeterminate amount of time.

Can we withhold this while someone implements at least some small fix on the Emacs side? Simply hiding Continue and insPect would already be enough for a start

@bbatsov
Copy link
Member

bbatsov commented Jun 3, 2019

Let's post some ticket on CIDER's tracker so we won't forget about it. I'm juggling a million things these days, but if there are no volunteers I can rework myself the CIDER side next week.

@bbatsov
Copy link
Member

bbatsov commented Jun 3, 2019

and replacing the input-type map with a vector requires plenty of ceremonial dancing to avoid breaking changes.

One note on this point - as CIDER is the only editor that uses the debugging functionality from cider-nrepl (to my knowledge at least) I think that breaking compatibility is not really a concern here.

@bbatsov
Copy link
Member

bbatsov commented Oct 16, 2019

FYI - we'll soon unblock this with #654

@yuhan0
Copy link
Contributor

yuhan0 commented Oct 19, 2019

I helped to rebase the changes in this branch, see https://github.com/yuhan0/cider-nrepl/tree/inspect-current

@bbatsov
Copy link
Member

bbatsov commented Oct 20, 2019

@yuhan0 I guess you can just open a new PR, so we can finish this. I'm sure @alexander-yakushev won't mind.

@alexander-yakushev
Copy link
Member Author

Sure, no problem. I'd love to see it merged.

@bbatsov
Copy link
Member

bbatsov commented Oct 21, 2019

Closing in favour of #655.

@bbatsov bbatsov closed this Oct 21, 2019
@alexander-yakushev alexander-yakushev deleted the inspect-current branch April 8, 2020 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants