This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-18
Channels
- # announcements (1)
- # aws (13)
- # beginners (55)
- # calva (8)
- # cider (73)
- # cljs-dev (96)
- # clojure (119)
- # clojure-europe (4)
- # clojure-italy (41)
- # clojure-nl (14)
- # clojure-uk (6)
- # clojurescript (90)
- # cursive (14)
- # data-science (1)
- # datomic (20)
- # dirac (1)
- # emacs (32)
- # figwheel-main (11)
- # fulcro (81)
- # hoplon (2)
- # jobs (1)
- # lein-figwheel (2)
- # luminus (1)
- # lumo (19)
- # nyc (3)
- # off-topic (60)
- # other-languages (1)
- # pedestal (5)
- # quil (1)
- # re-frame (3)
- # reagent (3)
- # reitit (5)
- # remote-jobs (1)
- # ring-swagger (2)
- # shadow-cljs (43)
- # sql (15)
- # tools-deps (20)
- # vim (21)
- # yada (6)
I'm working in Fulcro on Cider mode. How can I keep indentation two spaces deep? (which I think is ideal for Clojure??) It is too much indentation as you can see.
probably leveraging define-clojure-indent
? I have this:
(define-clojure-indent
(for-all 1)
(defroutes 'defun)
(GET 2)
(POST 2)
(PUT 2)
(DELETE 2)
(HEAD 2)
(ANY 2)
(context 2)
(reporting 1))
Maybe adding defsc
there can fix your problem.Did this, it doesn't work.
There’s also a global config for this, but it will force 2-space indentation everywhere.
So 2-space is not ideal globally?
Depends on your perspective. 🙂 It’s not aligned with classic Lisp traditions, but many Clojure devs like it. That’s why the option exists.
It's not working in this case too.
Version: 20190413.909
So, you evaluated this and nothing changed in clojure-mode? I can’t imagine how this can happen.
I added this to init.el
file.
@dpsutton any idea how to make add-libspec or the refactoring work in clojure-lsp
? when i try to run them i get
lsp--send-request-async: No workspace could handle workspace/executeCommand [2 times]
been looking into this over coffee. it looks like you have to register all of the actions at startup
so need to make the hashmap have all of these
(def refactorings
{"cycle-coll" #'refactor/cycle-coll
"thread-first" #'refactor/thread-first
"thread-first-all" #'refactor/thread-first-all
"thread-last" #'refactor/thread-last
"thread-last-all" #'refactor/thread-last-all
"move-to-let" #'refactor/move-to-let
"introduce-let" #'refactor/introduce-let
"expand-let" #'refactor/expand-let
"clean-ns" #'refactor/clean-ns
"add-missing-libspec" #'refactor/add-missing-libspec})
oi, thx. i am bit slow tho… or just the def
confusing me… so i need to put those pairs into :action-handlers
yeah. but i'm not sure exactly what the values of the hash table are, but the keys are the refactoring commands here
interestingly, lsp-code-actions-at-point
can look these up dynamically and returns a hash table suitable for us i think
hm… no joy so far. as far as i see action-handlers
are good when you want to handle the whole call yourself. eg. it is a hook *before* the request is sent to the server
Indeed. I think he works with @dpsutton, therefore the assumption he’s also quite familiar with the project.
My understanding is that CIDER launches with the :dev profile. Is there a way to specify another one?
cider launches lein which defaults to the dev profile. you can do a one-off by jacking-in with a prefix arg to edit the command
I'll take a look, thank you very much!
Is there a way to get a hold of project-dir once inside a CIDER buffer?
how hard would it be to make the buffer readonly when you jumped to a source within ~/.gitlibs
?
Do You need to distinguish when in the buffer normally versus when there from navigation or is it always read only
@ghadi Not hard at all. You can simply add a find-file-hook
that checks the directory of the file you’re visiting and makes its buffer read-only
.
That’s something you can add to your global Emacs config, as it’s not really tied to CIDER in any way.
Is there a way to get println
statements to go to stdout in the terminal running the main process?
(defn nrepl-handler
[]
(require 'cider.nrepl)
(ns-resolve 'cider.nrepl 'cider-nrepl-handler))
(defonce the-nrepl-server (nrepl-server/start-server :bind "0.0.0.0"
:handler (nrepl-handler)))
:dependencies [[org.clojure/clojure "1.10.0"]
[org.clojure/data.json "0.2.6"]
[org.clojure/tools.nrepl "0.2.13"]
[cider/cider-nrepl "0.17.0"]]
You’re welcome! Btw, another thing you can do is to just put .dir-locals.el
there making everything in the directory read-only. Might be even simpler.
I’ve got a cool little commit that I’d like to share with all of you - https://github.com/clojure-emacs/cider/commit/fc4362a745df1ef959af579679408582167be898
Now definition and documentation lookup should work even without cider-nrepl being present. That’s part of the initiative to make more of the core functionality work without middleware.
@dpsutton Yeah, we’ll need a different code path there, but it’s perfectly doable IMO.
The only problem with the fallbacks is that you have to inline them in the Elisp code, which is kind of annoying. When we implement the client-side nREPL code injection the clients would be able to just load a few Clojure files themselves which would be more elegant.
Yep, parseedn opens a lot of possibilities - before this dealing with native Clojure data was so much pain… I had to convert everything to a list of strings. 😄
@timvisher Did you try this?
(defcustom cider-redirect-server-output-to-repl t
"Controls whether nREPL server output would be redirected to the REPL.
When non-nil the output would end up in both the nrepl-server buffer (when
available) and the matching REPL buffer."
:type 'boolean
:group 'cider
:safe #'booleanp
:package-version '(cider . "0.17.0"))
Hmm… No I didn't. Correct me if I'm wrong but if I'm cider-connect
ing to a running nrepl server there shouldn't be an nrepl-server
buffer in play?