-
-
Notifications
You must be signed in to change notification settings - Fork 652
Inspector: render Java items using java-mode
syntax coloring
#3547
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
Conversation
((stringp el) (insert (if cider-inspector-looking-at-java-p | ||
(cider--to-java-string el) | ||
(propertize el 'font-lock-face (if header-p | ||
'font-lock-comment-face |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Headers now are rendered as comments - else it's all too homogeneous.
Starting from emacs-29, build-in |
Good eye! It seems most desirable to simply pick java-ts-mode if available, improving performance I guess (or in any case having color consistency, in case there's a discrepancy between both modes. Assuming that the user uses java-ts-mode regularly). Would you be able to try this diff locally and confirm that it works well with java-ts-mode? |
Sure, I can try it out tomorrow. The only concern I have is that emacs can be built without the tree-sitter support or the grammar can be missing, I guess |
Is that condition detectable? |
@vemv, yes, it's possible: (require 'treesit)
(treesit-available-p) ;check if Emacs is built with tree-sitter library
(treesit-language-available-p 'java) ;Make sure Emacs can find the language grammar you want to use |
Given the simple nature of this highlighting in the inspector, it seems to me that using I'd suggest a defcustom to enable/disable this, and perhaps a second one about the preferred java-mode to use, if someone feels strongly that using |
cider-inspector.el
Outdated
(dolist (el elements) | ||
(cider-inspector-render-el* el))) | ||
|
||
(defun cider--to-java-string (s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we had a similar function in cider-util.el
already that you can reuse (it takes the mode to use as its param).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed! I got to also kill a similar defun in cider-docstring.el
.
@rrudakov although your suggestion was a fair call, it seems best addressed later, and also backed by a specific problem statement (not that I don't like the idea, but we'd like to see some performance or presentational difference first). My main reasoning is that we now have 5 |
vemv ***@***.***> writes:
@rrudakov although your suggestion was a fair call, it seems best
addressed later, and also backed by a specific problem statement
(not that I don't like the idea, but we'd like to see some
performance or presentational difference first).
My main reasoning is that we now have 5 `cider-font-lock-as
'java-mode` calls, so it would be a broader refactoring than
initially thought.
Sure, sounds fair. Thanks for considering this anyway.
--
Best regards, Roman
|
Fixes #3546
Demo:
Cheers - V