Skip to content

Commit 01381e7

Browse files
authored
Merge pull request #29 from clojure-lsp/return-nil-from-send-notif
Return nil from sending notification
2 parents b21a656 + 4157ff4 commit 01381e7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/lsp4clj/server.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@
225225
notif (lsp.requests/notification method body)]
226226
(trace this trace/sending-notification notif now)
227227
;; respect back pressure from clients that are slow to read; (go (>!)) will not suffice
228-
(async/>!! output-ch notif)))
228+
(async/>!! output-ch notif)
229+
nil))
229230
(receive-response [this {:keys [id error result] :as resp}]
230231
(let [now (.instant clock)
231232
[pending-requests _] (swap-vals! pending-sent-requests* dissoc id)]

test/lsp4clj/server_test.clj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@
124124
(h/assert-take output-ch)))
125125
(server/shutdown server)))
126126

127+
(deftest should-return-nil-after-sending-notifications
128+
(let [input-ch (async/chan 3)
129+
output-ch (async/chan 3)
130+
server (server/chan-server {:output-ch output-ch
131+
:input-ch input-ch})]
132+
(server/start server nil)
133+
(is (nil? (server/send-notification server "req" {:body "foo"})))
134+
(server/shutdown server)))
135+
127136
(deftest should-cancel-request-when-cancellation-notification-receieved
128137
(let [input-ch (async/chan 3)
129138
output-ch (async/chan 3)

0 commit comments

Comments
 (0)