Skip to content

Commit 531e4da

Browse files
committed
Define pprint for PendingRequest
This approach is less intrusive than the prior implementation, which made a global choice for all users about how to print things that were both IPersistentMap and IDeref.
1 parent 8142d48 commit 531e4da

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
.nrepl-port
55
**/*/.lsp/.cache
66
**/*/.clj-kondo/.cache
7+
.lsp/.cache
8+
.clj-kondo/.cache
79
/out
810
target/
911
/.DS_Store

src/lsp4clj/server.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@
7272

7373
;; Avoid error: java.lang.IllegalArgumentException: Multiple methods in multimethod 'simple-dispatch' match dispatch value: class lsp4clj.server.PendingRequest -> interface clojure.lang.IPersistentMap and interface clojure.lang.IDeref, and neither is preferred
7474
;; Only when CIDER is running? See https://github.com/thi-ng/color/issues/10
75-
(prefer-method pprint/simple-dispatch clojure.lang.IDeref clojure.lang.IPersistentMap)
75+
;; Also see https://github.com/babashka/process/commit/e46a5f3e42321b3ecfda960b7b248a888b44aa3b
76+
(defmethod pprint/simple-dispatch PendingRequest [req]
77+
(pprint/pprint (select-keys req [:id :method :started])))
7678

7779
(defn pending-request
7880
"Returns an object representing a pending JSON-RPC request to a remote

0 commit comments

Comments
 (0)