-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
cider-prettify-sexp #535
Comments
👍 |
Sounds like a good idea. |
Unfortunately both of these functions are a little odd to use, since it's always evaluating the form. If the form can't evaluate (as is the case in unquoted lists in output), it throws an error. For the case above it is quoted, but it seems like a generic method for pretty print replacing without evaluating would be really useful for the edn case. Then again, I'm not sure how to deal with #inst and friends. |
Per discussion at clojure-emacs#535, I tried using `cider-pprint-eval-defun-at-point` bound to `C-c C-f` as it is in the interactive minor mode. Unfortunately defun-at-point is not as well defined at the repl for some reason, I noticed similar while experimenting with `cider-eval-defun-at-point` at the repl. So I tried it with `cider-pprint-eval-last-sexp`, as that seemed more useful. I guess the mnemonic would be see form? This at least improves the case where the repl returns a very large vector, map or quoted list and it needs to be inspected visually. It doesn't reformat it in-place but it is reformatted in the popup buffer. I also think this plays well with the exiting pprint toggle in the repl as a shortcut.
I'm pretty sure the point of the issue is to reformat structures in the source code, instead of simply pretty-printing them somewhere. |
Yea, I gathered that. So my though on that is that currently The reason I talked about the problems with evaluating the form is that is part of the problem with this approach. For a reformat case, lists should probably be quoted automatically and not evaluated. I'm also not quite clear how to grab the stdout of pprint instead of the eval result. |
Per discussion at clojure-emacs#535, I tried using `cider-pprint-eval-defun-at-point` bound to `C-c C-f` as it is in the interactive minor mode. Unfortunately defun-at-point is not as well defined at the repl for some reason, I noticed similar while experimenting with `cider-eval-defun-at-point` at the repl. So I tried it with `cider-pprint-eval-last-sexp`, as that seemed more useful. I guess the mnemonic would be see form? This at least improves the case where the repl returns a very large vector, map or quoted list and it needs to be inspected visually. It doesn't reformat it in-place but it is reformatted in the popup buffer. I also think this plays well with the exiting pprint toggle in the repl as a shortcut.
The text was updated successfully, but these errors were encountered: