Skip to content

Commit acb733b

Browse files
authored
Merge branch 'master' into add-client-info
2 parents 57ce33d + 340432f commit acb733b

File tree

22 files changed

+175
-227
lines changed

22 files changed

+175
-227
lines changed

.circleci/config.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,11 @@ workflows:
150150
requires:
151151
- test-lint
152152
- test-shellcheck
153-
- test-ubuntu-emacs-master:
154-
requires:
155-
- test-lint
156-
- test-shellcheck
153+
# TODO: reenable once this issue is fixed https://app.circleci.com/pipelines/github/clojure-emacs/cider/2931/workflows/b7284759-c6d1-44dd-bbfc-e71709e3f62f/jobs/17699
154+
# - test-ubuntu-emacs-master:
155+
# requires:
156+
# - test-lint
157+
# - test-shellcheck
157158
- test-windows-emacs-latest:
158159
requires:
159160
- test-lint

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ jobs:
2323
matrix:
2424
# Test all Emacs versions on Ubuntu.
2525
os: [ubuntu-latest]
26-
emacs_version: ['27.2', '28.2', '29.3', '30.1', 'snapshot']
26+
# TODO: reenable snapshot once this is fixed https://app.circleci.com/pipelines/github/clojure-emacs/cider/2931/workflows/b7284759-c6d1-44dd-bbfc-e71709e3f62f/jobs/17699
27+
# emacs_version: ['27.2', '28.2', '29.3', '30.1', 'snapshot']
28+
emacs_version: ['27.2', '28.2', '29.3', '30.1']
2729
java_version: ['21']
2830
include:
2931
# For other OSes, test only the latest stable Emacs version.

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@
1414
- [#3793](https://github.com/clojure-emacs/cider/issues/3793): **(Breaking)** Remove features that relied on printed exception parsing:
1515
- `cider-stacktrace-analyze-string` and `cider-stacktrace-analyze-at-point` functions.
1616
- Automatic stacktrace parsing in log viewer.
17-
- Bump the injected `cider-nrepl` to [0.54.0](https://github.com/clojure-emacs/cider-nrepl/blob/master/CHANGELOG.md#0540-2025-04-05).
17+
- Bump the injected `cider-nrepl` to [0.55.0](https://github.com/clojure-emacs/cider-nrepl/blob/master/CHANGELOG.md#0550-2025-04-10).
1818
- [compliment#122](https://github.com/alexander-yakushev/compliment/pull/122): Completion: sort candidates by priority.
1919
- Inspector: add dedicated view for Exceptions.
2020
- Stop vendoring Haystack dependency.
2121
- Stop vendoring Puget dependency. You can still use `puget` pretty-printer in CIDER, but you need to depend on Puget explicitly. If Puget is not found on the classpath, CIDER will revert to `clojure.pprint/pprint` for pretty-printing.
2222
- [#3777](https://github.com/clojure-emacs/cider/issues/3777): Inspector no longer displays parsed Javadoc for Java classes and members.
2323
- [#3790](https://github.com/clojure-emacs/cider/issues/3790): Stacktrace: show messages and data for all exception causes by default.
24+
- [#3807](https://github.com/clojure-emacs/cider/issues/3807): Stacktrace: make exception data individually inspectable.
2425
- [#3789](https://github.com/clojure-emacs/cider/issues/3789): Refactor and simplify exception handling.
2526
- [#3789](https://github.com/clojure-emacs/cider/issues/3796): Completion: disable client-side sorting (defer to backend-provided candidate order).
2627
- [#3797](https://github.com/clojure-emacs/cider/issues/3797): Completion: enable `cider-completion-style` by default (this enables richer completion suggestions where candidates don't have to strictly match the prefix).
2728
- [#3803](https://github.com/clojure-emacs/cider/pull/3803): Enable dynamic indentation for `clojure-ts-mode`.
29+
- [#3805](https://github.com/clojure-emacs/cider/pull/3805): Profiler: update to latest profiling middleware.
2830
- [#3806](https://github.com/clojure-emacs/cider/pull/3806): Add client info to `clone` op request.
2931

3032
### Bugs fixed

cider-eval.el

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,21 @@ When clojure.stracktrace is not present."
295295
(cider-nrepl-sync-request:eval
296296
"(println (ex-data *e))")))
297297

298-
(defun cider--render-stacktrace-causes (causes &optional error-types is-compilation)
298+
(defun cider--render-stacktrace-causes (causes &optional error-types
299+
is-compilation repl)
299300
"If CAUSES is non-nil, render its contents into a new error buffer.
300301
Optional argument ERROR-TYPES contains a list which should determine the
301302
op/situation that originated this error.
302303
If IS-COMPILATION is true, render the stacktrace into the error buffer but
303-
don't bring it forward."
304+
don't bring it forward.
305+
REPL connection can be provided to set it as the connection for the created
306+
*cider-error* buffer."
304307
(when causes
305-
(let ((error-buffer (cider-new-error-buffer #'cider-stacktrace-mode
306-
error-types is-compilation)))
308+
(let* ((repl (or repl (cider-current-repl)))
309+
(error-buffer (cider-new-error-buffer #'cider-stacktrace-mode
310+
error-types is-compilation)))
311+
(with-current-buffer error-buffer
312+
(setq cider--ancillary-buffer-repl repl))
307313
(cider-stacktrace-render error-buffer causes error-types))))
308314

309315
(defconst cider-clojure-compilation-error-phases-default-value
@@ -362,7 +368,8 @@ For others, pop up *cider-error* buffer."
362368
(nrepl-notify msg type))))
363369
;; Render stacktrace in *cider-error* buffer if it is a runtime error.
364370
(cider--render-stacktrace-causes
365-
causes nil (member ex-phase (cider-clojure-compilation-error-phases)))
371+
causes nil (member ex-phase (cider-clojure-compilation-error-phases))
372+
(with-current-buffer source-buffer (cider-current-repl)))
366373
;; If the error is a compilation error (which we normally don't show
367374
;; *cider-error* buffer for), or the error buffer is disabled, compensate for
368375
;; the lack of info with a overlay error. Verify that the provided buffer is

cider-inspector.el

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,17 @@ See `cider-sync-request:inspect-push' and `cider-inspector--render-value'"
252252
(push (point) cider-inspector-location-stack)
253253
(cider-inspector--render-value result :next-inspectable))))
254254

255-
(defun cider-inspector-inspect-last-exception (index)
256-
"Inspects the exception in the cause stack identified by INDEX."
255+
(defun cider-inspector-inspect-last-exception (index &optional ex-data)
256+
"Inspects the exception in the cause stack identified by INDEX.
257+
If EX-DATA is true, inspect ex-data of the exception instead."
257258
(interactive)
258259
(cl-assert (numberp index))
259-
(let ((result (cider-sync-request:inspect-last-exception index)))
260+
(let ((result (cider-nrepl-send-sync-request
261+
`("op" "inspect-last-exception"
262+
"index" ,index
263+
,@(when ex-data
264+
`("ex-data" "true")))
265+
(cider-current-repl))))
260266
(when (nrepl-dict-get result "value")
261267
(setq cider-inspector-location-stack nil)
262268
(cider-inspector--render-value result :next-inspectable))))
@@ -423,14 +429,6 @@ current-namespace."
423429
(cider-nrepl-send-sync-request `("op" "inspect-previous-sibling")
424430
(cider-current-repl)))
425431

426-
;;;###autoload
427-
(defun cider-sync-request:inspect-last-exception (index)
428-
"Inspects the exception in the cause stack identified by INDEX."
429-
(cl-assert (numberp index))
430-
(cider-nrepl-send-sync-request `("op" "inspect-last-exception"
431-
"index" ,index)
432-
(cider-current-repl)))
433-
434432
(defun cider-sync-request:inspect-next-sibling ()
435433
"Inspect the next sibling value within a sequential parent."
436434
(cider-nrepl-send-sync-request `("op" "inspect-next-sibling")

cider-mode.el

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ The result depends on the buffer CIDER connection type."
673673
(defface cider-traced-face
674674
'((((type graphic)) :box (:color "cyan" :line-width -1))
675675
(t :underline t :background "#066"))
676-
"Face used to mark code being traced."
676+
"Face used to mark functions being traced or profiled."
677677
:group 'cider
678678
:package-version '(cider . "0.11.0"))
679679

@@ -805,11 +805,11 @@ with the given LIMIT."
805805
(push sym instrumented))
806806
(`"\"light-form\""
807807
(push sym enlightened)))
808-
;; The ::traced keywords can be inlined by MrAnderson, so
809-
;; we catch that case too.
810808
;; FIXME: This matches values too, not just keys.
811-
(when (seq-find (lambda (k) (and (stringp k)
812-
(string-match (rx "orchard.trace/traced" eos) k)))
809+
(when (seq-find (lambda (k)
810+
(and (stringp k)
811+
(or (string= "orchard.trace/traced" k)
812+
(string= "orchard.profile/profiled" k))))
813813
meta)
814814
(push sym traced))
815815
(when (and do-deprecated (nrepl-dict-get meta "deprecated"))

cider-profile.el

Lines changed: 17 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,18 @@
2828
(require 'cider-client)
2929
(require 'cider-popup)
3030
(require 'cider-eval)
31-
32-
(defconst cider-profile-buffer "*cider-profile*")
31+
(require 'cider-inspector)
3332

3433
(defvar cider-profile-map
3534
(let ((map (define-prefix-command 'cider-profile-map)))
3635
(define-key map (kbd "t") #'cider-profile-toggle)
3736
(define-key map (kbd "C-t") #'cider-profile-toggle)
3837
(define-key map (kbd "c") #'cider-profile-clear)
3938
(define-key map (kbd "C-c") #'cider-profile-clear)
40-
(define-key map (kbd "S") #'cider-profile-summary)
41-
(define-key map (kbd "C-S") #'cider-profile-summary)
42-
(define-key map (kbd "s") #'cider-profile-var-summary)
43-
(define-key map (kbd "C-s") #'cider-profile-var-summary)
39+
(define-key map (kbd "s") #'cider-profile-summary)
40+
(define-key map (kbd "C-s") #'cider-profile-summary)
4441
(define-key map (kbd "n") #'cider-profile-ns-toggle)
4542
(define-key map (kbd "C-n") #'cider-profile-ns-toggle)
46-
(define-key map (kbd "v") #'cider-profile-var-profiled-p)
47-
(define-key map (kbd "C-v") #'cider-profile-var-profiled-p)
48-
(define-key map (kbd "+") #'cider-profile-samples)
49-
(define-key map (kbd "C-+") #'cider-profile-samples)
5043
map)
5144
"CIDER profiler keymap.")
5245

@@ -55,9 +48,6 @@
5548
["Toggle var profiling" cider-profile-toggle]
5649
["Toggle namespace profiling" cider-profile-ns-toggle]
5750
"--"
58-
["Display var profiling status" cider-profile-var-profiled-p]
59-
["Display max sample count" cider-profile-samples]
60-
["Display var summary" cider-profile-var-summary]
6151
["Display summary" cider-profile-summary]
6252
["Clear data" cider-profile-clear])
6353
"CIDER profiling submenu.")
@@ -69,66 +59,20 @@ Optional argument BUFFER defaults to current buffer."
6959
(nrepl-make-response-handler
7060
(or buffer (current-buffer)) handler nil nil nil))
7161

72-
;;;###autoload
73-
(defun cider-profile-samples (&optional query)
74-
"Displays current max-sample-count.
75-
If optional QUERY is specified, set max-sample-count and display new value."
76-
(interactive "P")
77-
(cider-ensure-op-supported "set-max-samples")
78-
(cider-ensure-op-supported "get-max-samples")
79-
(if (not (null query))
80-
(cider-nrepl-send-request
81-
(let ((max-samples (if (numberp query) query '())))
82-
(message "query: %s" max-samples)
83-
`("op" "set-max-samples" "max-samples" ,max-samples))
84-
(cider-profile--make-response-handler
85-
(lambda (_buffer value)
86-
(let ((value (if (zerop (length value)) "unlimited" value)))
87-
(message "max-sample-count is now %s" value)))))
88-
(cider-nrepl-send-request
89-
'("op" "get-max-samples")
90-
(cider-profile--make-response-handler
91-
(lambda (_buffer value)
92-
(let ((value (if (zerop (length value)) "unlimited" value)))
93-
(message "max-sample-count is now %s" value))))))
94-
query)
95-
96-
;;;###autoload
97-
(defun cider-profile-var-profiled-p (query)
98-
"Displays the profiling status of var under point.
99-
Prompts for var if none under point or QUERY is present."
100-
(interactive "P")
101-
(cider-ensure-op-supported "is-var-profiled")
102-
(cider-read-symbol-name
103-
"Report profiling status for var: "
104-
(lambda (sym)
105-
(let ((ns (cider-current-ns)))
106-
(cider-nrepl-send-request
107-
`("op" "is-var-profiled"
108-
"ns" ,ns
109-
"sym" ,sym)
110-
(cider-profile--make-response-handler
111-
(lambda (_buffer value)
112-
(pcase value
113-
("profiled" (message "Profiling is currently enabled for %s/%s" ns sym))
114-
("unprofiled" (message "Profiling is currently disabled for %s/%s" ns sym))
115-
("unbound" (message "%s/%s is unbound" ns sym)))))))))
116-
query)
117-
11862
;;;###autoload
11963
(defun cider-profile-ns-toggle (&optional query)
12064
"Toggle profiling for the ns associated with optional QUERY.
12165
12266
If optional argument QUERY is non-nil, prompt for ns. Otherwise use
12367
current ns."
12468
(interactive "P")
125-
(cider-ensure-op-supported "toggle-profile-ns")
69+
(cider-ensure-op-supported "cider/profile-toggle-ns")
12670
(let ((ns (if query
12771
(completing-read "Toggle profiling for ns: "
12872
(cider-sync-request:ns-list))
12973
(cider-current-ns))))
13074
(cider-nrepl-send-request
131-
`("op" "toggle-profile-ns"
75+
`("op" "cider/profile-toggle-ns"
13276
"ns" ,ns)
13377
(cider-profile--make-response-handler
13478
(lambda (_buffer value)
@@ -143,69 +87,42 @@ current ns."
14387
Defaults to the symbol at point.
14488
With prefix arg or no symbol at point, prompts for a var."
14589
(interactive "P")
146-
(cider-ensure-op-supported "toggle-profile")
90+
(cider-ensure-op-supported "cider/profile-toggle-var")
14791
(cider-read-symbol-name
14892
"Toggle profiling for var: "
14993
(lambda (sym)
15094
(let ((ns (cider-current-ns)))
15195
(cider-nrepl-send-request
152-
`("op" "toggle-profile"
96+
`("op" "cider/profile-toggle-var"
15397
"ns" ,ns
15498
"sym" ,sym)
15599
(cider-profile--make-response-handler
156100
(lambda (_buffer value)
157101
(pcase value
158102
("profiled" (message "Profiling enabled for %s/%s" ns sym))
159-
("unprofiled" (message "Profiling disabled for %s/%s" ns sym))
160-
("unbound" (message "%s/%s is unbound" ns sym)))))))))
103+
("unprofiled" (message "Profiling disabled for %s/%s" ns sym)))))))))
161104
query)
162105

163-
(defun cider-profile-display-stats (stats-response)
164-
"Displays the STATS-RESPONSE on `cider-profile-buffer`."
165-
(let ((table (nrepl-dict-get stats-response "err")))
166-
(if cider-profile-buffer
167-
(let ((buffer (cider-make-popup-buffer cider-profile-buffer)))
168-
(with-current-buffer buffer
169-
(let ((inhibit-read-only t)) (insert table)))
170-
(display-buffer buffer)
171-
(let ((window (get-buffer-window buffer)))
172-
(set-window-point window 0)
173-
(select-window window)
174-
(fit-window-to-buffer window)))
175-
(cider-emit-interactive-eval-err-output table))))
106+
(defun cider-profile--send-to-inspector (summary-response)
107+
"Displays SUMMARY-RESPONSE using the inspector."
108+
(let ((value (nrepl-dict-get summary-response "value")))
109+
(cider-inspector--render-value value)))
176110

177111
;;;###autoload
178112
(defun cider-profile-summary ()
179113
"Display a summary of currently collected profile data."
180114
(interactive)
181-
(cider-ensure-op-supported "profile-summary")
182-
(cider-profile-display-stats
183-
(cider-nrepl-send-sync-request '("op" "profile-summary"))))
184-
185-
;;;###autoload
186-
(defun cider-profile-var-summary (query)
187-
"Display profile data for var under point QUERY.
188-
Defaults to the symbol at point. With prefix arg or no symbol at point,
189-
prompts for a var."
190-
(interactive "P")
191-
(cider-ensure-op-supported "profile-var-summary")
192-
(cider-read-symbol-name
193-
"Profile-summary for var: "
194-
(lambda (sym)
195-
(cider-profile-display-stats
196-
(cider-nrepl-send-sync-request
197-
`("op" "profile-var-summary"
198-
"ns" ,(cider-current-ns)
199-
"sym" ,sym)))))
200-
query)
115+
(cider-ensure-op-supported "cider/profile-summary")
116+
(cider-inspector--render-value
117+
(cider-nrepl-send-sync-request '("op" "cider/profile-summary"))))
201118

202119
;;;###autoload
203120
(defun cider-profile-clear ()
204121
"Clear any collected profile data."
205122
(interactive)
206-
(cider-ensure-op-supported "clear-profile")
123+
(cider-ensure-op-supported "cider/profile-clear")
207124
(cider-nrepl-send-request
208-
'("op" "clear-profile")
125+
'("op" "cider/profile-clear")
209126
(cider-profile--make-response-handler
210127
(lambda (_buffer value)
211128
(when (equal value "cleared")

cider-selector.el

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
(require 'cider-client)
3535
(require 'cider-eval)
3636
(require 'cider-scratch)
37-
(require 'cider-profile)
3837

3938
(defconst cider-selector-help-buffer "*CIDER Selector Help*"
4039
"The name of the selector's help buffer.")
@@ -162,10 +161,6 @@ visited cider-repl-mode buffer."
162161
"*cider-error* buffer."
163162
cider-error-buffer)
164163

165-
(def-cider-selector-method ?p
166-
"*cider-profile* buffer."
167-
cider-profile-buffer)
168-
169164
(def-cider-selector-method ?d
170165
"*cider-doc* buffer."
171166
cider-doc-buffer)

0 commit comments

Comments
 (0)