This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-03-06
Channels
- # aleph (2)
- # arachne (4)
- # aws (3)
- # beginners (196)
- # cider (131)
- # cljs-dev (208)
- # clojure (193)
- # clojure-boston (1)
- # clojure-dev (26)
- # clojure-greece (4)
- # clojure-italy (26)
- # clojure-losangeles (1)
- # clojure-russia (11)
- # clojure-spec (40)
- # clojure-uk (78)
- # clojurescript (168)
- # cursive (25)
- # datascript (1)
- # datomic (31)
- # docker (8)
- # docs (1)
- # emacs (20)
- # fulcro (62)
- # hoplon (3)
- # jobs (1)
- # leiningen (3)
- # luminus (1)
- # nrepl (25)
- # off-topic (10)
- # other-languages (3)
- # parinfer (11)
- # planck (37)
- # portkey (54)
- # protorepl (11)
- # re-frame (2)
- # reagent (19)
- # remote-jobs (1)
- # ring (2)
- # rum (8)
- # shadow-cljs (23)
- # spacemacs (4)
- # uncomplicate (6)
- # unrepl (77)
- # vim (56)
- # yada (2)
> My recent pattern has been cider-jack-in
(for clj), then cider-create-sibling-cljs-repl
@mikerod Btw, cider-jack-in-clojurescript
just start a regular Clojure REPL and then invokes cider-create-sibling-cljs-repl
.
The biggest problem right now is that we haven’t implemented injection of the ClojureScript deps. Unfortunately that’s a bit tricky as you can’t be certain which REPL variant the user will want to start and they have different deps.
One cool idea would be to add hotload-deps
from refactor-nrepl
to CIDER itself - then we can just hotload on demand the cljs REPL deps.
Thanks @bozhidar I tried it today and it was working. Was nice to merge both steps into one for me. I guess I had enough setup to not get any issue. It does sound tricky in general. I wanted to go through https://github.com/clojure-emacs/cider/issues/2202 to see what was happening there
Not much still. I mostly focused on decoupling the cljs repl from build tools and some saner error reporting.
@bozhidar did you see that your cljs repl checking didn't work? the ns-find
check isn't sufficient
Unfortunately I managed to mess up even this - for some reason I thought find-ns
works for unrequired namespaces, and took this shortcut.
don't mean to harp on it if you did 🙂 but i'm surprised we haven;'t had more bug reports
I think nrepl-refactor
has something to deal with libraries directly - that might be even better. @benedek
I really hate it that there’s no unified API to just check what are libs that are currently present and you always have to jump through some hoops.
if clj
stays fast we could probably in the future just ask for a copy of the class path
In a way it’s exposed even now - ns-list
returns all namespaces if memory serves, so all you need is to check that list.
The big problem is that you still don’t know the metadata for the library - you might have added the wrong version of some library or whatever and ideally we need a way to check this.
A few days about @xiongtx asked me to create some basic roadmap document for CIDER, so that collaborators can know what to focus on - here’s the first cut https://github.com/clojure-emacs/cider/blob/master/ROADMAP.md
I hope some of you are going to find it useful. As you can see there’s plenty of work to go around, so we need all the help we can get. 🙂
@bozhidar may I ask you why the choice of parseclj
? I think I saw way more tests in edn.el
...it is because of the different representation?
Mostly because I’m worried about edn.el
’s main dependency - peg.el
was last updated 10 years ago and it’s officially hosted on EmacsWiki.
peg
is on GitHub: https://github.com/ellerh/peg.el/tree/081efeca91d790c7fbc90871ac22c40935f4833b
And MELPA: https://melpa.org/#/peg
Btw, since late Jan., MELPA stopped hosting Emacs Wiki packages: https://github.com/melpa/melpa/issues/2342#issuecomment-360023727
That’s why CIDER never picked it up, even though it really could benefit from some Clojure parser. parseclj
is too young, but I hope it can become the parser we all need. 🙂
Of course, I might be wrong and peg.el
might be engineered to perfection. Who knows?!? 😄
> replaces usages of Elisp's read
with parseclj
Can you elaborate on this? Are we using Elisp's read
to read ? If so, I'd guess that
read
is limited to shard data structures b/t Elisp and (e.g. lists). What's the advantage to using
parseclj
in that case?
I think one of the most basic ways to convert lists to elisp is to read
them. Inf-clojure employs the same trick yes.
I have started introducing edn.el
and so far it seems pretty solid. I haven't used in performance-critical things though, and the PR has not yet been merged but "it works on my machine" 😄
edn.el
or parseclj
convert edn to elisp data structures. I think with a slightly different representation of edn in elisp data
The main advantage of using a proper parser is that we won’t be limited to using in results things that exist in Elisp. Some APIs return suboptimal things just because that’s what we can process.
Very simple example - you can’t process directly booleans, as they don’t existing in Elisp.
> basic refactoring stuff (potentially related to the merger of stuff from clj-refactor.el
)
Is it a goal to move the entirety of clj-refactor
into CIDER? Is that wise, given the large number of dependencies clj-refactor
has? https://github.com/clojure-emacs/clj-refactor.el/blob/408ab1f13b8d956dd8d2c839bea5197175ef5a93/clj-refactor.el#L35-L49
Just simple stuff that don’t depend on parsing the code. hotload deps depends just on dynapath, the ns cleanup doesn’t have external deps if I recall correctly.
My concern with the massive deps and the complexity added by the use of the Clojure parser are the main reason this ended up being a separate library in the beginning.
Does Clojure has flycheck
support in Emacs?
there's this: https://github.com/candid82/flycheck-joker
I did a search in MELPA, what about flycheck-clojure
? compare this two packages.
if you're asking me, I don't know. I only answered your question "Does Clojure has flycheck
support in Emacs?" with the one I remembered. 🙂
@bozhidar After my meeting today I’ll be working on [#2203] if you want to throw me down as an assignee.
@bozhidar I got error with flycheck-clojure
package (means squiggly-clojure
) Here is the error:
Debugger entered--Lisp error: (wrong-number-of-arguments (4 . 4) 0)
#f(compiled-function (buffer ex rootex sess) #<bytecode 0xc28c55d>)()
#f(compiled-function (response) #<bytecode 0xc28c5c1>)((dict "ex" "class java.io.FileNotFoundException" "id" "201" "root-ex" "class java.io.FileNotFoundException" "session" "690bc29a-26d8-41c4-856b-64cb809d8853" "status" ("eval-error")))
nrepl--dispatch-response((dict "ex" "class java.io.FileNotFoundException" "id" "201" "root-ex" "class java.io.FileNotFoundException" "session" "690bc29a-26d8-41c4-856b-64cb809d8853" "status" ("eval-error")))
nrepl-client-filter(#<process nrepl-connection> "d2:ex35:class java.io.FileNotFoundException2:id3:2017:root-ex35:class java.io.FileNotFoundException7:session36:690bc29a-26d8-41c4-856b-64cb809d88536:statusl10:eval-erroreed3:err235:FileNotFoundException Could not locate squiggly_clojure/core__init.class or squiggly_clojure/core.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name. clojure.lang.RT.load (RT.java:463)\n2:id3:2017:session36:690bc29a-26d8-41c4-856b-64cb809d8853ed2:id3:2017:session36:690bc29a-26d8-41c4-856b-64cb809d88536:statusl4:doneeed18:changed-namespacesde2:id3:2019:repl-type3:clj7:session36:690bc29a-26d8-41c4-856b-64cb809d88536:statusl5:stateee")
And my config
two questions, is root-ex your file and did you follow the instructions on the readme page?
Yes, I followed instructions on README. And no, root-ex
is not my file, my file is core.clj
.
I’m on my iPad so I can’t test it myself but did you try just running the sample project? https://github.com/clojure-emacs/squiggly-clojure/tree/master/sample-project
I will take a try on that.
its because the signature of the error handler has changed. flycheck-clojure has a dependency on cider 0.8.1 which would call the error handler like so:
(funcall (or eval-error-handler nrepl-err-handler)
buffer ex root-ex session)
and now its a thunk:
(when (member "eval-error" status)
(funcall (or eval-error-handler nrepl-err-handler)))
which is why the error is saying wrong number of arguments. you gave me 4 and I expect 0
and how the default one works:
(defun cider-default-err-op-handler ()
"Display the last exception, with middleware support."
;; Causes are returned as a series of messages, which we aggregate in `causes'
(let (causes)
(cider-nrepl-send-request
(nconc '("op" "stacktrace")
(when (cider--pprint-fn)
`("pprint-fn" ,(cider--pprint-fn)))
(when cider-stacktrace-print-length
`("print-length" ,cider-stacktrace-print-length))
(when cider-stacktrace-print-level
`("print-level" ,cider-stacktrace-print-level)))
(lambda (response)
;; While the return value of `cider--handle-stacktrace-response' is not
;; meaningful for the last message, we do not need the value of `causes'
;; after it has been handled, so it's fine to set it unconditionally here
(setq causes (cider--handle-stacktrace-response response causes))))))
so now its a thunk because the handler reaches back for exception informationand this comment in flycheck clojure probably explains the change:
;; If the evaluation completes without returning any value, there has
;; gone something wrong. Ideally, we'd report *what* was wrong, but
;; `nrepl-make-response-handler' is close to useless for this :(,
;; because it just `message's for many status codes that are errors for
;; us :(
the response had almost no information. which is why its a thunk because you have to recreate that information anyways@dpsutton So flycheck-clojure
linters need to update? If yes, will you create an PR for this?
I use Figwheel to run cljs, and it looks like that CIDER is in a known broken state when it comes to cljs repls. I am wondering, is there a work around for this issue or should I revert to a previous version of CIDER?
yes, see here: https://github.com/clojure-emacs/cider/issues/2230#issuecomment-370681369
Awesome, thanks!
got a PR to suppress those checks until we implement them better https://github.com/clojure-emacs/cider/pull/2231
@dpsutton I could have committed this immediately, but I didn’t do it because otherwise I won’t really have a motivation to fix the problem.
The workaround is trivial, and a relatively simply fix that came to mind mind was grepping the classpath entries.
I agree on the commented out code. I think I would disagree on leaving cider unable to run clojurescript projects as a motivational to fix the issue though. But it is dev and not the stable release
I don’t want to keep it broken, but I also don’t have time to fix it and it seems no one else has time as well.
I know your time is tight so I was just offering a potential one click fix while the real solution was in the works
I just know how temp solutions often remain permanent, therefore my wariness to just make the validation a no op.
I also noticed there was no validation for the presence of ClojureScript, so I added that as well.
You’re welcome! 🙂 I’m just sorry for the breakage I caused before. Down the road it’d be nice to enhance those verifications with some version checking, etc, but this will do for now.
no worries. i was fine with going into the codebase and changing it to work for me pending a fix. but that's quite an annoyance to someone who enjoys it and just wants to work
so apparently cider-cljs-lein-repl
is now deprecated and cider-defaul-cljs-repl
needs to be used. But that broke my workflow. Where I can read about this change, to adjust my .dir-locals ?
my old setup was:
((nil . ((cider-cljs-lein-repl .
"(do (require 'figwheel-sidecar.repl-api)
(require 'integrant.repl)
(integrant.repl/go)
(figwheel-sidecar.repl-api/cljs-repl))"))))
simply replacing cider-cljs-lein-repl
with cider-default-cljs-repl
did not work as I hoped it would@ag you actually have a special case not considered in the code. it was changed to accept "Figwheel"
or something similar and it would look up how to start a figwheel repl. however, you have a custom one and it does not allow for a custom repl now (I don't think)
but you could try
(add-to-list 'cider-cljs-repl-types
`("Figwheel+Integrant"
"(do (require 'figwheel-sidecar.repl-api)
(require 'integrant.repl)
(integrant.repl/go)
(figwheel-sidecar.repl-api/cljs-repl))"
nil))
in your init and then setting cider-default-cljs-repl
to "Figwheel+integrant" in your dir localsI think that worked... now, I'm wondering if I can put the thing above into .dir-locals.el
actually, I was just about to ask: how do we set cider-default-cljs-repl
in .dir-locals.el? I tried:
((nil
(cider-refresh-before-fn . "mount.core/stop")
(cider-refresh-after-fn . "mount.core/start")
(cider-default-cljs-repl . "Figwheel"))
(emacs-lisp-mode
(flycheck-disabled-checkers . "emacs-lisp-checkdoc")))
but the prompt is still there on cider-jack-in-clojurescript
.@bozhidar: very nice talk: https://www.youtube.com/watch?v=1YCkOo5Y4Oo
indeed, just watched it!
@ag i know you can execute code in dir locals but that stuff gets a little janky. You could use a name that's inoffensive outside of your project. instead of Figwheel+Integrant just call it "<Project-name>startup" and then it doesn't matter that tis visible to other things
and this may not be a proper dir locals thing anyways. you are modifying cider's notion of startup invocations
I was hoping people don't have to do anything "special" to start working on our project. dir-locals is one way
have you seen this page on how to eval code in dir locals? You could put the add-to-list call in there https://emacs.stackexchange.com/questions/21955/calling-functions-in-dir-locals-in-emacs
honestly i would probably keep everyone on stable until the new api here settles down. i think we're missing one more knob and the logic to check each in turn and then it would be good to go
so I did this in .dir-locals.el
((nil . ((eval . (add-to-list 'cider-cljs-repl-types
`("Figwheel+Integrant"
"(do (require 'figwheel-sidecar.repl-api)
(require 'integrant.repl)
(integrant.repl/go)
(figwheel-sidecar.repl-api/cljs-repl))"
nil)))
(cider-default-cljs-repl . "Figwheel+Integrant"))))
and that set the vars correctly, cider-jack-in-clojurescript worked, but... it also prompted for the REPL, I thought it wouldn't
@ag i don't think changing the CIDER code would be that difficult at all. it might be easier to do a PR than muck with side-effecting dir locals
just add a var that allows for a custom repl invocation and some logic that does: if custom repl invocation, use that, if type is set, look up how to use it, else ask
hey all, quick question
at my new gig they use clojure on the backend and clojurescript on the frontend
i’m curious whether it’s possible to run a regular cider repl -and- some kind of clojurescript repl at the same time
it’s really tough to not be able to jump to definition / namespace / etc. in cljs
code
that's actually the default. when you run cider-jack-in-clojurescript
you're gonna end up with two repls. one clj and one cljs
@dpsutton I think I’m running into some gross issues because they use IntelliJ internally and seem to be loading some Intellij-related clsj
in their IDE
so jacking in totally barfs
guess i’ll have to debug that on my end
It's saying it's not finding piggie back. Typically this is included on one of the profiles in the project clj file. Cursive is much better at profile support
I wonder if it will require editing the config, they might not be happy with me checking something like that in 😕
If you have to edit the config, why not just stash that change as needed? That’s how I do it on my projects so I don’t conflict with my team.
@emoarmy that’s a workable idea
yet-another-question
I have the cider repl running just fine, but jumping to ns et al don’t work
it’s odd as it lists all the namespaces, but selecting one just says that it’s not found
cider-find-ns