@@ -427,20 +427,42 @@ MAX-COLL-SIZE if non nil."
427427 (error (insert " \n Inspector error for: " str))))
428428 (goto-char (point-min ))))
429429
430+ (defvar cider-inspector-looking-at-java-p nil )
431+
430432(defun cider-inspector-render* (elements )
431433 " Render ELEMENTS."
434+ (setq cider-inspector-looking-at-java-p nil )
432435 (dolist (el elements)
433436 (cider-inspector-render-el* el)))
434437
438+ (defconst cider--inspector-java-headers
439+ '(" --- Interfaces:" " --- Constructors:" " --- Fields:" " --- Methods:" " --- Imports:" ))
440+
435441(defun cider-inspector-render-el* (el )
436442 " Render EL."
437- (cond ((symbolp el) (insert (symbol-name el)))
438- ((stringp el) (insert (propertize el 'font-lock-face 'font-lock-keyword-face )))
439- ((and (consp el) (eq (car el) :newline ))
440- (insert " \n " ))
441- ((and (consp el) (eq (car el) :value ))
442- (cider-inspector-render-value (cadr el) (cl-caddr el)))
443- (t (message " Unrecognized inspector object: %s " el))))
443+ (let ((header-p (or (member el cider--inspector-java-headers)
444+ (and (stringp el)
445+ (string-prefix-p " --- " el)))))
446+ ; ; Headers reset the Java syntax coloring:
447+ (when header-p
448+ (setq cider-inspector-looking-at-java-p nil ))
449+
450+ (cond ((symbolp el) (insert (symbol-name el)))
451+ ((stringp el) (insert (if cider-inspector-looking-at-java-p
452+ (cider-font-lock-as 'java-mode el)
453+ (propertize el 'font-lock-face (if header-p
454+ 'font-lock-comment-face
455+ 'font-lock-keyword-face )))))
456+ ((and (consp el) (eq (car el) :newline ))
457+ (insert " \n " ))
458+ ((and (consp el) (eq (car el) :value ))
459+ (cider-inspector-render-value (cadr el) (cl-caddr el)))
460+ (t (message " Unrecognized inspector object: %s " el))))
461+
462+ ; ; Java-related headers indicate that the next elements to be rendered
463+ ; ; should be syntax-colored as Java:
464+ (when (member el cider--inspector-java-headers)
465+ (setq cider-inspector-looking-at-java-p t )))
444466
445467(defun cider-inspector-render-value (value idx )
446468 " Render VALUE at IDX."
0 commit comments