Skip to content

Commit 9336907

Browse files
committed
Adjust comment
1 parent 3089d26 commit 9336907

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/lsp4clj/server.clj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,12 @@
9090
Sends `$/cancelRequest` only once, though `lsp4clj.server/deref-or-cancel` or
9191
`future-cancel` can be called multiple times."
9292
[id method started server]
93-
;; Chaining `(-> (p/deferred) (p/catch ...))` seems like it should work, but
94-
;; doesn't.
9593
(let [p (p/deferred)]
96-
;; side-effect of cancellation:
94+
;; Set up a side-effect so that when the Request is cancelled, we inform the
95+
;; client. This cannot be `(-> (p/deferred) (p/catch))` because that returns
96+
;; a promise which, when cancelled, does nothing because there's no
97+
;; exception handler chained onto it. Instead, we must cancel the
98+
;; `(p/deffered)` promise itself.
9799
(p/catch p CancellationException
98100
(fn [_]
99101
(protocols.endpoint/send-notification server "$/cancelRequest" {:id id})))

0 commit comments

Comments
 (0)