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 improvement: don't print result of a step to string #1049

Closed
DesmondHayes opened this issue Mar 31, 2015 · 3 comments · Fixed by #1053
Closed

Debugger improvement: don't print result of a step to string #1049

DesmondHayes opened this issue Mar 31, 2015 · 3 comments · Fixed by #1053

Comments

@DesmondHayes
Copy link

Consider an example:

(defn foo [x y]
  (symbol (str x "/" y)))

I want to debug the following call to 'foo:

(foo "bar" "baz")

Debugger step results as I press "n":

N Now (bad) Should be (good)
1 ""bar"" "bar"
2 ""baz"" "baz"
3 ""bar/baz"" "bar/baz"
4 "bar/baz" bar/baz
@Malabarba
Copy link
Member

Thanks for the report. I'll look into this.

@cichli
Copy link
Member

cichli commented Apr 1, 2015

@Malabarba nREPL already does the equivalent of pr-str on :value slots in responses (see this middleware), so I think we're double-printing. This likely only happens with more recent versions of nREPL (>= 0.27) due to a change in the middleware ordering algorithm in 0.2.7. We have a few options:

  • Include a non-nil value in the :printed-value slot of the response, so pr-values will skip printing
  • Keep doing the printing ourselves in the debugger middleware but use a different slot name than :value
  • Remove the call to pr-str from the debugger middleware, and add #'pr-values to the :requires set of wrap-debug, to guarantee that the slot will be printed (like here)

:printed-value was only added to nREPL 0.2.10, and pr-values is technically an nREPL implementation detail, so maybe option 2 is the simplest. Thoughts?

@Malabarba
Copy link
Member

I added the manual printing because it seemed to be necessary on the
nrepl version I had. Otherwise I ran into issues. I think my version
was 0.2.6, so it's consistent with what you're saying, @cichli.

And yes, I think option 2 is the simplest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants