Skip to content

Make discarding-stdout optional? #49

Open
@lynaghk

Description

@lynaghk

First, let me say thanks for this awesome library! I'm working on an LSP backend for my own lil' language and was thrilled to find such a well designed and documented library in Clojure =D

I'm using a socket backend rather than stdin/stdout so that I can easily iterate on the LSP backend using the the usual clj-reload-type REPL workflow. I was confused as to why my println and telemere/log calls weren't having any effect from within, e.g.

(defmethod lsp4clj.server/receive-notification "exit"
  [_ context params]
  (println "LSP exit notification received")
  nil)

Then I read the docs more closely and found this discarding-stdout

(defn thread-loop [buf-or-n f]
(let [ch (async/chan buf-or-n)]
(async/thread
(discarding-stdout
(loop []
(when-let [arg (async/<!! ch)]
(f arg)
(recur)))))
ch))

Would you be open to making this optional somehow? Either an explicit option that's threaded through or, if that's too onerous, perhaps a dynamic var that can be rebound? I'm happy to knock out a PR if you have a preferred approach.

No worries if not too, I just figured I'd ask in case y'all think it'd be in scope. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions