This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-04-03
Channels
- # arachne (31)
- # aws (9)
- # bangalore-clj (7)
- # beginners (46)
- # boot (18)
- # cider (21)
- # cljs-dev (8)
- # clojure (154)
- # clojure-dusseldorf (5)
- # clojure-filipino (3)
- # clojure-ireland (4)
- # clojure-italy (9)
- # clojure-russia (6)
- # clojure-spec (6)
- # clojure-uk (52)
- # clojureremote (3)
- # clojurescript (173)
- # clojurewest (14)
- # cursive (24)
- # data-science (2)
- # datomic (18)
- # defnpodcast (1)
- # devcards (1)
- # hoplon (4)
- # instaparse (29)
- # jobs (2)
- # juxt (1)
- # leiningen (3)
- # lumo (78)
- # off-topic (46)
- # om (9)
- # onyx (42)
- # pedestal (33)
- # perun (3)
- # re-frame (9)
- # reagent (6)
- # slack-help (5)
- # spacemacs (2)
- # specter (6)
- # unrepl (157)
- # untangled (99)
- # yada (32)
@thheller thanks, logging was a blatant oversight. so we can imagine log messages like [:log [“ns.or.class.or.whatever.hierarchical.key.as.string” inst & args] group-id?]
now there’s the issue of bridging to any combination of timbre/jul/log4j/logback/slf4j/...
so having them as generic messages on a REPL connection might not make sense as they are not like :out
instead you could do open a new REPL connection and call (log/tail maybe-some-kind-of-filter)
so the connection is specialized to only log related commands and not a generic REPL anymore
I don't feel like connecting to a REPL, upgrading a unrepl and then getting a bunch of log messages just because the system is logging is useful
but no need to overspecialize either: open another unrepl session, activate log there and use its input for resolving log-related elisions
it can then take the id
and open a new connection to interact with the actual log message
I'm really used to the js/console.log
style logging and just dumping everything in there
having log messages using either the control link or a dedicated link is a suitable option
that actions we do go over a second connection (or third) is an implementation detail
so having the :log
messages appear in the first stream only helps to establish context
which I can sometimes look at, maybe click around on a webpage while some log accumulates in the background
that we used a REPL to bootstrap this log tail is just an implementation detail. it is not a REPL.
(although you might add eval
as a log protocol command, but that is not a REPL eval, it cannot read
)
when I find the time to do so I will eventually implement some kind of solution for the browser
I'm too spoiled by the chrome devtools, even having something basic like its console
for CLJ would be amazing
So (map #(/ %) (iterate dec 3))
now machine prints as
(<#C4C63FWP5|unrepl>/ratio [1 3] <#C4C63FWP5|unrepl>/ratio [1 2] 1 <#C4C63FWP5|unrepl>/lazy-error #error {:cause "Divide by zero", :via [{:type <#C4C63FWP5|unrepl>.java/class java.lang.ArithmeticException, :message "Divide by zero", :at <#C4C63FWP5|unrepl>/object [#unrepl.java/class java.lang.StackTraceElement "0x272298a" "clojure.lang.Numbers.divide(Numbers.java:158)"]}], :trace [#unrepl/... nil]})
and the client can render it as (1/3 1/2 1 💩)
Emojis? You're getting me ideas
Well the damage is done
I can't unthink emojis now
@thheller something like:
(let [^ch.qos.logback.classic.Logger logbackroot (org.slf4j.LoggerFactory/getLogger ch.qos.logback.classic.Logger/ROOT_LOGGER_NAME)]
(.addAppender logback
(proxy [ch.qos.logback.core.AppenderBase] []
(doAppend [^ch.qos.logback.classic.spi.ILoggingEvent e]
(when *repl-issued* ; does not exist yet
(unrepl/write [:log (into [(keyword (.getLevel e)) ; todo normalize
(.getTimeStamp e) ; todo to inst
(.getMessage e)] ; todo split and interleave with arguments
(.getArgumentArray e))]))))))
(to reduce the coupling between the UI and the upgrage blob/unrepl impl (eg a CLJS unrepl would not offer the same actions as a CLJ one)
so you take the form mapped to :exit
and you send it (generally through a second repl linkà
@dominicm : First term
$ telnet localhost 5555
user=> (require 'unrepl.repl)(unrepl.repl/start)
nil
[:unrepl/hello {:session :session282, :actions {:exit (unrepl.repl/exit! :session282)}}]
[:prompt {}]
[:prompt {}]
Second term:
$ telnet localhost 5555
user=>(unrepl.repl/exit! :session282)
true
First term:
Connection closed by foreign host.
~$
I hadn't realised that was what the forms looked like in :actions
. That makes loads of sense now.
And I suppose that theoretically I could send the (unrepl.repl/exit! …)
from the first term, even if that's not the intent?
If the main repl is not in a dirty state (busy or in the middle of a form), suicide is possible:
user=> (require 'unrepl.repl)(unrepl.repl/start)
nil
[:unrepl/hello {:session :session292, :actions {:exit (unrepl.repl/exit! :session292)}}]
[:prompt {}]
[:prompt {}]
(unrepl.repl/exit! :session292)
[:started-eval {:actions {:interrupt (unrepl.repl/interrupt! :session292 1), :background (unrepl.repl/background! :session292 1)}} 1]
Connection closed by foreign host.
no I mixed you and @pesterhazy locations
re: multiplexing, no. One can provide a multiplexing layer but unrepl-the-spec is independent of it.
I thought not, just confirming. I was trying to plan how I'd do my multi-hop funkage to stations in the wild. I'll have to have a think about what a multi-plexing layer might look like.
That was the whole point of going to multiple connections, not having to bake multiplexing in
a multiplexing layer may be quite simple as long as you don’t want to handle backpressure
Interested in how the find-usages in refactor-nrepl would be ported. It's a particularly slow operation, so you want to "stream" the values as you get them (channel-like semantics).
Does it need to be an action? Can't it be something running on a dedicated repl or on a thread spawned from the control repl?
My thoughts behind action was having it generate custom tags, so if that can be done without a custom action, that is okay too.
I'm not sure I've explained that well. If I do:
(do (println 1) (Thread/sleep 10000) (println 2))
I get
[:out "1"]
;; some time later…
[:out "2"]
[:eval nil]
I want to try do something like:
[:streamed 1]
;; sleep
[:streamed 2]
[:eval nil]
didn't bring this up in a while https://github.com/Microsoft/language-server-protocol 😉
something like that should be used for tooling stuff .. it also has find-usages built-in
> {:id 1 :method "textDocument/references" :params {:textDocument {:uri "foo.clj"}
:position {:line 1 :character 2}
:context {:includeDeclaration true}}}
< {:id 1 :result [{:uri "foo.clj" :range {:start {:line 1 :character 2} :end {:line 1 :character 6}}}]}
you could also do it in a streaming fashion although the protocol doesn't define that
it does however define {:method "$/cancelRequest" :params {:id 1}}
to cancel the reference request
its just JSON-RPC the lang server protocol just tries to define a standard protocol for editors
I like the way cider looks at these operations as plain clojure functions. They're essentially helper functions, that tooling is able to interpret the result of.
I expect to use some of the tools behind cider-nrepl
, I really don't wnat to write all that stuff by myself 🙂
https://github.com/autozimu/LanguageClient-neovim cool 😄 Get LanguageServer working then 😉
but currently I think thats much more complicated than just connecting to a dedicated port
but when you open a .cljs
file it will compile that file and publish some diagnostics
this is from Visual Studio Code, no idea how that would work in neovim
but if that language client support textDocument/didOpen
and publishDiagnostics
it probably just works 😉
Published unravel 0.1.4, with tab completion and prettier exceptions
@cgrand I'm wondering how to track evals
for tab completion I send out a command and get back [:eval '(filter filterv first) 1]
but how do I know which number I should be looking for?
@pesterhazy elaborate
currently I just count how many forms I've sent over the wire
but that seems hacky?
ah I'm still on the older version as of ~5 days ago
so I should listen for started-eval
and compare that to what I sent out?
so I learn the eval-id?
Ideally I would be able to send (with-eval-id #uuid "e35a9235-0517-4017-b9f3-d16b76e5cc44" (get-completions))
and then map the result back to that
sure I can