This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-05
Channels
- # announcements (3)
- # beginners (225)
- # calva (3)
- # cider (110)
- # circleci (18)
- # clj-kondo (15)
- # cljdoc (1)
- # cljsrn (12)
- # clojure (77)
- # clojure-dev (39)
- # clojure-europe (3)
- # clojure-houston (2)
- # clojure-italy (9)
- # clojure-nl (16)
- # clojure-romania (1)
- # clojure-spec (5)
- # clojure-uk (20)
- # clojuredesign-podcast (28)
- # clojurescript (89)
- # core-async (4)
- # cursive (10)
- # datomic (3)
- # defnpodcast (5)
- # emacs (17)
- # events (1)
- # figwheel (4)
- # graalvm (6)
- # juxt (1)
- # pathom (4)
- # pedestal (5)
- # re-frame (4)
- # remote-jobs (3)
- # rewrite-clj (4)
- # shadow-cljs (90)
- # spacemacs (2)
- # sql (7)
- # tools-deps (4)
- # vim (52)
- # xtdb (7)
Just a little note here - at the moment orchard does not run on node either. I was planning the port but, for instance, got rid of the cljc conversion in the info PR because it was too messy. Will do that in another PR. But that is just info
-> so anything that runs on JVM and can analyze cljs code is a good candidate for the orchard for pez's use case
Yeah, that’s true. In general what we need right now is to agree on the exact strategy for this analysis, though. E.g. if someone can figure out how to get more info out of the runtime analysis in the xref ns
and port this also to ClojureScript perhaps we can still avoid having to keep track of a project’s AST.
Generally if we go down with generating the AST approach externally we need to also figure out some criteria for keeping it up to date - e.g. monitor for file-system changes and regen ASTs on those or something along those lines. I guess we can have a simple daemon-type of service that just handles this, but it doesn’t feel like a great fit with REPL-driven development, as in essence it would completely decoupled from the REPL state.
For the record. Calva uses nREPL already so solutions that rely on the JVM are still potentially good for Calva if we go via nREPL. It might still make more sense to use a cljs library for things like static analyze, but it's not the only option. Pinging in @slack1038 here who is the one who have started to investigate how clj-refactor can bring value to Calva users.
Well, I guessing we can certainly have a Clojure parser that parses ClojureScript code. We definitely want to avoid evaluation of the code anyways.
Just to clarify not clj-refactor but refactor-nrepl 😄 clj-refactor is the emacs plugin but i try to use it as insperation what to add to calva but currently stuck with the find-symbol what was here already discussed
Oh, yes, I am confusing things. s/clj-refactor/refactor-nrepl on about everything I have said here. 😃
Don’t worry - I always manage to figure out what something is actually referring to.
> I guess we can have a simple daemon-type of service that just handles this, but it doesn’t feel like a great fit with REPL-driven development, as in essence it would completely decoupled from the REPL state.
we started to look into lsp but we didnt want to have to tell the user to first install something diffrent like the clojure-lsp and with the documantion, at least for me, is it not clear how to actualy use it
> it would completely decoupled from the REPL state
For situations when you have evaluated something that is not yet saved to disk (or even hidden inside (comment)
and such)?
I mean, I see that it always would be completely decoupled, but wondered when you see it matters (most).
> not clear how to actualy use it For Calva it would be something like just register it, I think, and features would just magically appear.
#trin i think is a good candidate for this -- only it is not there yet obviously. it can be easily adapted to rewrite-cljc when @lee releases it. i can only restart working on it in anger in September tho
@slack1038 Yeah, I understand what you mean. With clojure-lsp
you need to download the binary, put it somewhere on your classpath and setup properly your editor to run it when it needed. I have no idea how LSP servers deal with multiple projects and how the editors know when to start/restart/stop those.
i use it in emacs in parallel with cider nowadays. it kicks in when i open a source file in a project. it creates a directory for caches and config files in the project root directory
when I open a source file in a new project it does a big analysis and caches the results -- you can opt out or postpone this
suppose this cache is then kept up-to-date but i have not looked into this particular part
Which reminds me, refactor-nrepl
has an op for warming up the AST cache. Is this cache kept up-to-date? If anyone knows w/o having to do my research work for me. 😄 (When @slack1038 and I tried it, it seemed like the cache was kept updated.)
I think it looks at file last modified dates but i may be lying. but it is deffo kept up-to-date
Warm-cache is sent in the background when cider first connects so that the first refactor operation you do doesn't take forever.
That's what @slack1038 did in his Calva branch as well.
We’ve agreed with @pez to form a “Task Force” to tackle this and other common problems. I’ll form some channel about this soon and invite everyone interested in the work to join in (and the calls we’re about to have). I think it’s time we started working on the Clojure tooling foundations in a more structured manner and that’s going to be the first step. 🙂
is it actually possible to send a form directly to cider and see its evaluation?
I can't find the command in the docs or checking all the cider functions
but I think I've seen someone doing it at heartofclojure
(i could probably write the function myself if it doesn't exist)
actually sending the form to the right cider repl and switching would be enough, no need to evaluate as well automatically
ah I found it now
it was cider-insert.*
and all the related functions, cool I can't believe I never used it 😄
during the conf btw, I was about to ask people why the evaluate function by function
so you don't have to evaluate function by function (but everyone has is own personal repl workflow) 😁
one can have really the basic things there covered without going through the whole doc
(setq cider-invert-insert-eval-p t)
(setq cider-switch-to-repl-after-insert-p nil)
(setq cider-switch-to-repl-on-insert-p nil)
helpful for the insert commands@darioszr The basic workflow is a bit too basic right now, but my idea for this section is to teach people how to use CIDER is something like 3-5 minutes. 10-15 essential commands and off to productivity. 🙂
(setq clojure-toplevel-inside-comment-form t)
for working inside of comment blocks
"Whether to invert the behavior of evaling.
Default behavior when inserting is to NOT eval the form and only eval with
a prefix. This allows to invert this so that default behavior is to insert
and eval and the prefix is required to prevent evaluation."
Yeah, the original idea was that you’d be sending the whole forms only if you needed to edit them before evaluating them. Turned out some people liked keeping tracked of things they eval in the REPL.
I mean the essential stuff are already there 😁 as long one can evalute buffer and expression, imho that's the things one need as basic
as perhaps good hint we could add the command to switch to namespace perhaps in basic? ( i use it quite a lot
before i was using cider for that, but I tend to forget all the keystroke combinations 😁 so in-ns
for that was more in my brain.. 😁
Hi. I have a problem with repl in this setup: emcs/cider/shadow-cljs. I start it with cider-jack-in-cljs, then choose shadow as the repl type, then 'select shadow-cljs build' - app, then 'visit... in browser' - n, and it drops me into cljs.user> prompt (even though I have :nrepl {:init-ns my.ns} in shadow-cljs.edn.
if I try to call anything from my.ns, like (my.ns/main!), I get error 'no application has connected to the repl server. make sure your js environment has loaded your compiled clojurescript code.'
I think so. I'm able to compile it with 'shadow-cljs compile app' and it produces target/main.js which I'm able to run with nodejs
you mean, is code public? no, but I can post shadow-cljs.edn, it's the only thing that's needed, right?
{:source-paths ["src"]
:dependencies [[reagent "0.8.1"]
[cljs-styled-components "0.1.5"]
[org.clojure/core.async "0.4.490"]]
:builds {:app {:target :browser
:output-dir "target/js"
:asset-path "js/"
:modules {:main {:init-fn asg.main/main!}}
:devtools {:http-root "target"
:http-port 8080}}}}
example of a shadow-cljs.edn for me that works. I just use cider-jack-in-cljs. CIDER manages nrepl and piggieback and all the goodieshere it is: https://pastebin.com/JpmhZpNg it's pretty barebone
> You do not usually need to set :optimizations since the :target already sets it to an appropriate level.
hmm. i get the same behavior. I wonder how shadow exposes the node cljs environment. perhaps piggieback isn't seeing it?
or actually, piggieback might not be involved. been a while since i've worked inside of shadow
I followed https://shadow-cljs.github.io/docs/UsersGuide.html#_launch_the_clojurescript_repl and got to the point of [:selected :app] cljs.repl> prompt with no errors, but then I'm not able to call anything, but get 'no application has connected to the repl' error
It still needs to be started to connect to the repl, right? Can you connect to a :node-repl?
Try asking in #shadow-cljs , this seems like there is something special with the :node-script
target that we are missing.
for :node-script
you need to manually launch the actual node
process. node-repl
is a special internal "build" that has no direct configuration but handles launching the node
process internally. so from the command line you just run shadow-cljs node-repl
and that gives you the REPL directly. you can "select" that REPL in CLJS by running (shadow.cljs.devtools.api/repl :node-repl)
or start it via (shadow.cljs.devtools.api/node-repl)