Inspector: (feature request) Syntax highlighting for the java methods
anonimitoraf opened this issue · 5 comments
First of all, I want to say that the CIDER inspector is awesome! Can't live without it.
Is your feature request related to a problem? Please describe.
I find it hard to grok the methods list when they are long, have a lot of arguments and/or there are a lot of them.
For example:
Describe the solution you'd like
It would be nice to have Java syntax highlighting for the method names, arguments, etc.
Describe alternatives you've considered
I currently have a very (very) hacky solution that adds highlighting via overlays
(defvar ++ov-cider-inspector-keywords)
(defvar ++ov-cider-inspector-method-names)
(defvar ++ov-cider-inspector-method-param-lists)
(defun ++ov-cider-inspector ()
(ov-clear)
(let ((case-fold-search nil))
(setq ++ov-cider-inspector-keywords (ov-regexp "^public\\|private\\|protected\\|final\\|native\\|static$")
++ov-cider-inspector-method-names (ov-regexp "\\([a-zA-Z0-9.$]\\)+(")
++ov-cider-inspector-method-param-lists (ov-regexp "(\\([][<>a-zA-Z0-9.$,]*\\))?")))
(ov-set ++ov-cider-inspector-keywords 'face `(:foreground ,(doom-color 'magenta)))
(ov-set ++ov-cider-inspector-method-names 'face `(:foreground ,(doom-color 'red)))
(ov-set ++ov-cider-inspector-method-param-lists 'face `(:foreground "white")))
but even this gives me something very basic:
This is the snippet I use for similar use cases:
(defun vemv/to-java-string (s)
"Returns a propertized string with Java syntax coloring"
(with-temp-buffer
(insert s)
(java-mode)
(font-lock-ensure)
(buffer-string)))
Feel free to give it a try.
Besides, I noticed in your screenshot another point of improvement. Created clojure-emacs/orchard#198
Thanks for sharing. What does your workflow look like with that snippet?
Mmm, if you don't have it easy to plug that function somewhere, let's just wait till a PR lands.
Should be soon enough.
Awesome, thanks!
Cheers, the Melpa snapshot should be available later tonight.
We will also cut a stable release with other Inspector goodies 🔎