Skip to content

Commit 9dc5107

Browse files
alexander-yakushevbbatsov
authored andcommitted
[inspector] Remove functions that don't bring value
1 parent fddaa87 commit 9dc5107

File tree

1 file changed

+29
-114
lines changed

1 file changed

+29
-114
lines changed

cider-inspector.el

Lines changed: 29 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,17 @@ In particular, it does not read `cider-sexp-at-point'."
244244
ns)))
245245

246246
(defun cider-inspector-pop ()
247-
"Pop the last value off the inspector stack and render it.
248-
See `cider-sync-request:inspect-pop' and `cider-inspector--render-value'."
247+
"Pop the last value off the inspector stack and render it."
249248
(interactive)
250-
(let ((result (cider-sync-request:inspect-pop)))
249+
(let ((result (cider-nrepl-send-sync-request `("op" "inspect-pop"))))
251250
(when (nrepl-dict-get result "value")
252251
(cider-inspector--render-value result :pop))))
253252

254253
(defun cider-inspector-push (idx)
255-
"Inspect the value at IDX in the inspector stack and render it.
256-
See `cider-sync-request:inspect-push' and `cider-inspector--render-value'"
254+
"Inspect the value at IDX in the inspector stack and render it."
257255
(interactive)
258-
(let ((result (cider-sync-request:inspect-push idx)))
256+
(let ((result (cider-nrepl-send-sync-request `("op" "inspect-push"
257+
"idx" ,idx))))
259258
(when (nrepl-dict-get result "value")
260259
(push (point) cider-inspector-location-stack)
261260
(cider-inspector--render-value result :next-inspectable))))
@@ -269,33 +268,29 @@ If EX-DATA is true, inspect ex-data of the exception instead."
269268
`("op" "inspect-last-exception"
270269
"index" ,index
271270
,@(when ex-data
272-
`("ex-data" "true")))
273-
(cider-current-repl))))
271+
`("ex-data" "true"))))))
274272
(when (nrepl-dict-get result "value")
275273
(setq cider-inspector-location-stack nil)
276274
(cider-inspector--render-value result :next-inspectable))))
277275

278276
(defun cider-inspector-previous-sibling ()
279-
"Inspect the previous sibling value within a sequential parent.
280-
See `cider-sync-request:inspect-previous-sibling' and `cider-inspector--render-value'"
277+
"Inspect the previous sibling value within a sequential parent."
281278
(interactive)
282-
(let ((result (cider-sync-request:inspect-previous-sibling)))
279+
(let ((result (cider-nrepl-send-sync-request `("op" "inspect-previous-sibling"))))
283280
(when (nrepl-dict-get result "value")
284281
(cider-inspector--render-value result))))
285282

286283
(defun cider-inspector-next-sibling ()
287-
"Inspect the next sibling value within a sequential parent.
288-
See `cider-sync-request:inspect-next-sibling' and `cider-inspector--render-value'"
284+
"Inspect the next sibling value within a sequential parent."
289285
(interactive)
290-
(let ((result (cider-sync-request:inspect-next-sibling)))
286+
(let ((result (cider-nrepl-send-sync-request `("op" "inspect-next-sibling"))))
291287
(when (nrepl-dict-get result "value")
292288
(cider-inspector--render-value result))))
293289

294290
(defun cider-inspector--refresh-with-opts (&rest opts)
295291
"Invokes `inspect-refresh' op with supplied extra OPTS.
296292
Re-renders the currently inspected value."
297-
(let ((result (cider-nrepl-send-sync-request `("op" "inspect-refresh" ,@opts)
298-
(cider-current-repl))))
293+
(let ((result (cider-nrepl-send-sync-request `("op" "inspect-refresh" ,@opts))))
299294
(when (nrepl-dict-get result "value")
300295
(cider-inspector--render-value result))))
301296

@@ -309,7 +304,7 @@ Re-renders the currently inspected value."
309304
310305
Does nothing if already on the last page."
311306
(interactive)
312-
(let ((result (cider-sync-request:inspect-next-page)))
307+
(let ((result (cider-nrepl-send-sync-request '("op" "inspect-next-page"))))
313308
(when (nrepl-dict-get result "value")
314309
(cider-inspector--render-value result))))
315310

@@ -318,7 +313,7 @@ Does nothing if already on the last page."
318313
319314
Does nothing if already on the first page."
320315
(interactive)
321-
(let ((result (cider-sync-request:inspect-prev-page)))
316+
(let ((result (cider-nrepl-send-sync-request '("op" "inspect-prev-page"))))
322317
(when (nrepl-dict-get result "value")
323318
(cider-inspector--render-value result))))
324319

@@ -352,25 +347,21 @@ MAX-NESTED-DEPTH is the new value."
352347
;; Disable hint about analytics feature so that it is never displayed again.
353348
(when cider-inspector-display-analytics-hint
354349
(customize-set-variable 'cider-inspector-display-analytics-hint nil))
355-
(let ((result (cider-nrepl-send-sync-request `("op" "inspect-display-analytics")
356-
(cider-current-repl))))
350+
(let ((result (cider-nrepl-send-sync-request `("op" "inspect-display-analytics"))))
357351
(when (nrepl-dict-get result "value")
358352
(cider-inspector--render-value result :next-inspectable))))
359353

360354
(defun cider-inspector-toggle-pretty-print ()
361355
"Toggle the pretty printing of values in the inspector."
362356
(interactive)
363-
(let ((result (cider-nrepl-send-sync-request
364-
`("op" "inspect-toggle-pretty-print")
365-
(cider-current-repl))))
357+
(let ((result (cider-nrepl-send-sync-request `("op" "inspect-toggle-pretty-print"))))
366358
(when (nrepl-dict-get result "value")
367359
(cider-inspector--render-value result))))
368360

369361
(defun cider-inspector-toggle-view-mode ()
370362
"Toggle the view mode of the inspector between normal and object view mode."
371363
(interactive)
372-
(let ((result (cider-nrepl-send-sync-request `("op" "inspect-toggle-view-mode")
373-
(cider-current-repl))))
364+
(let ((result (cider-nrepl-send-sync-request `("op" "inspect-toggle-view-mode"))))
374365
(when (nrepl-dict-get result "value")
375366
(cider-inspector--render-value result :next-inspectable))))
376367

@@ -402,7 +393,9 @@ current-namespace."
402393
(interactive (let ((ns (cider-current-ns)))
403394
(list (cider-inspector--read-var-name-from-user ns)
404395
ns)))
405-
(when-let* ((result (cider-sync-request:inspect-def-current-val ns var-name)))
396+
(when-let* ((result (cider-nrepl-send-sync-request `("op" "inspect-def-current-value"
397+
"ns" ,ns
398+
"var-name" ,var-name))))
406399
(cider-inspector--render-value result)
407400
(message "Defined current inspector value as #'%s/%s" ns var-name)))
408401

@@ -415,13 +408,12 @@ current-namespace."
415408
(cider-nrepl-send-request
416409
`("op" "inspect-print-current-value"
417410
,@(cider--nrepl-print-request-plist fill-column))
418-
(cider-popup-eval-handler buffer)
419-
(cider-current-repl))))
411+
(cider-popup-eval-handler buffer))))
420412

421413
(defun cider-inspector-tap-current-val ()
422414
"Sends the current Inspector current value to `tap>'."
423415
(interactive)
424-
(let ((response (cider-sync-request:inspect-tap-current-val)))
416+
(let ((response (cider-nrepl-send-sync-request '("op" "inspect-tap-current-value"))))
425417
(nrepl-dbind-response response (value err)
426418
(if value
427419
(message "Successfully tapped the current Inspector value")
@@ -433,94 +425,17 @@ current-namespace."
433425
(seq-let (property value) (cider-inspector-property-at-point)
434426
(pcase property
435427
(`cider-value-idx
436-
(let* ((idx value)
437-
(response (cider-sync-request:inspect-tap-indexed idx)))
438-
(nrepl-dbind-response response (value err)
439-
(if value
440-
(message "Successfully tapped the Inspector item at point")
441-
(error "Could not tap the Inspector item at point: %s" err)))))
428+
(cl-assert value)
429+
(nrepl-dbind-response (cider-nrepl-send-sync-request `("op" "inspect-tap-indexed"
430+
"idx" ,value))
431+
(value err)
432+
(if value
433+
(message "Successfully tapped the Inspector item at point")
434+
(error "Could not tap the Inspector item at point: %s" err))))
442435
(_ (error "No object at point")))))
443436

444437
;; nREPL interactions
445438

446-
(defun cider-sync-request:inspect-pop ()
447-
"Move one level up in the inspector stack."
448-
(cider-nrepl-send-sync-request `("op" "inspect-pop")
449-
(cider-current-repl)))
450-
451-
(defun cider-sync-request:inspect-push (idx)
452-
"Inspect the inside value specified by IDX."
453-
(cider-nrepl-send-sync-request `("op" "inspect-push"
454-
"idx" ,idx)
455-
(cider-current-repl)))
456-
457-
(defun cider-sync-request:inspect-previous-sibling ()
458-
"Inspect the previous sibling value within a sequential parent."
459-
(cider-nrepl-send-sync-request `("op" "inspect-previous-sibling")
460-
(cider-current-repl)))
461-
462-
(defun cider-sync-request:inspect-next-sibling ()
463-
"Inspect the next sibling value within a sequential parent."
464-
(cider-nrepl-send-sync-request `("op" "inspect-next-sibling")
465-
(cider-current-repl)))
466-
467-
(defun cider-sync-request:inspect-next-page ()
468-
"Jump to the next page in paginated collection view."
469-
(cider-nrepl-send-sync-request '("op" "inspect-next-page")
470-
(cider-current-repl)))
471-
472-
(defun cider-sync-request:inspect-prev-page ()
473-
"Jump to the previous page in paginated collection view."
474-
(cider-nrepl-send-sync-request '("op" "inspect-prev-page")
475-
(cider-current-repl)))
476-
477-
(defun cider-sync-request:inspect-set-page-size (page-size)
478-
"Set the page size in paginated view to PAGE-SIZE."
479-
(declare (obsolete "use `inspect-refresh' op instead." "1.15.0"))
480-
(cider-nrepl-send-sync-request `("op" "inspect-set-page-size"
481-
"page-size" ,page-size)
482-
(cider-current-repl)))
483-
484-
(defun cider-sync-request:inspect-set-max-atom-length (max-length)
485-
"Set the max length of nested atoms to MAX-LENGTH."
486-
(declare (obsolete "use `inspect-refresh' op instead." "1.15.0"))
487-
(cider-nrepl-send-sync-request `("op" "inspect-set-max-atom-length"
488-
"max-atom-length" ,max-length)
489-
(cider-current-repl)))
490-
491-
(defun cider-sync-request:inspect-set-max-coll-size (max-size)
492-
"Set the maximum number of nested collection members to display to MAX-SIZE."
493-
(declare (obsolete "use `inspect-refresh' op instead." "1.15.0"))
494-
(cider-nrepl-send-sync-request `("op" "inspect-set-max-coll-size"
495-
"max-coll-size" ,max-size)
496-
(cider-current-repl)))
497-
498-
(defun cider-sync-request:inspect-set-max-nested-depth (max-nested-depth)
499-
"Set the level of nesting to display before truncating to MAX-NESTED-DEPTH."
500-
(declare (obsolete "use `inspect-refresh' op instead." "1.15.0"))
501-
(cider-nrepl-send-sync-request `("op" "inspect-set-max-nested-depth"
502-
"max-nested-depth" ,max-nested-depth)
503-
(cider-current-repl)))
504-
505-
(defun cider-sync-request:inspect-def-current-val (ns var-name)
506-
"Defines a var with VAR-NAME in NS with the current inspector value."
507-
(cider-nrepl-send-sync-request `("op" "inspect-def-current-value"
508-
"ns" ,ns
509-
"var-name" ,var-name)
510-
(cider-current-repl)))
511-
512-
(defun cider-sync-request:inspect-tap-current-val ()
513-
"Sends current inspector value to tap>."
514-
(cider-nrepl-send-sync-request '("op" "inspect-tap-current-value")
515-
(cider-current-repl)))
516-
517-
(defun cider-sync-request:inspect-tap-indexed (idx)
518-
"Sends current inspector sub-value to tap>, per IDX."
519-
(cl-assert idx)
520-
(cider-nrepl-send-sync-request `("op" "inspect-tap-indexed"
521-
"idx" ,idx)
522-
(cider-current-repl)))
523-
524439
(defun cider-sync-request:inspect-expr (expr ns)
525440
"Evaluate EXPR in context of NS and inspect its result.
526441
Set the page size in paginated view to PAGE-SIZE, maximum length of atomic
@@ -541,7 +456,7 @@ MAX-COLL-SIZE if non nil."
541456
`("display-analytics-hint" "true"))
542457
,@(when cider-inspector-pretty-print
543458
`("pretty-print" "true"))))
544-
(cider-nrepl-send-sync-request (cider-current-repl))))
459+
(cider-nrepl-send-sync-request)))
545460

546461
(declare-function cider-set-buffer-ns "cider-mode")
547462

0 commit comments

Comments
 (0)