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

Improve readability and visibility of *nrepl-messages* buffer #792

Merged
merged 1 commit into from
Sep 13, 2014

Conversation

vspinu
Copy link
Contributor

@vspinu vspinu commented Sep 12, 2014

Make requests and responses appear differently from each other:

(--->
  id    "61"
  op    "load-file"
  session   "c705ea4f-b392-4583-89b5-02d02a7bab1f"
  file  "(ns user)\n\n\n\n\n\n\n\n\n\n\n\n34"
  file-path "/home/vitoshka/.lein/profiles.clj"
  file-name "profiles.clj")
(<-
  id    "61"
  ns    "user"
  session   "c705ea4f-b392-4583-89b5-02d02a7bab1f"
  value "34")
(<-
  id    "61"
  session   "c705ea4f-b392-4583-89b5-02d02a7bab1f"
  status    ("done")
)

Also make *nrepl-messages* buffer scroll to bottom on new messages when visible.

@bbatsov
Copy link
Member

bbatsov commented Sep 12, 2014

I was about to open a ticket regarding the nrepl-messages. I notice some odd things in the buffer like:

(dict
  id    "3"
  ops   (dict "apropos"
      (dict)
      "classpath"
      (dict)
      "clone"
      (dict)
      "close"
      (dict)
      "complete"
      (dict)
      "describe"
      (dict)
      "eval"
      (dict)
      "info"
      (dict)
      "inspect-pop"
      (dict)
      "inspect-push"
      (dict)
      "inspect-refresh"
      (dict)
      "inspect-reset"
      (dict)
      "inspect-start"
      (dict)
      "interrupt"
      (dict)
      "load-file"
      (dict)
      "ls-sessions"
      (dict)
      "macroexpand"
      (dict)
      "macroexpand-1"
      (dict)
      "macroexpand-all"
      (dict)
      "ns-list"
      (dict)
      "resource"
      (dict)
      "retest"
      (dict)
      "stacktrace"
      (dict)
      "stdin"
      (dict)
      "test"
      (dict)
      "test-stacktrace"
      (dict)
      "toggle-trace"
      (dict)
      "undef"
      (dict))

  session   "17dd7850-a7ac-4964-9ce0-5c326e5868e8"
  status    ("done")

  versions  (dict "clojure"
      (dict "incremental" 1 "major" 1 "minor" 5)
      "nrepl"
      (dict "incremental" "3" "major" "0" "minor" "2" "qualifier" "" "version-string" "0.2.3"))
)

Those empty dict elements seem misplaced.

This has odd alignment:

(dict
  id    "4"
  op    "eval"
  session   "cc4275ad-0701-4182-bda0-b08f7f9c4fc1"
  code  "(try (require 'cider.nrepl)\n                                  (:version-string @(resolve 'cider.nrepl/version))\n                               (catch Throwable _ \"not installed\"))")

The status is displayed as a list, but it's just the keyword :done:

(dict
  id    "4"
  session   "cc4275ad-0701-4182-bda0-b08f7f9c4fc1"
  status    ("done")
)

I was also thinking if we shouldn't color-code related requests and response - perhaps by assigning 5-10 colors to each id on a circular basis (eg. mod 10) - 1: red, 2: green, 3: yellow, ... 11: red, 12: green.

@vspinu
Copy link
Contributor Author

vspinu commented Sep 12, 2014

Those empty dict elements seem misplaced.

Yes, I was too lazy to implement recursive printing. So inner dicts are
not printed quite right. It would require a bit more thinking to do it
correctly. An easy solution would be to convert them to alists and then
pprint.

This has odd alignment:

(dict
id "4"
op "eval"
session "cc4275ad-0701-4182-bda0-b08f7f9c4fc1"
code "(try (require 'cider.nrepl)\n (:version-string @(resolve 'cider.nrepl/version))\n (catch Throwable _ "not installed"))")

I don't see it. Why is it odd?

The status is displayed as a list, but it's just the keyword :done:

(dict
id "4"
session "cc4275ad-0701-4182-bda0-b08f7f9c4fc1"
status ("done")
)

It's really a list. Status is always a list.

I was also thinking if we shouldn't color-code related requests and response -
perhaps by assigning 5-10 colors to each id on a circular basis (eg. mod 10) -
1: red, 2: green, 3: yellow, ... 11: red, 12: green.

That would be cool. Rainbow buffer:)

@bbatsov
Copy link
Member

bbatsov commented Sep 12, 2014

I don't see it. Why is it odd?

The dict values are not aligned with each other and on the other hand the space between them and the keys isn't constant as well. It seems randomish to me.

It's really a list. Status is always a list.

Guess it might be treated specially by nREPL, but it doesn't look like a list in the code. Here's an excerpt from a random middleware:

(transport/send transport (response-for msg :status :done))

@vspinu
Copy link
Contributor Author

vspinu commented Sep 12, 2014

The dict values are not aligned with each other and

It's one tab between keys and values. They are perfectly aligned for me. What's your value of tab-stop-list.

(transport/send transport (response-for msg :status :done))

On clojure side yes. On emacs side all keywords are strings, and status message is a list and it can contain a lot of stuff, for example ("done" "id-interrupt-mismatch" "error") when you try to interrupt a "finished" request id.

@vspinu
Copy link
Contributor Author

vspinu commented Sep 12, 2014

I have sorted out the recursive dicts and replaced tabs with double spaces. It looks more regular this way. Also added the rainbow non-intrusive highlighting. Looks pretty cool now.

cider3

bbatsov added a commit that referenced this pull request Sep 13, 2014
Improve readability and visibility of *nrepl-messages* buffer
@bbatsov bbatsov merged commit 08f48fb into clojure-emacs:master Sep 13, 2014
@vspinu vspinu deleted the better-message branch September 13, 2014 07:09
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.

2 participants